Commit Graph

352 Commits (master)

Author SHA1 Message Date
Peter Hutterer 02ca3a7058 gui: hook up the auth signal with a re-register workflow
When we get an authorization error, show a revealer to re-register the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer f21af42131 protocol: on the spark treat a general error during connect as wrong uuid
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 7a121cfe6c protocol: print the DeviceError as something useful
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 88d9cf14bd wacom: move an assignment to a shared path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer daac9114e1 gui: pass a dbus device error on as signal
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 1ddf899d3e protocol: augment the new exceptions with errnos
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 14da500310 dbus: change EAGAIN to EBUSY for "already listening"
Seems like a more precise description.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer ebf48be0ad wacom: replace the last exception with a protocol exception
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer be38e1a781 wacom: replace one 'old' exception with the new protocol one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 22673b9e5a wacom.py: drop two now-unused functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 77048d572d protocol: use a MisingReplyError instead of timeout exceptions
It's caused by a timeout but the underlying issue is that we never got the
reply that we wanted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer 4eee838d94 protocol: implement the message to wait for the end of pen data
This pushes the CRC fetching into the messages, making the caller code more
generic.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer fc280ce555 wacom: use the DeviceError for the invalid state message
Nothing throws the previous exception anymore anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:38:36 +02:00
Peter Hutterer cdb7f905ca Store the raw logs in the specified config dir too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 17:20:13 +10:00
Peter Hutterer d514aa2224 gui: rename refresh() to process_svg()
refresh was accurate when it ended up redrawing the screen but now that
redrawing is a separate function let's rename this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 15:52:25 +10:00
Peter Hutterer 8c9454a298 gui: don't regenerate the SVG when the rotate button is clicked
Do this when we're saving the file instead and rotate the pixbuf itself only.
For the tablet-wide orientation we regenerate the SVGs because this is
supposed to be a once-off setting so being smart here doesn't gain us
anything.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 15:52:25 +10:00
Peter Hutterer bad7aa4554 wacom: treat any settings.ini misconfigurations as unregistered
This situation will never be handled correctly b a GUI and there's no need to,
our settings aren't supposed to be edited by puny humans. So just log an error
and treat the device as unregistered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 12:53:47 +10:00
Peter Hutterer fe75fc4342 wacom: be more specific in the spark's original error code
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 10:52:30 +10:00
Peter Hutterer 9fcd2b9517 protocol: make the auth error a subclass of our protocol error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 10:52:30 +10:00
Peter Hutterer 354c84d750 wacom: switch two exceptions to a the protocol types
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 10:52:30 +10:00
Peter Hutterer 0b8d3773d7 wacom: drop now-unused check_ack function
And since this function was the only one generating some of the exceptions,
let's remove those too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 10:52:30 +10:00
Peter Hutterer f7f6d02a37 wacom: drop now unnecessary transaction count
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 09:59:14 +10:00
Peter Hutterer e030b0b3ea base: add an argument to peek at the first drawing only
Use --peek to download the first (oldest) drawing on the device but do not
delete it. This is primarily intended as a debugging option, so we can debug
the tablet handling without having to draw new drawings (which cause the
protocol messages to change slightly).

Since the tablet only has a "download oldest file" command this isn't very
useful to end users. If there are two or more files on the tablet, we can only
ever retrieve the oldest one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 09:59:14 +10:00
Peter Hutterer 23989e4291 config: make the TuhiConfig a singleton object too
We only ever have one of those anyway, so let's make it a singleton. This
patch keeps the self.config assignment and config passing to keep the churn at
at a minimum. But this way we can assign runtime options to the config and
have those as globally accessible options.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 09:59:14 +10:00
Peter Hutterer 6e4b190169 protocol: rename a few protocol messages to better reflect what they do
0xc3 is 'download the oldest file'
0xca is 'delete the oldest file' (usually the one we just received) from the tablet.
0xc1 is 'how many files are there'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-22 09:59:14 +10:00
Peter Hutterer d633637899 gui: initialize the drawing with the right zoom factor
Fixes #172

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 11:49:26 +02:00
Peter Hutterer fa888b742f wacom: switch to the new protocol stroke parsers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 09:31:52 +02:00
Peter Hutterer 07dba6c892 wacom: store the default orientation for each tablet
Not actually used at this point, but this way we have default
width/height/orientation etc. all in one place.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 09:31:52 +02:00
Peter Hutterer e420b04fda protocol: add stroke parsing
This is a slightly different model as the messages, primarily because it's not
quite as model-specific. So there's only one parse function and it can handle
both file types that we currently support (intuos pro and the spark/slate
bits).

