Giter Club home page Giter Club logo

emulate-bluetooth-hid's Introduction

emulate-bluetooth-hid

Install Bluetooth

This step is the same process as for Step 03 of the original article.

sudo apt-get install -y python-gobject bluez bluez-tools python-bluez python-dev python-pip python-gtk2

sudo pip2 install evdev

Bluetooth Daemon Configuration

This is where things start to diverge. Bluez 5 uses a different mechanism than Bluez 4 to configure plug-ins and SDP profiles. It is no longer possible to disable plug-ins using /etc/bluetooth/main.conf

Instead, I found that the easiest thing to do was to kill the bluetooth daemon and run it in the foreground

  • Stop the background process

sudo /etc/init.d/bluetooth stop

  • Open a dedicated terminal and tun the bluetooth daemon in the foreground

sudo /usr/sbin/bluetoothd --nodetach --debug -p time

Note: This will disable all bluetooth plug-ins except the time plug-in. I found this the easiest way to ensure that plug-ins were not interfering with the keyboard emulator. An improvement would be to identify and disable only the plug-ins that would conflict with the emulator code.

Configure DBUS

My reworked version of the keyboard emulator sets itself up as a DBUS system bus server. This allows client applications to use DBUS to send keystrokes to the emulator and allows the simple creation of multiple different types of clients.

For this to work, the DBUS system bus needs to be configured to add the btkserver API. This is enabled by copying a configuration file into the /etc/dbus-1/system.d folder

sudo cp dbus/org.yaptb.btkbservice.conf /etc/dbus-1/system.d

Build hidclient

sudo apt-get install libbluetooth-dev libdbus-1-dev

sudo apt install dbus-cpp-dev-examples

sudo apt install libglib2.0-dev libudev-dev

How to test it

hcitool scan  # to get the MAC address of your device
bluetoothctl
agent on
scan on  # wait for your device's address to show up here
scan off
trust MAC_ADDRESS
pair MAC_ADDRRESS
connect MAC_ADDRESS

emulate-bluetooth-hid's People

Contributors

lanshenghai avatar

Watchers

James Cloos avatar  avatar

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.