xwiimote / xwiimote-bindings

Language bindings for the xwiimote package
Other
24 stars 10 forks source link

Go bindings #1

Closed mzimmerman closed 9 years ago

mzimmerman commented 9 years ago

Any bindings exist for Go already? :) Would certainly make my use case easier. I'd like to upgrade my code from using cwiid.

https://github.com/mzimmerman/mythgowii

nadenislamarre commented 9 years ago

The bindings exists for python and perl. However, the binding is done using swig (http://www.swig.org/). Swig manages several binding including the go language. So, it means that 99% of the work is done.

If you check https://github.com/dvdhrm/xwiimote-bindings, you'll see that custom lines for perl and python is about 10 lines each.

Nicolas Adenis-Lamarre

2015-01-17 2:21 GMT+01:00 Matthew Zimmerman notifications@github.com:

Any bindings exist for Go already? :) Would certainly make my use case easier. I'd like to upgrade my code from using cwiid.

https://github.com/mzimmerman/mythgowii

— Reply to this email directly or view it on GitHub https://github.com/dvdhrm/xwiimote-bindings/issues/1.

mzimmerman commented 9 years ago

Awesome, thanks for the response.

I've found an easier/more native way though even. Using a short bash script and an xorg module with custom key configs. Now I just have to figure out how to do the power conservation part... (turn off the wiimote when no key presses have occurred in X time.)

The following script lets me use bluetoothctl to automagically connect the wiimote whenever it's initiated (after successful manual pairing) Citation

#!/bin/sh

while true
do
        echo "looping"
        echo -e "power on\nconnect 00:1E:35:6E:8D:41\nquit" | bluetoothctl
        sleep 3
done
        Option "MapLeft" "KEY_LEFT"
        Option "MapRight" "KEY_RIGHT"
        Option "MapDown" "KEY_DOWN"
        Option "MapUp" "KEY_UP"
        Option "MapA" "KEY_ENTER"
        Option "MapB" "KEY_Z"
        Option "MapPlus" "KEY_P"
        Option "MapMinus" "KEY_DEL"
        Option "MapHome" "KEY_ESC"
        Option "MapOne" "KEY_I"
        Option "MapTwo" "KEY_M"