i am trying to create a maui app for android that can talk to and control a specific hid device. i already have the usb device found, and as far as i know i have a connection to the device. But trying to send a command via control transfer seems to be an issue. While the Control Tranfer method returns a value, which should indicate the message was sent, i dont see anything on the device.
So i think my issue is with the UsbAdressing that the Xamarin controlTransfer requires as a parameter. i have tried to just use UsbAdressing.Out and i have tried to cast the value i would expect it to be, 0x21, to UsbAdressing. This does not work for me. Has anyone had any luck getting controltransfer to work ?
So i found a solution but i dont even feel bad for not asking my original question as this seem ridiculous. TL:DR We got it to work with by making the hid device firmware accept a requesttype of 0x23 instead of only 0x21.
Now just in case anyone wants the full story, me and the guy who made the firmware for the hid device i was trying to connect to, checked the firmware and the device was expecting 0x21 as requesttype. We didnt understand why, it didnt work when i sent controltransfer with a cast to 0x21. So we plugged it into a hardware usb debugger, and saw that one of the first 8 bits that were being sent, just changed when we had 0x21. I cant be more specific then that as i understand it even less. But the 0x21 was nowhere in the first 8 bits, the setup packet.
Then we tested, for the lulz, what would happend if i used 0x23 instead as request type, and we observed it god through and was visible in the 8 bits. Obviously nothing happened on the hid device, as there were no command for 0x23. Soooo the firmware guy just copy-pasted the code that worked for 0x21 and told it to happen if it was 0x23 aswell. Which worked immediately. Him, i and a third guy were extremely confused by this but hey, it worked. our best guess is that 0x21 on Android is reserved or something, even though we couldnt find any resources stating this.
This is just in case some else happend to stumble over a similar situation.