Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you have to claim an interface before making a control transfer to Endpoint 0?

Tags:

android

usb

I have a game controller connected to my Android device which has 1 interface with a interrupt in endpoint. I know that Android does list endpoint 0 (the control endpoint) when it enumerates endpoints and I know that I can make a control transfer to endpoint 0 by just sending it through any of the other endpoints.

My question is: Do I need to claim an interface (any interface), before I make this control transfer? Does the Android framework require that you gain exclusive access to the interface before talking to endpoint 0, which technically doesn't belong to any interface?

like image 696
user3369427 Avatar asked Sep 16 '15 07:09

user3369427


1 Answers

Yes. You'll see that without force claiming the interface, any call of controlTransfer fails.

Unfortunately, claiming disconnects the USB device from kernel driver. So, if you thought of e.g. changing the resolution of a USB mouse while using it, you'll notice that after changing, the mouse is no longer controlling your Android device.

like image 143
Hartmut Pfitzinger Avatar answered Oct 23 '22 19:10

Hartmut Pfitzinger