-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
usb device enumeration issues // usbip incompatibility #861
Comments
USB captures of a good and bad initialisation. (zip because github supported file types) open with "wireshark usbshark-hackrf-good.pcapng" looking at the first "GET DESCRIPTOR Request DEVICE" in each, the main difference seems to be indeed the length: |
with "a bit" of usart0-print-debugging i narrowed it down to this line: if i comment out that call to usb_set_address_immediate, hackRF works through usbip. but i dont know what that line is supposed to do, or if it might be needed in some cases, so i dont feel comfortable making a PR for this worksforme kludge. perhaps guarding it with some additional check that skips it if oldaddr==newaddr? |
Nice work tracking this down! I think you are right that we should remove that line (well, three lines and a comment), but I'm currently at the "how did this ever work?" phase of debugging. I'm pretty sure we should never set the address when handling a SET_CONFIGURATION request. I suspect that this may have caused other problems on platforms that set the configuration to zero (which I believe Linux does not normally do). It seems that your wireshark captures don't quite allow comparison of the same condition. You can see the difference by filtering for |
the captures were the closest // most comparable i could get with the current setup. (PC with just one USB controller and usb-hid) really looking forward to getting my hands on a LUNA. while i dont think it would have helped me much in this particular case (except as a capture source), it looks like a real gamechanger for any usb-mitm usecases compared to my current "raspi zero using builtin-if in gadgetmode and a max3421e-spi as host-if" kludge. what i could have done differently here is using "proper" jtag/swd tooling to look at/into the hackRF, but at the end of the day, using print-to-serial debugging revealed the code pathes the hackrf was taking well enough and didnt involve any half-pitch soldering or entirely new (to me) tool stacks. |
I hadn't gotten around to testing it with LUNA, but I am confident this is the correct solution based on the USB specification. Thank you for pointing it out! |
Steps to reproduce
minimal steps // devolved repro:
host OS is a fedora.
at that point, dmesg should show some unhappy messages like ...
usb 4-1: device descriptor read/64, error -71
usb 4-1: device descriptor read/8, error -71
usb usb4-port1: Cannot enable. Maybe the USB cable is bad?
note it repeats with /64 a few times, then tries /8, indicating it is related to the probing mechanism described in the ancient mailpost here: https://www.spinics.net/lists/usb/msg02644.html
Expected behaviour
hackrf working through usbip
Actual behaviour
device enumeration fails
Version information
Operating system:
fedora-33 (shouldnt matter as long as it "some linux")
hackrf_info output:
build from current git head, so release 2020.
same symptoms with older versions, both git and release.
Guesses
the hackrf side usb stack seems to dislike the 64 byte sized read request in a way that makes the rest fail.
the reported error -71 seems to be a generic "something went wrong".
the libopencm3 issue tracker has a-plenty of people bumping into same/similar symptoms, the fixes seem to vary wildly depending on platform.
reading through firmware/common/usb* and hackrf_usb/usb* i can not spot any obvious places where 64 byte would be unsupported.
The text was updated successfully, but these errors were encountered: