touchpad-handwriting icon indicating copy to clipboard operation
touchpad-handwriting copied to clipboard

Capture Windows Precision Touchpad raw input

Open ichisadashioko opened this issue 3 years ago • 9 comments

Hi. I was able to capture Windows Precision Touchpad raw input here. Please checkout it out if you have any time.

ichisadashioko avatar Sep 21 '20 13:09 ichisadashioko

Thanks for the info. I had also seen another project that tapped into the PTP HID events (don't remember the name), but I have not had the time to actually study it. Your project seems simpler (in a good way, though it currently lacks a licence file).

I can't say if I will ever get to trying it though, since I don't have a need for it now. Might do it if I am really bored one day.

alvinhochun avatar Sep 21 '20 15:09 alvinhochun

SynapticsTouchPad::TouchPad has a rather simple interface. If you already have C code which can generate a stream of touchpad events, the easiest way to get it work is probably to use IPC. One can make an alternative implementation of the TouchPad class which takes events from a named pipe, and your C code can send the events through the named pipe.

alvinhochun avatar Sep 21 '20 15:09 alvinhochun

I think a GUI application (its HWND) is required in order to receive raw input from Windows. It would be great if we could just plug a "module" somewhere to use IPC.

ichisadashioko avatar Sep 22 '20 08:09 ichisadashioko

I believe it is rather typical for programs without a front-facing UI to use a hidden window just for the message pump.

alvinhochun avatar Sep 22 '20 09:09 alvinhochun

Thanks. I will try that later.

I am thinking of implementing the BlockInput call while capturing the raw input. It was so annoying when the cursor reaches the bottom-right corner.

ichisadashioko avatar Sep 22 '20 09:09 ichisadashioko

Can you use a low level mouse hook to disable mouse input? Better yet, implement it in a way such that it would automatically unblock if an external mouse is moved. Probably with a slight delay since you can't directly pair raw input events with the low level mouse hook.

alvinhochun avatar Sep 22 '20 10:09 alvinhochun

Thanks. I just knew about Hooks. Never thought that there was something like hook.

ichisadashioko avatar Sep 22 '20 10:09 ichisadashioko

SynapticsTouchPad::TouchPad has a rather simple interface. If you already have C code which can generate a stream of touchpad events, the easiest way to get it work is probably to use IPC. One can make an alternative implementation of the TouchPad class which takes events from a named pipe, and your C code can send the events through the named pipe.

Just for practice I implemented an out-of-process touchpad handling using named pipe IPC and it appears to work OK-ish. The code is not very pretty though.

If you want to implement a client with the same protocol and plug it in, it should just work. Not sure if it would be simple in C (the named pipe APIs should be rather straightforward, not sure about non-blocking read on the main thread. You might want to use a worker thread).

alvinhochun avatar Sep 27 '20 18:09 alvinhochun

Thanks. I will try to implement that client. IPC method sounds very promising to me.

ichisadashioko avatar Sep 28 '20 03:09 ichisadashioko