0
votes

I'm writing USB OTG peripheral driver for Linux 4.15.x. I've got some issue with setting address for my OTG peripheral device.

On peripheral USB side I'm receiving for set address following bytes: 0x0, 0x5, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0. It means that I should set given address in my peripheral device. But propably I'm doing something wrong because after setting given address my peripheral USB device stops receiving anything from USB bus. I mean I receive no further requests via USB.

At the same time on PC (USB host side) I have in logs:

Device not responding to setup address.
Device not accepting address 54, error -71

The problem is the difference in USB set address req and in error message on PC (USB host) side.

Why those numbers are different? Why PC reports in logs that it tried to enumerate my USB device with different address that in fact it sent?

Any ideas? Did I miss something?

1
Are you sure that your device responded to SetAddress at all? -71 is EPROTO, which seem to happen, when device is not responding - which will make host stop talking to it, as you observed. Are you also able to catch USB protocol trace, to see what exactly is happening on the bus, and what is missing there to have a clue for further debug?nowaqq
Unfortunately I'm not sure, because I have not USB protocol analyser. In kernel logs there are 4 or 5 such a messages with set address, so I assume that my driver is not acknowledging set address at all yet. But still - why is the reason of the difference int those addresses?user2699113
You can try catching USB traffic on host with Wireshark. Does any of the previous SetAddress hold the value you see on device side? Maybe you have Hub in the middle that is not responding correctly?nowaqq
I tried to catch it with tcpdump and I can see get_device_descriptor request from host and my response (from my driver) in pcap. But there is not any set_address request or response in thich pcap. Seems like I'll have to hack linux hcd driver manually.user2699113

1 Answers

0
votes

I think I found the reason for the difference in those addresses. It is because I'm using xhci host controller driver on my PC and xhci has a little different method for maintenance of set address request than ohci, uhci or ehci specs.