Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture Windows Precision Touchpad raw input #3

Open
ichisadashioko opened this issue Sep 21, 2020 · 9 comments
Open

Capture Windows Precision Touchpad raw input #3

ichisadashioko opened this issue Sep 21, 2020 · 9 comments

Comments

@ichisadashioko
Copy link

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

@alvinhochun
Copy link
Owner

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
Copy link
Owner

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.

@ichisadashioko
Copy link
Author

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.

@alvinhochun
Copy link
Owner

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

@ichisadashioko
Copy link
Author

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.

@alvinhochun
Copy link
Owner

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.

@ichisadashioko
Copy link
Author

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

@alvinhochun
Copy link
Owner

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).

@ichisadashioko
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants