monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
630 stars 145 forks source link

Wiimote support via bluetooth #822

Closed okyeron closed 4 years ago

okyeron commented 5 years ago

This came up in a conversation today so I started poking around and now I'm looking for a little help

RasPI 3b has Bluetooth built-in. Norns hardware could have BT with a USB dongle. I'm thinking it should be possible to get the wiimote working as a HID device.

I've got my wiimote connected to raspi-norns and I'm not sure where to go next to get HID data. Looks like some mods will be needed?

after connecting the wiimote dmesg shows me:

[   60.521044] Bluetooth: HIDP socket layer initialized
[   60.714181] wiimote 0005:057E:0306.0003: unknown main item tag 0x0
[   60.714812] wiimote 0005:057E:0306.0003: hidraw2: BLUETOOTH HID v6.00 Gamepad [Nintendo RVL-CNT-01] on b8:27:eb:63:4d:4b
[   60.714872] wiimote 0005:057E:0306.0003: New device registered
[   60.760104] wiimote 0005:057E:0306.0003: detected device: Nintendo Wii Remote (Gen 1)
[   60.760948] input: Nintendo Wii Remote Accelerometer as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:12/0005:057E:0306.0003/input/input7
[   60.761331] input: Nintendo Wii Remote IR as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:12/0005:057E:0306.0003/input/input8
[   60.761677] input: Nintendo Wii Remote as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:12/0005:057E:0306.0003/input/input6

Best I can sort out here is that the wiimote is showing up as a serial/tty device and not an input/event that norns device_monitor would see as an HID device.

Any suggestions on how I might get this to show up as HID?

do I need some kind of udev rule?

okyeron commented 5 years ago

Ok - further checking - I AM getting the wiimote to show up as /dev/input/event* devices, but now I realize that device_monitor.c is ONLY looking at the usb subsystem, so it won't work without some more hacking

Thus we would need to extend device_monitor to add the bluetooth subsystem?

komicone commented 5 years ago

Beyond the Wiimote use, supporting keyboard input via bluetooth would allow input to ORCA and any other text based scripts that get developed and fewer cables is always nice :)

okyeron commented 5 years ago

pinging to @catfact to see if there's any suggestions here.

I tried to extend device_monitor.c to look alternately look at bluetooth adding the following

else if (udev_device_get_parent_with_subsystem_devtype(dev, "bluetooth", NULL)) {
                    handle_device(dev);
                }

and again around line 250

but it pretty much crashed matron everytime and I got kinda stumped.

catfact commented 5 years ago

you can certainly try bypassing the usb test as in this PR: https://github.com/monome/norns/pull/532/files

in my view the closure of this PR was abortive; i have questions and issues with it but would be pleased to hear constructive feedback. i think it will mean we'll get a bunch of events from subsystems that we don't actually know how to work with in lua; that's OK but probably needs more work