android_open_accessory_lib
android_open_accessory_lib copied to clipboard
endpoint address
HI, I know it's been a long time since you did this lib but I'm trying to implement this protocol and I'm having issue with read_data in C++ side.
Can I ask you why you choose to set in_addr and out_addr ? I through it's was already defined and we have to pick them with libusb. Otherwise, how Android App can know where to send the data ?
Thank you
If i remember correct, the in_addr and out_addr are the usb endpoints, like socket ports on which data is transfered. The endpoint address is defined by the device. I got the addresses from some docs, I dont remember. Maybe they changed over the years.
Ok thank, I finally found the right endpoint but Android has no doc on that, maybe it change with manufacturer.
Just leaving the way I got my in and out address, in case anyone finds it to be useful in the future.
Once the Android device is in accessory mode, which this library is very well capable of putting it into, you can type in the following command (you might need to change the VID and PID corresponding to the Android USB device listed in lsusb):
sudo lsusb -v -d 18d1:2d00
Then, under Device Descriptor > Configuration Descriptor you have two or more Endpoint Descriptor blocks:
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
And there you go, bEndpointAddress are your addresses. The hex value with IN at the end is the in_addr and the one with OUT the out_addr.