USBIPServerForAndroid
USBIPServerForAndroid copied to clipboard
Yubikey works
Here are 2 fixes which make it possible to use yubikey remotely.
- First fix prevents from reporting incoming packet size as outgoing packet and is probably as universal as I can imagine.
- The second one is a bit tricky and I am not convinced that this is the end of the story. GPT suggested that detecting the end of bulk transfer is not universal condition and can depend on a device. One of the logic listed was exactly what the original code did. If api gives back less than what max packet size is, that is the end of transmission. However, for yubikey it is actually more than max packet size. This hints at possibility that android api reports wrong max size or android api reassemble packets before giving it back or reported max size is wrong or something else. For now this is the fix. I will keep digging - have to look at android api source and probably check what yubikey tools are doing.
@cgutman, what are the original target devices? I assumed the primary use was a USB memory stick. How can I trigger a transfer which will produce one or more packets with size matching max packet size and after a packet shorter than that?
what are the original target devices?
It's been so long that I don't remember. Maybe a USB drive and gamepad?
How can I trigger a transfer which will produce one or more packets with size matching max packet size and after a packet shorter than that?
I'm not sure. A bulk transfer from a mass-storage device seems like it would work.
I have tested with a couple of memory sticks and in all cases all communication is completed with one call to bulkTransfer. I was not able to trigger any communication which would require 2 calls to bulkTransfer. Because I have no access to gamepad with usb, I have took the best available approximation, keyboard. The standard PC keyboard was captured by android, so I used mac keyboard. The test didn't hit code path in question.
How about removing the while loop?
Can you think of any other devices with bulk transfer to get more testing?
How about removing the while loop?
Yeah, I guess that's probably fine.