Advertisement
metalx1000

Simple RAW Keyboard/HID device decoder

Jul 21st, 2018
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. #Created By Kris Occhipinti
  4. #July 21st 2018
  5. #License GPLv3
  6. #https://www.gnu.org/licenses/gpl-3.0.txt
  7. #takes raw HID input and outputs chars
  8. #example with USB RFID reader by Sycreader
  9.  
  10. import string
  11.  
  12. from evdev import InputDevice
  13. from select import select
  14.  
  15. keys = " ^1234567890....qwertzuiop....asdfghjkl....yxcvbnm......................."
  16. dev = InputDevice('/dev/input/by-id/usb-Sycreader_RFID_Technology_Co.__Ltd_SYC_ID_IC_USB_Reader_08FF20140315-event-kbd')
  17. code = ""
  18.  
  19. while True:
  20.    r,w,x = select([dev], [], [])
  21.    for event in dev.read():
  22.        if event.type==1 and event.value==1:
  23.            if event.code == 28:
  24.              print code
  25.              code = ""
  26.            else:
  27.               code += keys[ event.code ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement