Skip to content

Conversation

@rchee2018
Copy link

This code enables stylus pressure reading in brush tool.

- Syntax error of several lines that end with `".` instead of `."`
- Different devices are reported by event.get_source_device(),
  depending on which device generated the event at the time.
- Aiptek tablet was one of the devices reported.
  The device name was "Aiptek pen (0)" (same with pen or mouse).
  Another device reported was "SIGMACHIP usb mouse".
- Device Gdk.AxisFlags.PRESSURE was confirmed for Aiptek pen.
- Event Gdk.AxisUse.PRESSURE returns 0.0 for Aiptek pen.
  In contrast, the SIGMACHIP usb mouse returned None for that.
- Unable to consistently get stylus pressure.
  Initial pressure reporting not reproducible afterwards.
- Removed the TODO about how to add python dependency.
- Main code with gesture stylus is in image.py now.
- Removed or commented duplicated ones previously added elsewhere.
- Removed GestureStylus-related code from main.py and image.py.
- Reset tool_brush.py according to maoschanz's original code.
- Must install evdev (by software manager) and libevdev (pip).
- Updated dependency (libevdev) on meson.build.
- Added aiptek_access.py to list of install (src/meson.build).
  Functions in aiptek_access.py are imported into tool_brush.py.
  It uses evdev to read Aiptek pen pressure.
- Altered tool_brush.py to use aiptek_access.py functions when
  the device is an Aiptek tablet product.
- Now able to sense Aiptek pen pressure.
  But discovered this is not enough for the stylus to be useful
  for controlling the brush tool.
- The original code senses standard usb mouse motion, but not
  the motion event of the stylus or the tablet mouse.
- The "motion_on_area" functions are not executed when the stylus
  or tablet mouse moves.
  This explains why strokes are not seen during stylus motion, but
  the strokes appear after stylus is lifted.
- Drawing app is supposed to take a pressure range 0.0-1.0.
- The old Aiptek tablets likely reports a max value of 512
  for stylus pressure.
- This allows the width variation of the line to show at the time
  of drawing, rather than when the pen stroke is complete.
- Made some changed that did not work.
- Reverted to original.
- Needed to do retab (on vim editor), hence different tabs and
  spaces compared to the original.
- Previously thought EV_ABS type has code 1 & 2 being x & y.
  Actually, code 0 & 1 are x & y, respectively.
- Wanted to stop drawing when pen motion stops.
  Attempted to do this by calculating the distance between the
  previous and the current cursor positions, and continue to
  process only if that passes an arbitrary threshold.
- Did not work well, because of error about the index being out
  of range for width[i -1].
  Tried to make changes to the code involving width[i - 1] but
  it seemed to cause more problems.
- Therefore, "reverted" the code by commenting.
  This keeps a small record of what have been tried.
- Does not need evdev after all.
- There remains the problem of brush continuing to draw after the
  pen is lifted off the tablet surface and hovering; or connecting
  the trace from the lift-off point when making next pen stroke.
- Removed evdev-related python codes including aiptek_access.py
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

Successfully merging this pull request may close these issues.

1 participant