All wrapped into their own classes to make future extensions a bit easier.
It's not a 1:1 implementation of the tuhi/wacom.py bits either because we now
know about a few extra bits like the flags in stroke headers.

Most importantly though, this can be easily tested now, with one test case
searching for raw logs in $XDG_DATA_HOME/tuhi/raw and parsing all of those. So
the more files are sitting in there (i.e. the more the tablet is used), the
better the test suite becomes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 09:31:52 +02:00
Peter Hutterer 541077a65b Add a utility function module
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 09:31:52 +02:00
Peter Hutterer 91203701cf wacom: group the list2hex output
Group by size 8 by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 09:31:52 +02:00
Peter Hutterer 244b4f5994 wacom: make the parents for the raw log directory too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 14:04:23 +10:00
Peter Hutterer 10c34bc655 gui: simplify the Config's singleton pattern
Use __new__ instead of instance(), this way we can just use the same config
object as Config().do_something.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>k
2019-08-20 12:19:52 +10:00
Peter Hutterer 64fcf04e32 svg: use our Json SVG converter from kete
A few minor changes like passing in a filename and fixing the different
spellings of the orientations.

In order to use it from kete though we have to mess with the PYTHONPATH. But
since it's a in-tree tool only anyway... meh.

This loses the ability to disable pressure on tablets. I think that's just a
leftover from before we knew how to handle pressure in SVG exports. We should
just fix that properly instead of having a config option here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer ac811920b8 tuhi: move the gui/svg.py file to tuhi
One JSON to SVG converter per project is enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer f5bafb7f73 gui: use mm in the svg 2019-08-20 12:02:30 +10:00
Peter Hutterer 92fcfd12cc wacom: update the dimensions with the point size
Make sure our dimensions are in actual µm.

Note that this will mess with any cached JSON files since they are now on a
different scale.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer 643dd34476 protocol: add the message for getting the point size
The dimensions of the tablet are in device units, the point size tells us how
big the actual tablet is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer 57aa0de954 protocol: the spark doesn't support get width/height
Let's make those noop messages that return the hardcoded width/height instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer ff2618e68a protocol: add helper functions for converting to/from little endians
A few messages where we assumed the argument is a single byte are actually
little-endian 16 bits. let's add easy-to-use wrappers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer 6d718f16b5 wacom: rework the file data prefix handling
We know how it's supposed to look like, so let's hardcode it a bit better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:46:50 +02:00
Peter Hutterer 116589d28d wacom: pen data first four bytes are the internal file format
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:46:50 +02:00
Peter Hutterer f742779c1a tuhi: log the tuhi server session data to a file
Storage is $XDG_DATA_HOME/tuhi/session-logs/tuhi-$DATE.log
Because it's really useful to have the logs of an old session around when
something goes wrong. Even for simple things like "what uuid was I using
again?"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:43:01 +02:00
Peter Hutterer 9ef4002b39 Move the default config setting to the entry points
Have this in the effective main() methods (or close to that anyway) instead of
hidden away in the config implementations.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:43:01 +02:00
Peter Hutterer be9b3c02cc base: allow for a None vendor ID
Unsure how to trigger this case but I have all my devices (not recently
connected) with a vendor ID of None.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:41:10 +02:00
Peter Hutterer 8d67bbf5c4 gui: drop an unused config path
This is the copy of tuhi-kete, no need to keep the config path around here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 14:30:26 +10:00
Peter Hutterer 101e2f380e gui: store the cached SVGs in $XDG_CACHE_DIR instead
This is transient data, they're constantly regenerated. Let's store them as
such.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 14:26:27 +10:00
Peter Hutterer be6d57562a Switch to pathlib everywhere
gresources and svgwrite don't (yet?) take a Path though, so we have to use
os.fspath() to convert those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 14:11:36 +10:00
Peter Hutterer c8759eb400 gui: unify the loggers across the GUI
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 14:11:25 +10:00
Peter Hutterer 6dc67f13c8 svg: call the super constructor
Presumably gobject sets a few things up, so let's call it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 15:22:53 +10:00
Peter Hutterer 32091d9a7b wacom: improve a timestamp debug message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 15:21:24 +10:00
Peter Hutterer e5375a55dd wacom: name an argument to make it more obvious what the magic 5 means
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 15:21:24 +10:00
Peter Hutterer d73da09e26 protocol: 0xc7 on the spark seems to be in big-endian
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 15:10:25 +10:00
Peter Hutterer 790d8c5e31 wacom: fix pressure range for the IntuosPro
8191 seems to be the max value

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 15:05:49 +10:00
Peter Hutterer 85f2e3c67a wacom: fix the dimensions for the Spark
The reachable range is 2100x14800, highest pressure is 1023. Unlike the slate
the paper block still affords to address almost the whole range even though
the paper is slightly narrower than the range - but it can slide left/right by
about 5mm.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 15:05:49 +10:00
Peter Hutterer bd6278a305 wacom: change the raw log file name to include the timestamp
Because it's annoying when there's an issue with the timestamp in the file and
you have to grep for the file name.

And while we're there, change the human readable date to be actually readable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 14:58:41 +10:00
Peter Hutterer 35acce3ea6 wacom: log the raw yaml data into a subdirectory
It gets a bit too confusing otherwise with all the weirdly named files around

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 14:58:41 +10:00
Peter Hutterer 6bf7715e83 wacom: write just the timestamp to the log file
Easier to parse than a strftime. And we can just add that one in a comment
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 14:58:41 +10:00
Peter Hutterer 7f8222b351 wacom: add missing linebreaks to the yml log file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-15 14:58:41 +10:00
Peter Hutterer e6057e256d Merge tuhigui into tuhi.gui
Let's make this a submodule of tuhi so we can share some code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 08:18:39 +10:00
Peter Hutterer 547aec3d9b config: use super() instead of named base class
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 08:18:39 +10:00
Peter Hutterer c014393adb wacom: time_to_bytes is obsolete now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 1ea89d2f09 protocol: split GET_DIMENSIONS up into two messages
It's the same message with a different argument, let's try not to do
gymnastics in the Msg code just so we can return a tuple.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 73bc782a53 protocol: 0xec is simply the GATT selection for file transfers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer c39c20ede2 protocol: drop the UNKNOWN_B1 class
0xb1 is the SetMode command, the rest is just the argument for which mode we
want

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 5e4ab89f41 Drop the semi-duplicate separate Protocol class
We can hook into the ProtocolVersion here, so let's de-duplicate this.
Should be backwards-compatible for config files but new config files will have
the uppercase name written now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 552e06a0fc wacom: drop the now-obsolete send_nordic_command_sync
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer b34f8794e4 wacom: switch registering the device to the new protocol handling
This is still a bit awkward because the communication of the spark especially
is so strange. It sends a (rejected) uuid, then a single command to register
that UUID. The Slate and the IntuosPro are more sensible, they seem to have a
special message to register a UUID - that one either fails or succeeds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 6e20faa737 protocol: add a timeout argument to the new protocol handlers
The default timeout is too short for registering a button, let's control this
from the message.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer f68ffa6733 wacom: pass the timestamp in seconds down parse_pen_data
We don't carea about the struct time here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer a08aa02607 wacom: drop a bunch of now-duplicate functions
This is all handled by the matching Msg now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 023decb1d4 wacom: use the new protocol implemenation for all "normal" messages
This is an in-situ replacement of the old functionality vs the new one,
resulting in a bit of duplication. Now that the Protocol takes care of the
device-specifics most of our functions look identical. This will be fixed in a
follow-up commit.

Missing from the conversion here is the initial register handling (too
convoluted right now) and the parsing of the pen data.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer bcbb0982c8 wacom: drop our NordicData, use the one from the protocol
Same thing anyway, this is just namespace handling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer a817d10cc7 protocol: start a new attempt at handling the protocol
This is only the framework for a new protocol handler that should simplify
adding, extending and debugging the actual protocol messages.

The summary is:
- each protocol interaction is a subclass of Msg() that handles the data sent
  and received from the device.
- the list of messages for each device is stored in a dictionary the caller
  initializes by providing the protocol version
- those messages are addressable via the Interactions enum through the
  Protocol class
- the messages can be run via execute(), taking and setting the obvious
  properties on the object
- actual communication is done via a single callback that takes/returns a
  NordicData object for the request/reply.

So after the basic setup, the caller can do this:
   p = Protocol(ProtocolVersion.INTUOS_PRO)
   name = p.execute(Interactions.GET_NAME).name
   p.execute(Interactions.SET_TIME, time.time())

This completely separates the protocol from the implementation where we want
the result of that exchange, ideally paving the way for better testing and
easier debugging of what's happening on the wire. Well, ether.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 910bea8898 wacom: add another nordic function that just takes and returns data
This function doesn't process the data beyond the logging required. It simply
sends the request and returns the reply, whatever that is.

