I have a TeensyLC in HID mode and a serial port (Serial2).
I wrote code to take serial commands and turn them into HID events.
I use an 8-byte packet that is read and decoded which uses Keyboard and Mouse libraries.
The serial channel is used to send these messages and plain text messages back about what was decoded:
moveRel 0, -1, 0
moveRel -4, 0, 0
moveRel -2, 0, 0
moveRel -1, 0, 0
That works when I plug it into my own computer (and my mouse moves around accordingly).
However when I plug it into a phone using a USB OTG adapter, I get gibberish:
\xFD\x01\x01\x00\x00\x00\x00\x80
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFE\x80\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFD\x00\x00\x00\x00\x00\x80
\xFD\xFE\x00\x00\x00\x00\x00\x00
But it is recognized as a keyboard (and presumably a mouse)
I wrote code to take serial commands and turn them into HID events.
I use an 8-byte packet that is read and decoded which uses Keyboard and Mouse libraries.
The serial channel is used to send these messages and plain text messages back about what was decoded:
moveRel 0, -1, 0
moveRel -4, 0, 0
moveRel -2, 0, 0
moveRel -1, 0, 0
That works when I plug it into my own computer (and my mouse moves around accordingly).
However when I plug it into a phone using a USB OTG adapter, I get gibberish:
\xFD\x01\x01\x00\x00\x00\x00\x80
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFE\x80\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFD\x00\x00\x00\x00\x00\x80
\xFD\xFE\x00\x00\x00\x00\x00\x00
But it is recognized as a keyboard (and presumably a mouse)
Attachments
Last edited: