GithubHelp home page GithubHelp logo

anesbenmerzoug / bluetooth_hid Goto Github PK

View Code? Open in Web Editor NEW
109.0 10.0 25.0 142 KB

A Raspberry Pi program that emulates a keyboard/mouse Bluetooth HID client

License: GNU General Public License v3.0

Python 97.42% Shell 2.58%
python raspberry-pi bluetooth hid keyboard-emulation mouse-emulation

bluetooth_hid's People

Contributors

anesbenmerzoug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluetooth_hid's Issues

Key Events on the primary device

Thank you AnesBenmerzoug. However a silly question. While I am able to mirror the key strokes on the bluetooth remote device, how can I suppress the keystrokes on the bluetooth server? Keystrokes intended for the remote devices are wrecking havoc on the bluetooth server.

DBus.Error.ServiceUnknown

I am getting this error:
DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.upwork.HidBluetoothService was not provided by any .service files

I do not see any .service files.

Hardware/os is:
Linux raspberrypi 4.19.93+ #1290 Fri Jan 10 16:34:37 GMT 2020 armv6l GNU/Linux

Buster (2020-Feb-20) on Pi Zero W - Failed to set privacy: Rejected (0x0b)

I loaded a fresh Buster release on a PZW. The set up seemed uneventful but when I run bluetooth_daemon_configuration.sh the bluetooth service wasn't set up, likely because of the line in the title. Full output as follows:

bluetoothd[3886]: Bluetooth daemon 5.50
bluetoothd[3886]: src/main.c:parse_config() parsing /etc/bluetooth/main.conf
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “DiscoverableTimeout” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “PairableTimeout” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “Privacy” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “Name” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “Class” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “DeviceID” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “ReverseServiceDiscovery” in group “General”
bluetoothd[3886]: src/main.c:parse_config() Key file does not have key “MinEncKeySize” in group “GATT”
bluetoothd[3886]: src/adapter.c:adapter_init() sending read version command
bluetoothd[3886]: Starting SDP server
bluetoothd[3886]: src/sdpd-service.c:register_device_id() Adding device id record for 0002:1d6b:0246:0532
bluetoothd[3886]: src/plugin.c:plugin_init() Loading builtin plugins
bluetoothd[3886]: Ignoring (cli) hostname
bluetoothd[3886]: Ignoring (cli) wiimote
bluetoothd[3886]: Ignoring (cli) autopair
bluetoothd[3886]: Ignoring (cli) policy
bluetoothd[3886]: Ignoring (cli) neard
bluetoothd[3886]: Ignoring (cli) sap
bluetoothd[3886]: Ignoring (cli) a2dp
bluetoothd[3886]: Ignoring (cli) avrcp
bluetoothd[3886]: Ignoring (cli) network
bluetoothd[3886]: Ignoring (cli) input
bluetoothd[3886]: Ignoring (cli) hog
bluetoothd[3886]: Ignoring (cli) health
bluetoothd[3886]: Ignoring (cli) gap
bluetoothd[3886]: Ignoring (cli) scanparam
bluetoothd[3886]: Ignoring (cli) deviceinfo
bluetoothd[3886]: Ignoring (cli) midi
bluetoothd[3886]: Ignoring (cli) battery
bluetoothd[3886]: src/plugin.c:plugin_init() Loading plugins /usr/lib/arm-linux-gnueabihf/bluetooth/plugins
bluetoothd[3886]: Ignoring (cli) sixaxis
bluetoothd[3886]: src/main.c:main() Entering main loop
bluetoothd[3886]: src/rfkill.c:rfkill_event() RFKILL event idx 0 type 1 op 0 soft 0 hard 0
bluetoothd[3886]: Bluetooth management interface 1.14 initialized
bluetoothd[3886]: src/adapter.c:read_version_complete() sending read supported commands command
bluetoothd[3886]: src/adapter.c:read_version_complete() sending read index list command
bluetoothd[3886]: src/rfkill.c:rfkill_event() RFKILL event idx 1 type 2 op 0 soft 0 hard 0
bluetoothd[3886]: src/adapter.c:read_commands_complete() Number of commands: 65
bluetoothd[3886]: src/adapter.c:read_commands_complete() Number of events: 35
bluetoothd[3886]: src/adapter.c:read_commands_complete() enabling kernel-side connection control
bluetoothd[3886]: src/adapter.c:read_index_list_complete() Number of controllers: 1
bluetoothd[3886]: src/adapter.c:read_index_list_complete() Found index 0
bluetoothd[3886]: src/adapter.c:index_added() index 0
bluetoothd[3886]: src/adapter.c:btd_adapter_new() System name: BlueZ 5.50
bluetoothd[3886]: src/adapter.c:btd_adapter_new() Major class: 0
bluetoothd[3886]: src/adapter.c:btd_adapter_new() Minor class: 0
bluetoothd[3886]: src/adapter.c:btd_adapter_new() Modalias: usb:v1D6Bp0246d0532
bluetoothd[3886]: src/adapter.c:btd_adapter_new() Discoverable timeout: 180 seconds
bluetoothd[3886]: src/adapter.c:btd_adapter_new() Pairable timeout: 0 seconds
bluetoothd[3886]: src/adapter.c:index_added() sending read info command for index 0
bluetoothd[3886]: src/adapter.c:read_info_complete() index 0 status 0x00
bluetoothd[3886]: src/adapter.c:clear_uuids() sending clear uuids command for index 0
bluetoothd[3886]: src/adapter.c:clear_devices() sending clear devices command for index 0
bluetoothd[3886]: src/adapter.c:set_privacy() sending set privacy command for index 0
bluetoothd[3886]: src/adapter.c:set_privacy() setting privacy mode 0x00 for index 0
bluetoothd[3886]: src/gatt-database.c:btd_gatt_database_new() GATT Manager registered for adapter: /org/bluez/hci0
bluetoothd[3886]: src/advertising.c:btd_adv_manager_new() LE Advertising Manager created for adapter: /org/bluez/hci0
bluetoothd[3886]: src/adapter.c:btd_adapter_unblock_address() hci0 00:00:00:00:00:00
bluetoothd[3886]: src/adapter.c:load_link_keys() hci0 keys 0 debug_keys 0
bluetoothd[3886]: src/adapter.c:load_ltks() hci0 keys 0
bluetoothd[3886]: src/adapter.c:load_irks() hci0 irks 0
bluetoothd[3886]: src/adapter.c:load_conn_params() hci0 conn params 0
bluetoothd[3886]: src/adapter.c:load_connections() sending get connections command for index 0
bluetoothd[3886]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
bluetoothd[3886]: src/adapter.c:add_uuid() sending add uuid command for index 0
bluetoothd[3886]: src/adapter.c:set_did() hci0 source 2 vendor 1d6b product 246 version 532
bluetoothd[3886]: src/adapter.c:adapter_register() Adapter /org/bluez/hci0 registered
bluetoothd[3886]: src/adapter.c:set_dev_class() sending set device class command for index 0
bluetoothd[3886]: src/adapter.c:set_name() sending set local name command for index 0
bluetoothd[3886]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[3886]: src/adapter.c:trigger_passive_scanning()
bluetoothd[3886]: Failed to set privacy: Rejected (0x0b)
bluetoothd[3886]: src/adapter.c:load_link_keys_complete() link keys loaded for hci0
bluetoothd[3886]: src/adapter.c:load_ltks_complete() LTKs loaded for hci0
bluetoothd[3886]: src/adapter.c:load_irks_complete() IRKs loaded for hci0
bluetoothd[3886]: src/adapter.c:load_conn_params_complete() Connection Parameters loaded for hci0
bluetoothd[3886]: src/adapter.c:get_connections_complete() Connection count: 0
[ ok ] Stopping bluetooth (via systemctl): bluetooth.service.
bluetoothd[4547]: src/agent.c:agent_ref() 0x145bca0: ref=1
bluetoothd[4547]: src/agent.c:register_agent() agent :1.10

Unable to connect to ios

Attempted to connect with an IOS device (Iphone 7 running IOS 13.4) and I get:

bluetoothd[3870]: src/adapter.c:connected_callback() hci0 device 58:40:4E:C9:E5:4C connected eir_len 5
bluetoothd[3870]: src/adapter.c:dev_disconnected() Device 58:40:4E:C9:E5:4C disconnected, reason 3
bluetoothd[3870]: src/adapter.c:adapter_remove_connection() 
bluetoothd[3870]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 58:40:4E:C9:E5:4C type 0 status 0xe
bluetoothd[3870]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[3870]: src/device.c:device_bonding_failed() status 14
bluetoothd[3870]: src/adapter.c:resume_discovery() 

Version: 7ae9636

Cnnot send mouse data

when i run "sudo python /home/pi/Bluetooth_HID/user_interface.py"
it says

pi@raspberrypi:~ $ sudo python `/home/pi/Bluetooth_HID/user_interface.py
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/init.py:57: GtkWarning: could n ot open display
warnings.warn(str(e), _gtk.Warning)
Setting up service
Setting up DBus Client
Setting up Bluetooth device
Configuring for name Bluetooth_Keyboard/Mouse
Setting up DBus Client
Waiting for keyboard
Traceback (most recent call last):
Waiting for mouse
File "/home/pi/Bluetooth_HID/user_interface.py", line 411, in
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1823, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, want objects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Found a keyboard with the keyword 'mouse'
device name is USB OPTICAL MOUSE
Mouse Found
Starting mouse event loop
Keyboard not found after 100 tries
Configuring Bluez Profile
Reading service record
Profile registered
Waiting for connections
Reading service record
ERROR:dbus.proxies:Introspect error on :1.5:/org/bluez: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
ERROR:dbus.proxies:Introspect error on :1.82:/org/upwork/HidBluetoothService: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
Couldn't send mouse input

No session for pid xxxx

"no session for pid" displays again and again after running the raspberry_pi_initial_setup.sh

WiFi HID emulator

hi , sorry to open a ticket for my question, but I have a question that may related to your field of repository and any possible hint really appreciated
Actually I interested to send game-pad data by WiFi bridge(ESP8266) to my laptop, but generic joystick only use USB port, Is there a way to emulate "HID-compliant game controller" driver which listen to IP message instead of USB port
Tnx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.