Modify faulty usb endpoint descriptor
pr8x opened this issue · comments
Is it possible to modify usb endpoint descriptors and change the length of a field? I am trying to fix an old USB device that sends a faulty endpoint descriptor (Most likely wrong WMaxPacketSize
length). Since the descriptor is invalid it might not be enumerated by libusb, so would this even work with this library?
Yes, it is possible to modify the descriptor before sending to the host, you may try to modify or hardcode your preferred descriptor here
Lines 53 to 150 in b0ccd74
Would this also work when the usb device is not recognized by the system due an error in the endpoint descriptor? Also, can the same be achieved via injection files?
Hi,
Are you able to see the usb device via lsusb
command? if yes, then I guess should be able to work. However, I don't have such a usb device to test, so no gurantee that this project could work with it.
Currently, injection files might not be able to work with your use cases, I think this feature is complicated, I can add it to my to do list, and if more people are interested in this feature, I may try to figure it out sooner.
Good news, the device is listed by lsusb
and it seems to be operable. However, when running usb-proxy
I am not seeing the device forwarded to my PC:
sudo ./usb-proxy --device=20980000.usb --driver=20980000.usb --vendor XXX --product_id YYY
Device is: 20980000.usb
Driver is: 20980000.usb
vendor_id is: XXX
product_id is: YYY
Device opened successfully
Setup USB config successfully
Start for EP0, thread id(1663)
event: connect, length: 0
Start hotplug_monitor thread, thread id(1665)
I am using RPI Zero and the USB device is connected to it via an OTG host cable. The other micro usb port is connected to my Windows machine.
EDIT: Just realized that the second USB port is for power only 🤦♂️Ok, I guess I need a RPi 3 or something then...
If I remember correctly, there is no OTG port on RPi 3, you may want to try RPi 4
Ok managed to fix my problem by using a Teensy. Thanks for your help though!