Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/python2
import sys
import os.path
import imp
import usb.core
import usb.util
from time import sleep
dev = None
intf = None
def attachKeyboard():
global dev
global intf
dev = usb.core.find(idVendor=0x046d, idProduct=0xc33f)
if dev is None:
print 'Device not found, exiting...'
sys.exit()
intf = 1
if dev.is_kernel_driver_active(intf) is True:
dev.detach_kernel_driver(intf)
usb.util.claim_interface(dev, intf)
def detachKeyboard():
global dev
global intf
if intf is not None:
usb.util.release_interface(dev, intf)
dev.attach_kernel_driver(intf)
dev = None
intf = None
def send(data):
print data
data = [ int(''.join([data[i], data[i+1]]), base=16) for i in range(0, len(data), 2)]
dev.ctrl_transfer(0x21,0x09,0x0211,1,data)
sleep(0.02)
def main():
attachKeyboard()
send('11ff001a00003900000000000000000000000000')
send('11ff000a00030000000000000000000000000000')
send('11ff020a00000000000000000000000000000000')
send('11ff021a00000000000000000000000000000000')
send('11ff021a01000000000000000000000000000000')
send('11ff000a1f200000000000000000000000000000')
send('11ff000a00200000000000000000000000000000')
send('11ff041a00000000000000000000000000000000')
send('11ff000a45400000000000000000000000000000')
send('11ff090a00000000000000000000000000000000')
send('11ff000a10000000000000000000000000000000')
send('11ff000a10010000000000000000000000000000')
send('11ff000a81000000000000000000000000000000')
send('11ff000a13000000000000000000000000000000')
send('11ff000a80400000000000000000000000000000')
send('11ff0d0a00000000000000000000000000000000')
send('11ff000a80710000000000000000000000000000')
send('11ff0f0affff0000000000000000000000000000')
send('11ff0f0a00ff0000000000000000000000000000')
send('11ff0f0a00000000000000000000000000000000')
send('11ff0f0a00010000000000000000000000000000')
send('11ff0f0a00020000000000000000000000000000')
send('11ff0f0a00030000000000000000000000000000')
send('11ff0f0a01ff0000000000000000000000000000')
send('11ff0f0a01000000000000000000000000000000')
send('11ff0f0a01010000000000000000000000000000')
send('11ff0f0a01020000000000000000000000000000')
send('11ff0f0a01030000000000000000000000000000')
send('11ff0f0a01040000000000000000000000000000')
send('11ff0f0a01050000000000000000000000000000')
send('11ff0f0a01060000000000000000000000000000')
send('11ff000a80710000000000000000000000000000')
send('11ff000a80700000000000000000000000000000')
send('11ff0f0affff0000000000000000000000000000')
send('11ff0f0a00ff0000000000000000000000000000')
send('11ff0f0a00000000000000000000000000000000')
send('11ff0f0a00010000000000000000000000000000')
send('11ff0f0a00020000000000000000000000000000')
send('11ff0f0a00030000000000000000000000000000')
send('11ff0f0a01ff0000000000000000000000000000')
send('11ff0f0a01000000000000000000000000000000')
send('11ff0f0a01010000000000000000000000000000')
send('11ff0f0a01020000000000000000000000000000')
send('11ff0f0a01030000000000000000000000000000')
send('11ff0f0a01040000000000000000000000000000')
send('11ff0f0a01050000000000000000000000000000')
send('11ff0f0a01060000000000000000000000000000')
send('11ff0f7a00000000000000000000000000000000')
send('11ff000a80810000000000000000000000000000')
send('11ff000a80800000000000000000000000000000')
send('11ff100a00000000000000000000000000000000')
send('11ff100a00010000000000000000000000000000')
send('11ff100a00020000000000000000000000000000')
send('11ff000a18150000000000000000000000000000')
send('11ff000a80100000000000000000000000000000')
send('11ff0a0a00000000000000000000000000000000')
send('11ff000a81100000000000000000000000000000')
send('11ff000a80200000000000000000000000000000')
send('11ff000a80300000000000000000000000000000')
send('11ff000a45220000000000000000000000000000')
send('11ff000a80600000000000000000000000000000')
send('11ff000a40a20000000000000000000000000000')
send('11ff000a24000000000000000000000000000000')
send('11ff000a22400000000000000000000000000000')
send('11ff000a00c10000000000000000000000000000')
send('11ff000a00c20000000000000000000000000000')
send('11ff000a81200000000000000000000000000000')
send('11ff000a81230000000000000000000000000000')
send('11ff000a80a30000000000000000000000000000')
send('11ff000a80d00000000000000000000000000000')
send('11ff000a807a0000000000000000000000000000')
send('11ff110a00000000000000000000000000000000')
send('11ff115a00000000000000000000000000000000')
send('11ff114a00000000000000000000000000000000')
send('11ff115a01010000000000000000000000000000')
send('11ff115a01010010000000000000000000000000')
send('11ff115a01010020000000000000000000000000')
send('11ff115a01010030000000000000000000000000')
send('11ff115a01010040000000000000000000000000')
send('11ff115a01010050000000000000000000000000')
send('11ff115a01010060000000000000000000000000')
send('11ff115a01010070000000000000000000000000')
send('11ff115a01010080000000000000000000000000')
send('11ff115a01010090000000000000000000000000')
send('11ff115a010100a0000000000000000000000000')
send('11ff115a010100b0000000000000000000000000')
send('11ff115a010100c0000000000000000000000000')
send('11ff115a010100d0000000000000000000000000')
send('11ff115a010100e0000000000000000000000000')
send('11ff115a010100f0000000000000000000000000')
send('11ff115a00010000000000000000000000000000')
send('11ff115a00010010000000000000000000000000')
send('11ff115a00010020000000000000000000000000')
send('11ff115a00010030000000000000000000000000')
send('11ff115a00010040000000000000000000000000')
send('11ff115a00010050000000000000000000000000')
send('11ff115a00010060000000000000000000000000')
send('11ff115a00010070000000000000000000000000')
send('11ff115a00010080000000000000000000000000')
send('11ff115a00010090000000000000000000000000')
send('11ff115a000100a0000000000000000000000000')
send('11ff115a000100b0000000000000000000000000')
send('11ff115a000100c0000000000000000000000000')
send('11ff115a000100d0000000000000000000000000')
send('11ff115a000100e0000000000000000000000000')
send('11ff115a000100f0000000000000000000000000')
send('11ff115a01020000000000000000000000000000')
send('11ff115a01020010000000000000000000000000')
send('11ff115a01020020000000000000000000000000')
send('11ff115a01020030000000000000000000000000')
send('11ff115a01020040000000000000000000000000')
send('11ff115a01020050000000000000000000000000')
send('11ff115a01020060000000000000000000000000')
send('11ff115a01020070000000000000000000000000')
send('11ff115a01020080000000000000000000000000')
send('11ff115a01020090000000000000000000000000')
send('11ff115a010200a0000000000000000000000000')
send('11ff115a010200b0000000000000000000000000')
send('11ff115a010200c0000000000000000000000000')
send('11ff115a010200d0000000000000000000000000')
send('11ff115a010200e0000000000000000000000000')
send('11ff115a010200f0000000000000000000000000')
send('11ff115a00020000000000000000000000000000')
send('11ff115a00020010000000000000000000000000')
send('11ff115a00020020000000000000000000000000')
send('11ff115a00020030000000000000000000000000')
send('11ff115a00020040000000000000000000000000')
send('11ff115a00020050000000000000000000000000')
send('11ff115a00020060000000000000000000000000')
send('11ff115a00020070000000000000000000000000')
send('11ff115a00020080000000000000000000000000')
send('11ff115a00020090000000000000000000000000')
send('11ff115a000200a0000000000000000000000000')
send('11ff115a000200b0000000000000000000000000')
send('11ff115a000200c0000000000000000000000000')
send('11ff115a000200d0000000000000000000000000')
send('11ff115a000200e0000000000000000000000000')
send('11ff115a000200f0000000000000000000000000')
send('11ff115a01030000000000000000000000000000')
send('11ff115a01030010000000000000000000000000')
send('11ff115a01030020000000000000000000000000')
send('11ff115a01030030000000000000000000000000')
send('11ff115a01030040000000000000000000000000')
send('11ff115a01030050000000000000000000000000')
send('11ff115a01030060000000000000000000000000')
send('11ff115a01030070000000000000000000000000')
send('11ff115a01030080000000000000000000000000')
send('11ff115a01030090000000000000000000000000')
send('11ff115a010300a0000000000000000000000000')
send('11ff115a010300b0000000000000000000000000')
send('11ff115a010300c0000000000000000000000000')
send('11ff115a010300d0000000000000000000000000')
send('11ff115a010300e0000000000000000000000000')
send('11ff115a010300f0000000000000000000000000')
send('11ff115a00030000000000000000000000000000')
send('11ff115a00030010000000000000000000000000')
send('11ff115a00030020000000000000000000000000')
send('11ff115a00030030000000000000000000000000')
send('11ff115a00030040000000000000000000000000')
send('11ff115a00030050000000000000000000000000')
send('11ff115a00030060000000000000000000000000')
send('11ff115a00030070000000000000000000000000')
send('11ff115a00030080000000000000000000000000')
send('11ff115a00030090000000000000000000000000')
send('11ff115a000300a0000000000000000000000000')
send('11ff115a000300b0000000000000000000000000')
send('11ff115a000300c0000000000000000000000000')
send('11ff115a000300d0000000000000000000000000')
send('11ff115a000300e0000000000000000000000000')
send('11ff115a000300f0000000000000000000000000')
send('11ff11ba00000000000000000000000000000000')
send('11ff111a02000000000000000000000000000000')
send('11ff111a02000000000000000000000000000000')
send('11ff0a2a01000000000000000000000000000000')
send('11ff0b1a01000000000000000000000000000000')
send('11ff0c0a00000000000000000000000000000000')
send('11ff0f5a00000000000000000000000000000000')
send('11ff0f5a01030700000000000000000000000000')
send('11ff0f7a01000000000000000000000000000000')
send('11ff0f8a01010000000000000000000000000000')
send('11ff0f5a01030300000000000000000000000000')
send('11ff0f5a01030500000000000000000000000000')
send('11ff000a00050000000000000000000000000000')
send('11ff032a00000000000000000000000000000000')
send('11ff000a83100000000000000000000000000000')
send('11ff000a83600000000000000000000000000000')
send('11ff083a00000000000000000000000000000000')
send('11ff0f1a01000000000000000000000001000000')
send('11ff0f1a00000000000000000000000001000000')
send('11ff081a00000000000000000000000000000000')
detachKeyboard()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment