dannytaylor / pinspiroy

linux driver workaround for Huion Inspiroy G10T
MIT License
11 stars 4 forks source link

Solution to many problems #3

Closed KaiJan57 closed 6 years ago

KaiJan57 commented 6 years ago

I've gotten the code to react correctly upon stylus button presses. The trick is to add a global variable that holds the status of whether a stylus button is pressed or not. React upon the first 130/132 (button down) and react upon 128 (button up). If you want me to give the code, please respond. Also, I am willing to work on the other issues, but I can't understand what you mean by "unpaired"; I'm currently trying to make the Windows VM obsolete... EDIT: Got that thing working without VM (whoo!). Magic code:

try: usb.util.get_string(dev, 0xc8, 1033) print('Graphics tablet enabled.') except: print('')

dannytaylor commented 6 years ago

Good find on the stylus buttons, thanks. Feel free to submit a PR or fork the repo if you want.

For Windows issue I'm a bit rusty since I haven't looked at this in a code while. If I'm correctly remembering the impaired functionality issue, it's that the USB traffic was using a different set of variables for pen coordinates and pressure with a lower resolution and that it would require a handler to detect when this was occurring. Unplugging and replugging the wireless adapter for the tablet would reset the type of UBS traffic getting sent.

I'll take a look this weekend to see it's working on my end and update the repo.

dannytaylor commented 6 years ago

Yep, that's the magic code for getting around the VM. Awesome work, thank you!

I ended up implementing the stylus button a bit differently, just with adding the stylus button status to every frame and it seems to work in the programs I tested it with. I had to add a slight delay to button 2 because button 1 seems to send a few frames with 132 when the pen touches the pad with button 1 clicked. There doesn't seem to be any issues with this workaround.