-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling set_configuration from Ftdi.open_from_device()? #268
Comments
What kind of read only request can you make, I'm not sure to understand the question? |
Essentially, I just need to open an Ftdi device and read some values from the EEPROM, for example, something like this: ftdi = Ftdi()
eeprom = FtdiEeprom()
ftdi.open(vid, pid, serial=sn)
eeprom.connect(ftdi)
print(eeprom.product) The above sequence triggers the ftdi_sio unbind. |
To "read" from the EEPROM, it is required to write commands to one of the FTDI interface. In order to access the interface, the interface should be granted exclusive access. As the kernel is already using the interface for serial purpose, PyFtdi first needs to get exclusive access so there could not be concurrent access between the user space application and the kernel usb serial driver. You may be able to hack PyFtdi to bypass any protection - although I'm not sure the Linux kernel can let a user application access the same USB device interface as the one it already managed, but I would certainly not recommend to do so, as it would lead to unmanaged concurrent access to the same HW, as there's no sync between the app and the kernel driver. Claiming and releasing the interface is the equivalent of a global synchronisation point. |
I see. That makes sense. Thanks for such detailed explanation! |
When I open an Ftdi device using open(), the method invokes open_from_device() which internally invokes self._usb_dev.set_configuration()
Calling set_configuration() on the USB device causes the Linux kernel to unbind the ftdi_sio driver from the device:
I was wondering: is it really necessary to call set_configuration() from open_from_device() even if I only use the device in read-only mode (i.e., I don't perform any updates or modifications to it)?
The text was updated successfully, but these errors were encountered: