Controlling USB devices with Python and libusb @siliconlabs
Vložit
- čas přidán 6. 04. 2016
- Controlling USB devices with Python and libusb @siliconlabs
-----------------------------------------
Subscribe to Adafruit on CZcams: adafru.it/subscribe
Join our weekly Show & Tell on G+ Hangouts On Air: adafru.it/showtell
Watch our latest project videos: adafru.it/latest
New tutorials on the Adafruit Learning System: learn.adafruit.com/?...
----------------------------------------- - Věda a technologie
This might be one of the best videos on USB I’ve ever seen. Fantastic job by the presenter, very clear communication of the concepts. Thank you for taking the time on this!
Thanks for your time.
I'm in the process of creating a program to interface with a third party driver. This video and the recommended book helped immensely. Thank you! :)
is there many devices to run python and have some IO digitial+analog+i2c+spi+usb ... and wlan/ethernet? raspberry, beaglebone, ariette g25?
Super. Nice explanation. Keep it up. Thank you.
Very helpful, got my first steps into IoT. worked it out on OSX
Would you be kind and share the key parts of your code. I am running into permission issues on my M1 mac pro. Does your code run properly on that hardware ? Thanks
@@KanePat Were you able to fix this problem?
I'm working with a FTDI CCD and would like to the data from the microcontroller using python's usb module, How do I go about it? (I have the values of bmRequestype,wValue and etc.)
How to retrieve data or fetch a data from a device connected to the laptop when ICD do not have reType, bReq, wVal and wIndex values? Please advise. As I need help getting the data from long range finder using python.
So how do i connect to a SL-4012 Sound Level Meter to read data
That really helped! Although one thing that I would need to know is how would you configure the CP2102N GPIO2 pin to work in RS485 mode though? I understand you had to configure GPIO0/GPIO1 pins in the same manner :)
Will save for later and wait for HD. 360p doesn't do Lady Ada justice >.
Great video
Seems to work well for linux. On windows, dev.ctrl_transfer does not work. Anyone knows the workaround?
It would be great if you've mentioned how to get started with libusb, all I'm getting is "No backend available" error in windows 10
you can use this to get libsub learn.adafruit.com/adafruit-ft232h-breakout/windows-setup
For me, in python 3, I had to add: import usb.backend.libusb1 and BACKEND = usb.backend.libusb1.get_backend(find_library=lambda x: "C://_THE_PATH_WHERE_LIBUSB1_IS"). It's a good tutorial though.
@@MSandovalPhD should the path include the file name libusb1.py? Can you give an example? Also what version of python?
same issue here
Can you post the code used? Thank you.
thank you!
How do I write code to encrypt whole usb drive in python
Excellent explanation of the technology. Is there something similar on a break out board that can serve as a high speed usb host device with transfer data speeds at or beyond 480 Mbps?
yeah cypruss fx2
Hey Lydia I am in a bad spot. Ive spent the last 10 hours trying to send a hex data string to a hidusb device in order to actuate a physical relay to power lighting. Can you point me in a good direction?
can LIBUSB and pyusb be used for instruments whose drivers are no installed in my computer? or i can do it with pyserial?? I have a instrument(PSD9003 programmable power supply) but i don't have its drivers and i am in urgent need to automate the instrument! Can you help?
Yes, as long you have an Interface Control Document to know what the data stream and commands are, like a list of old AT commands for modems. However, for me I used open source bench power supplies like this www.crowdsupply.com/envox/eez-h24005
i need a help ..
i want to control servo motors by usb game pad connected to the pc .The servo is connected to the rpi3 . The rpi is connected to pc by Ethernet.How to define game pad in rpi code
You need to use sockets to create a network connection over eathernet to rpi from pc. Than get the pc to send the inputs as strings to the pi, and read them as if they were keyboard inputs with an if statement.
Great video, thank you . How to install libusb 1.0 for PyUSB on Windows 10?
How to immute a USB identifier?
Is there any program that can simulat key press on pc to Mobile by usb c ....??
Please help...
@@pritam_maurya22 nobe can't find anything...
How can I copy file from mass storage device without any system just in libusb, How can I do it ?
In python? If so use os.walk() to walk a directory tree, than just copy the file located in the returned paths.
I know it's been 5 years but I will copy and paste my GUI in python3 for a Samsung A11 UART script I'm working on. DISCLAIMER: IDK IF THIS WILL WORK FOR YOU OR ANYONE ELSE LOL.
''''A GUI for backing up a Samsung A11 device using UART. Here's an example program that uses the PyQt5 library to create a simple GUI with a "Start Backup" button: Needs work.
'''
import sys
import os
import subprocess
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QPushButton, QFileDialog, QVBoxLayout, QHBoxLayout, QComboBox
class BackupWindow(QWidget):
def __init__(self):
super().__init__()
# Create the UI elements
self.serial_label = QLabel('Serial Port:')
self.serial_combo = QComboBox()
self.baud_label = QLabel('Baud Rate:')
self.baud_combo = QComboBox()
self.file_label = QLabel('Backup File:')
self.file_edit = QLineEdit()
self.file_button = QPushButton('Browse')
self.start_button = QPushButton('Start Backup')
# Set the default values
self.serial_combo.addItems(['/dev/ttyACM0', '/dev/ttyACM1'])
self.baud_combo.addItems(['9600', '115200'])
self.file_edit.setText('backup.img')
# Create the layout
vbox = QVBoxLayout()
hbox1 = QHBoxLayout()
hbox1.addWidget(self.serial_label)
hbox1.addWidget(self.serial_combo)
hbox1.addWidget(self.baud_label)
hbox1.addWidget(self.baud_combo)
vbox.addLayout(hbox1)
hbox2 = QHBoxLayout()
hbox2.addWidget(self.file_label)
hbox2.addWidget(self.file_edit)
hbox2.addWidget(self.file_button)
vbox.addLayout(hbox2)
vbox.addWidget(self.start_button)
self.setLayout(vbox)
# Connect the signals to the slots
self.file_button.clicked.connect(self.browse_file)
self.start_button.clicked.connect(self.start_backup)
def browse_file(self):
filename, _ = QFileDialog.getSaveFileName(self, 'Select Backup File', '', '*.img')
if filename:
self.file_edit.setText(filename)
def start_backup(self):
# Disable the UI elements while the backup is running
self.serial_combo.setEnabled(False)
self.baud_combo.setEnabled(False)
self.file_edit.setEnabled(False)
self.file_button.setEnabled(False)
self.start_button.setEnabled(False)
# Get the selected serial port and baud rate
serial_port = self.serial_combo.currentText()
baud_rate = self.baud_combo.currentText()
# Get the backup file path
backup_file = self.file_edit.text()
# Start the backup process
cmd = f'sudo dd if={serial_port} of={backup_file} bs=1M'
subprocess.Popen(['gnome-terminal', '--', 'bash', '-c', cmd])
# Close the UI window
self.close()
if __name__ == '__main__':
app = QApplication(sys.argv)
window = BackupWindow()
window.show()
sys.exit(app.exec_())
SH-U09B3 USB Type C to TTL adapter with a CP2102N chip. Basically, it is an upgraded version of a CP2102 chip, which is equivalent to FTDI FT232RL chip compatibility. 3Mbps is the absolute maximum transmission speed that it can reach. Best of luck to you!
Thanks!!! I have a problem running this code. "No backend available" Can you help met?
I had the same issue. any solution found yet?
@@staceyloulouse it has to do with windows environment variables. You need to add python to the home path. if you used the python 3 installer, just use repair and select the option to add to home path/envirment variables.
wow!!!
Hello, would you help me to select parts for my project? I need to control 6 switches with a USB that I want to turn on/off by python. Please name a board or schematic circuit PCB circuit board for this project. I appreciate your guidance in advance. Thank you.
"I'm am in the code apparently" ahah
ahh yeah
1001 Like 😉
i am the 1000 likes !! 🃏
Just for a bit Chinese. it is "Nee" not 'Yee'. so say "Nee hou"!
For a bit of Dutch, "nee hou" means "no hold."
This was useless facts. Haha