I am working on an own libusb implementation using declares. So far, basic device retrieval/connection is working nicely, including hot plug callbacks.
Getting deeper into device communication, I have issues defining the next steps to get the endpoints.
Following MaxPower in the structure is an ptr to an array of libusb__interface structures, if I read the docs correctly, and looking into the contents of the config descriptor there could indeed be an address starting at byte 16:
But if I take the address at 907D0000 and try to fetch the memory contents,which should be a ptr to an array of libUSB interface descriptors (one in this case), there’s no valid data here. All zero.
Theoretically, all. Practically macOS currently.
Oh, and btw, the memory content above is the active config descriptor. get_config_descriptor(0) returns something different, fully without any signs of an address.
Thank you! I wasn’t aware structure alignment was moved to the attributes field, but that’s why I am addressing the ptr(16) in my example code, where that address reveals no data. Must be something different …
And I wonder why in the upper example TotalLength of the descriptor is 39 bytes. Taking alignment into considerations, libusb_interface is bytes 16-23, followed by the extra ptr bytes 24-31. 32–33 should be ExtraLength, so size should be 34 or 35 if ended with a zero byte, not 39 …
Thanks a lot for taking the time, Julian!
I did not find time to import the code into own project, and I could swear it must have looked a lot like this at some time. But who am I to tell?
Highly appreciated!