-
Notifications
You must be signed in to change notification settings - Fork 669
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
Read common descriptors from sysfs, when available #458
Comments
Write permissions are required because:
Regarding why lsusb seems to you to show a bit more information, that is because lsusb can try to use a few different ways to show you the manufacturer and similar infos: one of those is indeed just fetching the corresponding descriptor from the device, but it can also read that info from udev, or fallback to the USB IDs table. But PyUSB shouldn't be compared to lsusb; rather, it's something that can be used as building block to build something like lsusb (and, IIRC, the usbutils source code includes a PyUSB-based implementation). Footnotes
|
Well, as it seems, when you do |
Please send a patch/PR that implements this special case.
The Linux kernel, specifically the USB core. But I haven't checked whether they might be missing sometimes, you need to check that and handle any cases where they are present in the device, but somehow not in sysfs. |
Well, if you're open to accepting a patch to fix this, I'd be willing to work on it. Can we reopen the ticket for this? It might take a bit as I am also busy with other stuff. |
PS: I would probably not replace any existing logic but just whenever there is "Error Accessing String" do an extra step and try to find the string through /sys/bus/usb |
Done, but I also renamed for accuracy.
Actually, it should probably go in the PyUSB is not a lsusb clone: sure, this feature will improve And the preference order should probably be: locally cached value > (on Linux:) sysfs value > |
Thanks for the direction, will do it like this. |
Running Debian Linux 11 with Python 3.10 and libusb1. I am trying to connect to an LG UltraFine monitor via USB-C.
It works via lsusb (running as my user):
but not via pyusb:
The device file is world readable.
The strange thing is that pyusb and also lsusb try to open the device with write permissions. I wonder why those are necessary to list something.
I can also do
or
I would expect pyusb to be able to show the vendor and manufacturer similar to
lsusb
without having write permissions (which are not necessary).The text was updated successfully, but these errors were encountered: