Giter VIP home page Giter VIP logo

go-hidproxy's Introduction

go-hidproxy

Proxies Bluetooth keyboards and mouse as HID devices (eg. with Raspberry Zero Pi W)

Build

Requires libudev-dev package (sudo apt install libudev-dev).

Build with Go 1.20+:

go install github.com/rosmo/go-hidproxy/cmd/go-hidproxy@latest
sudo cp ~/go/bin/go-hidproxy /usr/bin/go-hidproxy

Or even with a more complete example:

wget https://go.dev/dl/go1.22.2.linux-arm64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.2.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
sudo apt-get install -y libudev-dev
go install github.com/rosmo/go-hidproxy/cmd/go-hidproxy@latest
sudo cp ~/go/bin/go-hidproxy /usr/bin/go-hidproxy
sudo go-hidproxy

Install

  • Build the binary
  • Copy binary to /usr/sbin/go-hidproxy
  • Install systemd unit file to /etc/systemd/system
  • Reload daemons: sudo systemctl daemon-reload
  • Enable hidproxy: sudo systemctl enable hidproxy
  • (Optionally) Start hidproxy: sudo systemctl start hidproxy

Raspberry Pi Zero W setup

I used a pretty standard Raspbian image:

Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

You'll need to setup /boot/config.txt with:

dtoverlay=dwc2

In /etc/modules you should have:

dwc2
libcomposite
evdev

Pair Bluetooth keyboard/mouse

One time pairing:

# sudo bluetoothctl
> discoverable on
> pairable on
> agent NoInputNoOutput
> default-agent
> scan on
> pair aa:bb:cc:dd:ee:ff
> connect aa:bb:cc:dd:ee:ff
> trust aa:bb:cc:dd:ee:ff

Tested with

  • TEX Shinobi keyboard / Trackpoint combo
  • Razer Deathadder V2 Pro
  • Microsoft Designer Compact Keyboard

go-hidproxy's People

Contributors

rosmo avatar beledouxdenis avatar

Stargazers

Alexander Baran avatar  avatar  avatar ESASHIKA Kaoru avatar  avatar  avatar  avatar AStar avatar  avatar Brian Hawkins avatar ekis avatar Burhan Del Rey avatar Pujun Lun avatar Robert Wetzler avatar  avatar star liu avatar Janne Pakarinen avatar  avatar Rain Doggerel avatar Gábor Nagymajtényi avatar  avatar Max Ignatiev avatar  avatar  avatar Timo avatar Wagner Gerald avatar  avatar ltto avatar  avatar  avatar Alex Kabakaev avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar

go-hidproxy's Issues

Build on raspberry pi zero 2 w and go 1.11

Hello,

I currently try to build the project with the recommended go version.

I get the following error:
go/src/github.com/jochenvg/go-udev/monitor.go:18:2: found packages unix (affinity_linux.go) and main (mkasm.go) in /home/thomas/go/src/golang.org/x/sys/unix

Thank you!

Media keys not being passed through, at least to Windows hosts.

Hi,

I note that, though the media keys are mapped in main.go, and though I mapped a few more of them, none are passed through to the host or have any effect on the host when the host is either Windows 7 or 10 at least. I have the mapping as:

113: 127, // Mute
114: 129, // VolDn
115: 128, // VolUp
164: 232, // PlayPause
165: 234, // PreviousTrack
163: 233, // NextTrack

and that mapping, combining my own mapping and that which was already there, seems to correspond to the USB HID specification and the keys received from the Bluetooth board. However, I can hit these keys as much as I like but nothing happens on the host. I have tried several keyboard code display programs but they don't even seem to see the multimedia keys. I understand, from the research, that this may require some sort of separate descriptor to pass multimedia keys to Windows? I'm a bit lost on this so put it forward very tentatively. Any ideas would be very greatly appreciated. All the keys on my board, including my braille keyboard, seem to work except for these. The excellence of this code for unique boards can't be overestimated.

Thanks,

Mouse is jerky in vertical direction

Mouse (trackpad) seems to smoothly track left and right however it doesn't move vertically except for the occasional large jump, any only then when I move the cursor perfectly vertically.

I am using the Logitech Harmony Smart Keyboard (Bluetooth versions of the K400) on an Xbox One X. The mouse cursor works find when pair with other devices and wired mice work fine with the Xbox.

P.S. Thank you for building this!

\ instead of ~

Hello.

First of all, thank you for this awesome project. I have been using it for a month now and it works awesome. There is one issue though, it sends \ sign instead of ~. Could you take a look at this? I think the mapping

41: 50, // //

should be changed to:

41: 53, // //

Pairing a second bluetooth device

Hello,

Let me first thank you for an amazingly useful program. I am using it to type on a keyboard which I was about to throw away because it wouldn't properly connect to an old machine. Now that I can make the keyboard look like a HID device, things are working perfectly. I should also say that the low latency is really appreciated. I have two questions, the first being in this issue and the second in a later one. I wish to pair a second device with the Pi0 and have that second device proxied. Is this possible, or is only one device usable? If a second device is usable, can I reboot the Pi0, connect it to an ethernet cable, SSH into it, and pair the second device? That is, now that the proxy starts whenever the machine boots, can I still use a USB ethernet adapter on the HID port, or will it no longer work because the proxy is expecting to see a USB host on the HID port?

Thanks again,

Certain keys not being passed through

Hello,

I am using a fairly old keyboard and some special keys are not working. Is there a way to add the scancodes for more keys to the program? For example, the media keys are not passed through to the host, though they do exist on the keyboard. I assume, though I may be wrong, that this is because the input doesn't know about these keys and isn't sure what to do with them. The delete key is also not passed through, for some reason. Is there a way to get these keys passed to the USB HID device?

Thanks,

Not able to build too many errors

Hi,

just came across this project and followed the instructions but am not able to build with go as its returning too many errors like undefined unsafe slice or syntax error etc. I am using a pi zero w with raspian lite buster as per your setup including the suggest go version. Could you please advise what i am doing wrong.
Thanks

Use Status LEDs for CapsLock and NumLock

Hello,

I am trying to add, that the Status LEDs of the keyboard will be switched on/off accordingly. Do you have an idea what is wrong in this example:

binary.Write(dev.File, binary.LittleEndian, input_event(evdev.EV_LED, evdev.LED_CAPSL, 1))

Thank you!

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.