![]() Self.sock_control = BluetoothSocket(L2CAP) # Create the control and interrupt sockets, and bind and listen Logging.basicConfig(filename=Hid.LOG_FILE, format=Hid.LOG_FORMAT, level=Hid.LOG_LEVEL) # This code is based on and inspired by PiTooth, by Liam Fraser RPIO.add_interrupt_callback( 25, gpio_callback, edge='rising') RPIO.add_interrupt_callback( 24, gpio_callback, edge='rising') RPIO.add_interrupt_callback( 23, gpio_callback, edge='rising') RPIO.add_interrupt_callback( 17, gpio_callback, edge='rising') RPIO.add_interrupt_callback( 11, gpio_callback, edge='rising') RPIO.add_interrupt_callback( 8, gpio_callback, edge='rising') Sock=bluetooth.BluetoothSocket( bluetooth.L2CAP ) Os.system("hciconfig hci0 name Pinball\ Controller")īd_addr = "00:0C:55:10:75:B3" # MAC of PC-BLuetooth-Dongle Os.system("hciconfig hci0 class 0x002540") I'd be especially interested to know what the Win7 box will do when sent an HID code 249 (=KEY_COFFEE) ![]() Return -1 # Return an invalid array element # Map modifier keys to array element in the bit array # Ported to a Python module by Liam Fraser. # is reverse of what's actually hardcoded in the kernel. Some other time maybe.Ĭode: Select all # Convert value returned from Linux event device ("evdev") to a HID code. Only thing I would hate now is that Win7 acts like "lol, whut?" once it receives the bluetooth signals and DO NOTHING! But we I will see.īy the way: Optionally, I could let the Pi pretend it's a joypad, but afaik the Pinball Arcade videogame supports the Xbox360 controller only, with its LB, RB, LT, RT shoulder buttons. The only keycodes I will need to send now are LEFT SHIFT, RIGHT SHIFT, RIGHT CTRL, A, W and D. So far, so good, I have to find out what to use as an argument in the send() method of the Socket obejct ( nd('idunnowhat') ).some keycodes.hex-stuff maybe? 0x01337? ![]() Thanks to L2CAP, my current python script can contact the Win7-dongle, pretending it's a keyboard. USB-Bluetooth dongles are plugged in my Windows 7 PC and my RPi. It is the first time I am dealing with bluetooth, been about time. So yeah, for now I have 6 Buttons (3 more coming soon), plugged onto the breadboard which is connected to the Pi. I could get me an Arduino or an I-PAC2 or just a simple keyboard cuircuit board, but the only way for me to learn how the Pi works is to stick at it. if YES, what packages/libraries do I need finish my plan? Is it possible to send these "keyboard-codes" provided by uinput through the USB cable that powers by RPi and let Windows receive them? Is it possible to let Windows "think" it's a keyboard? Like that bubble that pops up each time an USB device is connected on bottom right of Windows? This one is connected to my RPi via T-Cobbler. The Arcade-Buttons I want to use are connected to a breadboard. My RPi is powered by my Windows-PC through the micro-USB-Port. According to "top" it's running in background. So far, so good, rc.local has the line that starts the script after the device booted. With uinput I use the emit_click function to "generate" pushed keys. Raspbian is installed on my RPi, I wrote a python script that includes the uinput library. All it had to do is sending Left-Shift, Right-Shift, Left-Ctrl, Right-Ctrl and A-S-D-F-codes to Windows. I want to plug the RPi in via USB and let Windows 7 know it's a keyboard. I like playing Pinball Arcade and Pinball FX2, that's why I decided - as a pinball fan - to build my own Pinball USB Controller.
0 Comments
Leave a Reply. |