xvart post at 2022-5-25 14:35:33

HID Keyboard Joystick on orangepi zero

How to use an orange pi zero as a keyboard and joystick.

The joystick is a copy of the teensy extreme joystick 128 buttons 23 axis/sliders and 4 hats, microsoft does recognise this.

First make sure ethernet or WIFI works and you cna ssh in a user.


In /etc/modprobe.d/blacklist-orangepizero.conf add

blacklist g_serial
blacklist usb_f_acm

In /etc/modules add
libcomposite
usb_f_hid


reboot


After reboot from a user account run the following script using sudo,
#!/bin/bash

set -x

# Create gadget
mkdir /sys/kernel/config/usb_gadget/mykeyboard
cd /sys/kernel/config/usb_gadget/mykeyboard

# Add basic information
echo 0x0100 > bcdDevice # Version 1.0.0
echo 0x0200 > bcdUSB # USB 2.0
echo 0x00 > bDeviceClass
echo 0x00 > bDeviceProtocol
echo 0x00 > bDeviceSubClass
echo 0x08 > bMaxPacketSize0
echo 0x0104 > idProduct # Keyboard Joystick Composite Gadget
echo 0x1d6b > idVendor # Linux Foundation

# Create English locale
mkdir strings/0x409

echo "My manufacturer" > strings/0x409/manufacturer
echo "My keyboard joystick" > strings/0x409/product
echo "0123456789" > strings/0x409/serialnumber

# Create HID function
mkdir functions/hid.usb0
mkdir functions/hid.usb1

echo 1 > functions/hid.usb0/protocol
echo 8 > functions/hid.usb0/report_length # 8-byte reports
echo 1 > functions/hid.usb0/subclass

# Write report descriptor
echo "05010906a101050719e029e71500250175019508810275089501810175019503050819012903910275019505910175089506150026ff00050719002aff008100c0" | xxd -r -ps > functions/hid.usb0/report_desc

echo 0 > functions/hid.usb1/protocol
echo 64 > functions/hid.usb1/report_length # 64-byte reports
echo 1 > functions/hid.usb1/subclass

# Write report descriptor
echo "05010904A1011500250175019580050919012980810205010901A100150027FFFF000075109517093009310932093309340935093609360936093609360936093609360936093609360936093609360936093609368102C0150025073500463B01750495046514050109390939093909398142C0" | xxd -r -ps > functions/hid.usb1/report_desc

# Create configuration
mkdir configs/c.1
mkdir configs/c.1/strings/0x409

echo 0x80 > configs/c.1/bmAttributes
echo 200 > configs/c.1/MaxPower # 200 mA
echo "Composite configuration" > configs/c.1/strings/0x409/configuration

# Link HID function to configuration
ln -s functions/hid.usb0 configs/c.1

ln -s functions/hid.usb1 configs/c.1

# Enable gadget
ls /sys/class/udc > UDC






xvart post at 2022-5-29 14:06:50

New set of report descriptors
1. N key keyboard in 2 reports has f13-f24
2. Joystick with 64 buttons 12 axis 4 hats
3. Dual xbox style gamepads in 2 reports

#!/bin/bash

set -x

# Create gadget
mkdir /sys/kernel/config/usb_gadget/mykeyboard
cd /sys/kernel/config/usb_gadget/mykeyboard

# Add Device Descriptor information
echo 0x0100 > bcdDevice # Version 1.0.0
echo 0x0200 > bcdUSB # USB 2.0
echo 0x00 > bDeviceClass
echo 0x00 > bDeviceProtocol
echo 0x00 > bDeviceSubClass
echo 0x22 > bMaxPacketSize0
echo 0x6969 > idProduct # Keyboard Joystick Composite Gadget
echo 0x1d6b > idVendor # Linux Foundation

# Create English locale
mkdir strings/0x409

echo "Languid" > strings/0x409/manufacturer
echo "keyboard, joystick, dual gamepad"> strings/0x409/product
echo "0123456789" > strings/0x409/serialnumber

# Create configuration descriptor
mkdir configs/c.1
mkdir configs/c.1/strings/0x409

echo 0x80 > configs/c.1/bmAttributes
echo 200 > configs/c.1/MaxPower # 200 mA
echo 0 > configs/c.1/iConfiguration
echo "Composite configuration" > configs/c.1/strings/0x409/configuration

# Create HID endpoints

# Create keyboard
keyboard() {
# Create interface descriptor information
mkdir functions/hid.usb0
echo 1 > functions/hid.usb0/protocol
echo 8 > functions/hid.usb0/report_length # 8-byte reports
echo 0 > functions/hid.usb0/subclass

# Write report descriptor, keyboard 2 parts ID:1,2
echo "05010906a1018501050719e029e71425017501950881021904293b95388102c005010906a10185020507193c29651425017501952a810219672973950d810295098102c0" | xxd -r -ps > functions/hid.usb0/report_desc

ln -s functions/hid.usb0 configs/c.1
}