Currently unused, this is prep work for later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer fd02453279 wacom: allow for "no specific requested opcode" where we just return the data
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-14 07:37:30 +10:00
Peter Hutterer 16c22a95ec base: add a flag to control the config directory
For testing it's a lot easier to just provide a /tmp/ directory than having to
clear out the normal one that may contain useful drawings for debugging.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-13 19:12:53 +10:00
Peter Hutterer ee5640b783 Merge branch 'master' into wip/tuhigui 2019-08-09 15:22:07 +10:00
Peter Hutterer 28cb94bc89 base: fix failing registration of new devices
Regression introduced in e1a3675439

Where a device has no config entry, the e1a367 change would return early. This
is fine for devices previously seen and still lingering in the config but for
completely new devices, we'll never get past that KeyError.

Return to the old behaviour: where we don't have a stored UUID we continue
with the None UUID.

Fixes #148

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-09 15:18:00 +10:00
Peter Hutterer 341b91349e wacom: fix the data logger being off by one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer 96df9fc416 wacom: make sure we only return the data packet size we want
If we have more data than our packet [1], let's not return the whole data
array. Slice it to size instead.

[1] this never happens with the current code, we don't work asynchronously

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer eacc03b6ea wacom: rename a function to make it more obvious
We're not checking for data here, we're taking the next message.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer 075fae13f9 flake 8 fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer 6e27d70517 wacom: de-duplicate an opcode check
we don't need the same-ish check twice, we can just pop our non-list into a
list an go from there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer c84f3f8c63 wacom: error code 0x05 is an unrecognized command
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer d3726420cf wacom: add a comment describing where to we store stuff
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer b009ea3c96 wacom: rename the mysterious bits to sysevent
These bits are used for system notifications

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer cda4300388 wacom: visually align the UUIDs
And add # NOQA to shut up flake8

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer 92a9628adf base: drop the separate function for bluez updates
A lambda does the job here without increasing the class profile
2019-07-30 14:06:49 +10:00
Peter Hutterer 08e3ec532e base: drop the extra function for checking if the device is in register mode
Now that it's just a one-liner, we don't need an extra function
2019-07-30 14:06:49 +10:00
Peter Hutterer 37b9b2eefa base: simplify check for in register mode
With a "or []" we can force this to be at least a 0-length list, obsoleting
the None check.
2019-07-30 14:06:49 +10:00
Peter Hutterer e1a3675439 base: ignore anything not from the known vendor IDs
We don't want to accidentally start talking to a device and brick it.
2019-07-30 14:06:49 +10:00
Peter Hutterer deb2c3ad2f base: rename the hotplugged argument
This one is a bit confusing, because most of the time it's not a hotplug
event, it's just the RSSI property updating.
2019-07-30 14:06:49 +10:00
Peter Hutterer 5b73c8ea2d Add a few more comments to the codebase 2019-07-30 14:06:49 +10:00
Peter Hutterer 764ad45ca2 wacom: normalize the pressure to the advertised [0, 0xffff] range
This requires adjusting the svg conversion in kete as well, afaict the 1000
range there was chosen because it's (almost) the midpoint of the Bamboo series
with 2048 pressure grades. So let's use half of 0x10000 instead, which is
approximately 0x8000 as the crow flies.

Fixes #142
2019-07-30 14:05:01 +10:00
Peter Hutterer 3c3163261f wacom: normalize the pressure to the advertised [0, 0xffff] range
This requires adjusting the svg conversion in kete as well, afaict the 1000
range there was chosen because it's (almost) the midpoint of the Bamboo series
with 2048 pressure grades. So let's use half of 0x10000 instead, which is
approximately 0x8000 as the crow flies.

Fixes #142
2019-07-19 14:37:51 +10:00
Peter Hutterer 4b3914d49c tuhi: take the mainloop out of Tuhi
If we want to integrate this with TuhiGui, we can't have multiple mainloops.
And there's nothing with Tuhi that needs it anyway, it's all about how it is
being called. Which means we can just move this to the main method.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-18 12:19:29 +10:00
Peter Hutterer db08e1a82f wacom: improve a debug message 2019-07-17 18:25:40 +10:00
Peter Hutterer bc612f9e0e wacom: fix the firmware version retrieval for the base protocol
Introduced in dbd60675a9
2019-07-17 18:25:36 +10:00
Peter Hutterer 498a867558 Revert "base: once the device is registered, we're done"
This broke device initialization in some cases (not sure why it worked until
today though). Where a device is in register mode but the ManufacturerData has
not yet updated to the 4-byte string (i.e. a device previously known
normally), the device would now always call listen(). The firmware - in
register mode - would start initializing the connection though and get
rejected, leaving us with a device that cannot be registered.

This reverts commit a061240b11.
2019-07-15 21:57:24 +10:00