Hi! I love my NORNS+GRID, and I’m now ready to start digging into the code of it, for a bit … so while I wait for the repos to clone I thought I’d just ask: the first thing I’d like to do is add Powermate support.
Is there some accepted practice for how to poke events into NORNS, such that they can be used akin to other knobs … I’m guessing this is going to be ‘as easy as adding a udev rule’, but maybe … there’s a better way to do this?
I’m curious too. I can read rotations and presses with @ngwese’s code above, but I couldn’t figure out how to send info to the device to pulse the led or change the brightness.
The norn docs for hid.connect say “create device, returns object with handler and send” – but there isn’t a send function?
I found a python library with relevant info on what to send to the PowerMate, but I’m at a loss on how to send it. Digging around ~/norns/lua/core/hid.lua didn’t make me any wiser, though I see that hid_events.lua has the same hid names as the python code, which was encouraging.
the HID code may have to be extended to add a write()/send() function. Likely this will have to take place in matron at the c level (see hid_device.c) as well as hid.lua. Looks like we make use of libevdev for the hid handling, perhaps one of these functions mentioned in the API docs could work. If not, something could probably be hacked together with a norns mod and linux HIDRAW access which has a write function. You’d have to look up the correct bytes to send to the powermate to change the LED though.
I’ve been chipping away at a matron implementation for HID output and feature reports, primarily in order to support the Elgato Streamdeck. I didn’t realize the PowerMate also required them, that’s likely a much easier support milestone than the more complex Streamdeck! I’ll see if what I have already is sufficient to get one working.
Progress report: The good news is that after plugging in an original USB PowerMate, I get HID events for press/release/turn out-of-the-box with latest norns, using hid-events.lua from okyeron’s hid-demo as a testbed.
Unfortunately, I’m not getting any LED feedback, either using my norns HID output modifications, or pypowermate from norns, or node-powermate on Windows. It could be that my device’s LED is just dead. I am not having a lot of luck finding a trustable copy of any version of the official PowerMate software, let alone one that works with modern macOS or Windows 10.
Has anyone been able to use pypowermate to control the LED behavior, either from norns or another Linux computer? I wonder if some udev rules changes are necessary to make it writeable.
I was never able to get LED control working back when I was initially experimenting. I can’t recall if I experimented with udev rules at all. I could imagine if the powermate presented multiple USB endpoint, say a generic read only HID endpoint and another custom R/W endpoint that the custom endpoint would need udev rules added. Regardless it has been so long since I poked at powermate support that I can’t remember any of the details.