Skip to content

Commit

Permalink
add support for usb hid
Browse files Browse the repository at this point in the history
  • Loading branch information
scpcom committed Aug 31, 2024
1 parent 5d0d4d0 commit 2373dd2
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion buildroot/board/cvitek/SG200X/overlay/etc/init.d/S03usbdev
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,38 @@ then
echo 'licheervnano' > strings/0x409/product
fi
mkdir -p configs/c.1
if [ -e /boot/usb.GS0 ]
if [ -e /boot/usb.hid ]
then
# keyboard
mkdir functions/hid.GS0
echo 1 > functions/hid.GS0/subclass
echo 1 > functions/hid.GS0/wakeup_on_write
echo 1 > functions/hid.GS0/protocol
echo 6 > functions/hid.GS0/report_length
# echo -ne \\x5\\x1\\x9\\x6\\xa1\\x1\\x5\\x7\\x19\\xe0\\x29\\xe7\\x15\\x0\\x25\\x10\\x75\\x1\\x95\\x8\\x81\\x2\\x95\\x1\\x75\\x8\\x81\\x3\\x95\\x5\\x75\\x1\\x5\\x8\\x19\\x1\\x29\\x5\\x91\\x2\\x95\\x1\\x75\\x3\\x91\\x3\\x95\\x6\\x75\\x8\\x15\\x0\\x25\\x65\\x5\\x7\\x19\\x0\\x29\\x65\\x81\\x0\\xc0 > functions/hid.GS0/report_desc
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > functions/hid.GS0/report_desc
ln -s functions/hid.GS0 configs/c.1

# mouse
mkdir functions/hid.GS1
# echo 1 > functions/hid.GS1/subclass
echo 1 > functions/hid.GS1/wakeup_on_write
echo 2 > functions/hid.GS1/protocol
echo -ne \\x34 > functions/hid.GS1/report_length
echo -ne \\x5\\x1\\x9\\x2\\xa1\\x1\\x9\\x1\\xa1\\x0\\x5\\x9\\x19\\x1\\x29\\x3\\x15\\x0\\x25\\x1\\x95\\x3\\x75\\x1\\x81\\x2\\x95\\x1\\x75\\x5\\x81\\x3\\x5\\x1\\x9\\x30\\x9\\x31\\x9\\x38\\x15\\x81\\x25\\x7f\\x75\\x8\\x95\\x3\\x81\\x6\\xc0\\xc0 > functions/hid.GS1/report_desc
ln -s functions/hid.GS1 configs/c.1

# touchpad
mkdir functions/hid.GS2
# echo 1 > functions/hid.GS2/subclass
echo 1 > functions/hid.GS2/wakeup_on_write
echo 2 > functions/hid.GS2/protocol
echo 6 > functions/hid.GS2/report_length
echo -ne \\x05\\x01\\x09\\x02\\xa1\\x01\\x09\\x01\\xa1\\x00\\x05\\x09\\x19\\x01\\x29\\x03\\x15\\x00\\x25\\x01\\x95\\x03\\x75\\x01\\x81\\x02\\x95\\x01\\x75\\x05\\x81\\x01\\x05\\x01\\x09\\x30\\x09\\x31\\x15\\x00\\x26\\xff\\x7f\\x35\\x00\\x46\\xff\\x7f\\x75\\x10\\x95\\x02\\x81\\x02\\x05\\x01\\x09\\x38\\x15\\x81\\x25\\x7f\\x35\\x00\\x45\\x00\\x75\\x08\\x95\\x01\\x81\\x06\\xc0\\xc0 > functions/hid.GS2/report_desc
ln -s functions/hid.GS2 configs/c.1
elif [ -e /boot/usb.GS0 ]
then
# serial
mkdir -p functions/acm.GS0
rm -rf configs/c.1/acm.GS0
ln -s functions/acm.GS0 configs/c.1/
Expand Down

0 comments on commit 2373dd2

Please sign in to comment.