# Create extreme joystick
joystick() {
# Create interface descriptor information
mkdir functions/hid.usb1
echo 0 > functions/hid.usb1/protocol
echo 34 > functions/hid.usb1/report_length # 34-byte reports
echo 0 > functions/hid.usb1/subclass

# Write report descriptor, stolen from teensy forum extreme joystick
# Write 64 bytes to the following endpoint in the same order as listed
# buttons 64 so 64/8 = 8 bytes
# axis and sliders 12 for x,y,z,R(x),R(y),R(z),Slider*6 so 12*2 = 24 bytes
# hats 4 so 4*.5 = 2 bytes
echo "05010904a1010509142501750195401901294081020b01000100a01427ffff0000751095060b300001000b310001000b320001000b330001000b340001000b350001008102c00b01000100a01427ffff0000751095060b360001000b360001000b360001000b360001000b360001000b360001008102c00b01000100a014250734463b017504950465140b390001000b390001000b390001000b390001008142c0c0" | xxd -r -ps > functions/hid.usb1/report_desc

ln -s functions/hid.usb1 configs/c.1
}

# Create dual gamepad, index by "Report ID"
gamepad() {
# Create interface descriptor information
mkdir functions/hid.usb2
echo 0 > functions/hid.usb2/protocol
echo 7 > functions/hid.usb2/report_length # 7-byte report includes Report ID
echo 0 > functions/hid.usb2/subclass

# Write report descriptor, stolen from some guys tutorial on
# doing composite report ID thing, microsoft shows both devices
# Format..
# report id, need to include or it won't work
# buttons
# buttons
# X
# Y
# Z
# R(x)
echo "05010905A101A100850105091901291015002501951075018102050109300931093209331581257F750895048102C0C005010905A101A100850205091901291015002501951075018102050109300931093209331581257F750895048102C0C0" | xxd -r -ps > functions/hid.usb2/report_desc

ln -s functions/hid.usb2 configs/c.1
}

# Link HID function to configuration
keyboard
joystick
gamepad

# Enable gadget
ls /sys/class/udc > UDC

swayer post at 2022-8-27 15:08:45

tomusa post at 2023-8-3 10:29:53

To control the HID keyboard on the Orange Pi Zero, you need to use the Evdev library in Python. This library allows you to communicate The Password Game with HID devices such as keyboards, mice, and other input devices.

lorde post at 2023-8-7 11:23:28

This post was finally edited by lorde at 2023-8-7 11:24

Make sure that Ethernet melon playground or Wi-Fi is working, and you can SSH into the Orange Pi Zero as a user.

celinedion post at 2023-8-7 11:45:49

It's important to mention that this process involves making low-level changes to the kernel modules and can potentially affect the functionality of your Orange Pi. Additionally, mapquest directions using the Orange Pi Zero as both a keyboard and a joystick involves dealing with USB HID (Human Interface Device) emulation, which might require some programming or scripting knowledge to create the appropriate configuration.

otis post at 2023-8-8 09:46:19

The script sets up slope game the necessary kernel configuration for the USB gadget. It creates a new gadget folder under /sys/kernel/config/usb_gadget and populates it with configuration files.

emmausa post at 2023-8-15 15:15:11

I have learned many new and interesting things The Password Game from reading your post and hope you will post more interesting information in the near future.

emmaorabelle post at 2023-9-12 12:28:23

It's crucial to note that this method involves making low-level modifications to the kernel modules, which may have an impact on how well your Orange Pi functions. Additionally, using the Orange Pi Zero as a keyboard and joystick requires dealing with USB HID (Human Interface Device) emulation, which may need for some programming or scripting expertise to generate the proper configuration. io games

daviddavid post at 2023-9-18 16:55:04


Splunk SPLK-1002 Exam Dumps are a valuable resource for individuals preparing to take the SPLK-1002 exam, which is a part of the Splunk Core Certified Power User certification track. These exam dumps consist of a collection of practice questions and answers designed to help candidates assess their knowledge and readiness for the actual exam.

Key features of Splunk SPLK-1002 Exam Dumps:

Comprehensive Coverage: The dumps cover all the essential topics and objectives of the SPLK-1002 exam, ensuring candidates are well-prepared for the test.

Realistic Exam Simulation: The questions in these dumps are crafted to mimic the format and difficulty level of the actual exam, allowing candidates to get a feel for the test environment.

Answer Explanations: Each question is accompanied by detailed explanations, helping candidates understand why a particular answer is correct or incorrect.

Self-Assessment: Candidates can use these dumps to gauge their strengths and weaknesses, enabling them to focus their study efforts more effectively.

Confidence Boost: Practicing with these exam dumps can boost a candidate's confidence and reduce test anxiety, increasing the likelihood of passing the SPLK-1002 exam.

It's important to note that while exam dumps can be a useful study aid, they should not be the sole source of preparation. Candidates should also refer to official Splunk study materials, documentation, and hands-on experience to ensure a well-rounded understanding of Splunk Core concepts. Additionally, candidates should aim to take the exam with integrity and follow ethical guidelines set by the certification authority.
page: [1] 2
View full version: HID Keyboard Joystick on orangepi zero