Open mfauvain opened 3 years ago
Using the eraser is implemented but I suspect your pen doesn't actually have an eraser (typically located at the back of the pen) but just a button (typically located at the side of the pen) and unfortunately such buttons are hard to deal with. Also see #66. Please run Weylus like this WEYLUS_LOG_LEVEL=TRACE ./weylus
, use your pen and especially the eraser and paste the output here.
It does. xinput list
on the surface gives
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ELAN9038:00 04F3:261A Stylus stylus id=8 [slave pointer (2)]
⎜ ↳ ELAN9038:00 04F3:261A Stylus eraser id=9 [slave pointer (2)]
⎜ ↳ ELAN9038:00 04F3:261A touch id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Intel HID events id=12 [slave keyboard (3)]
↳ Intel HID 5 button array id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
However on the weylus 'server' I see
Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Apple SPI Touchpad id=11 [slave pointer (2)]
⎜ ↳ Weylus Mouse - 192.168.1.193:52452 id=12 [slave pointer (2)]
⎜ ↳ Weylus Touch - 192.168.1.193:52452 id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Apple SPI Keyboard id=10 [slave keyboard (3)]
↳ Weylus Stylus - 192.168.1.193:52452 id=13 [slave keyboard (3)]
↳ Weylus Keyboard - 192.168.1.193:52452 id=14 [slave keyboard (3)]
and in mypaint for ex I have
running in debug mode I have
Aug 04 16:12:26.246 TRACE weylus::websocket: Got: PointerEvent { event_type: MOVE, pointer_id: 1, timestamp: 23721800, is_primary: true, pointer_type: Mouse, button: NONE, buttons: PRIMARY, x: 0.6263440860215054, y: 0.5714285714285714, movement_x: -1, movement_y: 4, pressure: 0.5, tilt_x: 0, tilt_y: 0, twist: 0, width: 0.0007437183099083297, height: 0.0007437183099083297 }
Aug 04 16:12:26.270 TRACE weylus::websocket: Got: PointerEvent { event_type: MOVE, pointer_id: 1, timestamp: 23734800, is_primary: true, pointer_type: Mouse, button: NONE, buttons: PRIMARY, x: 0.6263440860215054, y: 0.5723214285714285, movement_x: 0, movement_y: 1, pressure: 0.5, tilt_x: 0, tilt_y: 0, twist: 0, width: 0.0007437183099083297, height: 0.0007437183099083297 }
Aug 04 16:12:26.274 TRACE weylus::websocket: Got: PointerEvent { event_type: MOVE, pointer_id: 1, timestamp: 23755800, is_primary: true, pointer_type: Mouse, button: NONE, buttons: PRIMARY, x: 0.6290322580645161, y: 0.5678571428571428, movement_x: 2, movement_y: -5, pressure: 0.5, tilt_x: 0, tilt_y: 0, twist: 0, width: 0.0007437183099083297, height: 0.0007437183099083297 }
Aug 04 16:12:26.285 TRACE weylus::websocket: Got: PointerEvent { event_type: MOVE, pointer_id: 1, timestamp: 23770800, is_primary: true, pointer_type: Mouse, button: NONE, buttons: PRIMARY, x: 0.6290322580645161, y: 0.5660714285714286, movement_x: 0, movement_y: -2, pressure: 0.5, tilt_x: 0, tilt_y: 0, twist: 0, width: 0.0007437183099083297, height: 0.0007437183099083297 }
Aug 04 16:12:26.291 TRACE weylus::websocket: Got: PointerEvent { event_type: UP, pointer_id: 1, timestamp: 23770800, is_primary: true, pointer_type: Mouse, button: PRIMARY, buttons: NONE, x: 0.6290322580645161, y: 0.5660714285714286, movement_x: 0, movement_y: 0, pressure: 0.0, tilt_x: 0, tilt_y: 0, twist: 0, width: 0.0007437183099083297, height: 0.0007437183099083297 }
I've noticed as well that pressure/tilt/twist do not change. when I do 'write' pressue is 0.5. And 0 when I just hover above the Surface screen. Here is a more complete log file. weylus.txt
Thanks for the detailed logs! I am afraid but it looks like your browser doesn't recognize the eraser as such. Instead it considers it as primary button and sadly the specifications say that primary button means pen contact as well and not just primary button has been pressed and there is no way to distinguish pen contact and the pen button/eraser. Regarding tilt and pressure: Looks like your browser or your pen don't support those and some reasonable defaults are provided.
I see.. any browser you know (linux) that does support eraser/tilt/pressure?
I only know that Firefox does not handle things properly: https://bugzilla.mozilla.org/show_bug.cgi?id=1501744 https://bugzilla.mozilla.org/show_bug.cgi?id=1324956
I do not know about chrome/chromium but that is probably the only browser that might have support.
I tried Chromium, no luck. Thx.
Maybe just valid for pressure, but you might be able to make use of this javascript https://pressurejs.com/index.html#examples I tried it on linux Chromium/Chrome and pressure is correctly detected.
I have a Surface Go with the pen and my eraser also wasn't working. I tried to dig into the code and found that if I flipped this bit from a 0 to a 1, it started working! I can use the pen tip for writing and the eraser for erasing. I'm not familiar with the code base, but it seems like setting EC_KEY_TOOL_PEN
to 0
effectively turns the pen writing and erasing state off for the Surface Go pen.
I am using a surface Go and surface pen as weylus input. Pen works perfect, but eraser is not recognized as such. Am I missing something or is it not implemented yet?