Expanding “not_afk” with a watcher?

So the use case I have isn’t EXACTLY personal productivity, but it’s not spying either… I work in a school and we’d like to get data on whether a teacher uses the touch interface (like a SMART/Promethean board) or the mouse on the connected PC. This will help us decide whether it makes sense to keep paying for the touch when upgrading/replacing.
So the afk data is helpful for just whether or not it’s being used at all, but would be really helpful if it included the device that was being used. This would also contribute to users who wanted to track time spent on video game controllers, etc.
I was looking at the PyUSB project as a potential module to utilize, but was wondering if you had any tips for how to hook in.

Hm, after some googling that seems harder than I thought to get the device which generated the mouse event.

We are using PyUserInput for keyboard and mouse activity, doesn’t seem like it has data about which device generated the event for any platform. I also checked the Linux X11 spec and it doesn’t seem to have support for that either.

What did work however on Linux is to read straight from the kernel at /dev/input where I could find a character device which was my touchscreen on my laptop, reading that could be used to know when that input device generates events. But as long as there’s no easy way to do that cross-platform that’s out of scope for ActivityWatch unfortunately.

I thought about it and I think it would be possible (at least for my purposes) to detect touch vs. mouse just by whether or not the cursor is moving. On touch, the cursor would never really move without a “button” being pressed.
I got a little ways and submitted a PR: https://github.com/ActivityWatch/aw-watcher-afk/pull/37
You probably don’t actually want to merge it, but I was hoping for a little guidance if you’ve got a moment to spare to help me get it to that last step…