gobt

package module
v0.0.0-...-5f91306 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2016 License: MIT Imports: 8 Imported by: 0

README

GoBT

What's this?

This program will convert your locally connected keyboard/mouse input to Bluetooth HID input device.

Requirements

  • Linux
    • Tested with Raspbian Jessie
    • (Raspberry Pi 3 for transmitter; Raspberry Pi 2 or macOS Sierra(MacBook Air 2012 13") for receiver)
  • BlueZ 5.23+
    • DBus
    • Systemd

Required Modules

Preparation

--noplugin=input option for the bluetoothd is required in order to make this program work.

For example:

On Raspbian Jessie:

Target file: /lib/systemd/system/bluetooth.service

[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)

[Service]
Type=dbus
BusName=org.bluez
########
## Original Entry
# ExecStart=/usr/lib/bluetooth/bluetoothd
########
## Modified Entry
ExecStart=/usr/lib/bluetooth/bluetoothd -C --noplugin=input
########
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1

[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service

(-C is for some 'older' tools; like sdptools)

Pairing

Use bluetoothctl to accept connection and authorize pairing.

$ sudo bluetoothctl
[bluetooth]# discoverable on
[bluetooth]# pairable on
[bluetooth]# agent on
[bluetooth]# default-agent

Usage

sudo ./gobt

(need to execute with root/admin privilege)

After running gobt on transmission side, let the receiver to pair.

In order to stop program, send an interrupt signal from remote or secondary shell.

Credits

License

MIT License; See LICENSE for detail

Author

Tatsuya Kobayashi pikopiko28@gmail.com

Documentation

Index

Constants

View Source
const (
	HIDPHEADERTRANSMASK = 0xf0

	HIDPTRANSHANDSHAKE   = 0x00
	HIDPTRANSSETPROTOCOL = 0x60
	HIDPTRANSDATA        = 0xa0

	HIDPHSHKSUCCESSFUL = 0x00
	HIDPHSHKERRUNKNOWN = 0x0e
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoBt

type GoBt struct {
	// contains filtered or unexported fields
}

func NewGoBt

func NewGoBt(sintr, sctrl *bluetooth.Bluetooth) *GoBt

func (*GoBt) Close

func (gb *GoBt) Close()

type GoBtPollState

type GoBtPollState byte
const (
	STOP GoBtPollState = iota
)

type HidProfile

type HidProfile struct {
	// contains filtered or unexported fields
}

func NewHidProfile

func NewHidProfile(path string, connIntr *bluetooth.Bluetooth) *HidProfile

func (*HidProfile) Close

func (p *HidProfile) Close()

func (*HidProfile) NewConnection

func (p *HidProfile) NewConnection(dev dbus.ObjectPath, fd dbus.UnixFD, fdProps map[string]dbus.Variant) *dbus.Error

func (*HidProfile) Path

func (p *HidProfile) Path() dbus.ObjectPath

func (*HidProfile) Release

func (p *HidProfile) Release() *dbus.Error

func (*HidProfile) RequestDisconnection

func (p *HidProfile) RequestDisconnection(dev dbus.ObjectPath) *dbus.Error

Directories

Path Synopsis
cmd
gobt command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL