#!/usr/bin/env python3 import time NULL_CHAR = chr(0) def write_report(report): with open('/dev/hidg0', 'rb+') as fd: fd.write(report.encode()) write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5) while True: for i in range(4,35): write_report(NULL_CHAR*2+chr(i)+NULL_CHAR*5) i = i+1 print(i) if i == 35: print(i) i = 4 write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5) print(i) # Release all keys write_report(NULL_CHAR*8) time.sleep(0.2)