Skip to content

Instantly share code, notes, and snippets.

@omiq omiq/
Created Jul 20, 2018

What would you like to do?
Raspberry Pi USB keyboard emulator
import time
import RPi.GPIO as GPIO
# We are going to use the BCM numbering
# Set pin 26 as input using pull up resistor
GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# function to send the data
def write_report(report):
with open('/dev/hidg0', 'rb+') as fd:
# infinite loop to check the pins and send data
while True:
if not(GPIO.input(26)):
# shift-cmd-5
shift_cmd_5 = str(0b01010000) + "\0\x22\0\0\0\0\0"

This comment has been minimized.

Copy link

commented Aug 8, 2018

Anyone know what the scancode sequence is for ctrl+alt+del?
I tried modifier 0b10100000 (160\x0\x4c\x0\x0\x0\x0\x0) but that didn't work.


This comment has been minimized.

Copy link

commented Aug 9, 2018

NM figured it out. The LSB is on the right so the modifier would be 5
ctrl+alt+del == "5\x0\x4c\x0\x0\x0\x0\x0"

echo -ne "5\x0\x4c\x0\x0\x0\x0\x0" > /dev/hidg0 ;echo -ne "\x0\x0\x0\x0\x0\x0\x0\x0" > /dev/hidg0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.