Commit Graph

352 Commits (master)

Author SHA1 Message Date
Peter Hutterer 48a339c3b7 wacom: device time must be interpreted as UTC 2019-07-15 09:38:19 +02:00
Peter Hutterer a1e3e8eafb wacom: move device state debugging to the functions themselves 2019-07-15 09:38:19 +02:00
Peter Hutterer aff38c26a3 wacom: fetch both dimensions in one go
No need for the caller to call this twice everywhere, let's just do this here.
2019-07-15 09:38:19 +02:00
Peter Hutterer dbd60675a9 wacom: fetch firmware data in one go
No need for the caller to call this twice everywhere, let's just do this here.
2019-07-15 09:38:19 +02:00
Peter Hutterer bf5e53b62b wacom: simplify the battery state debug message 2019-07-15 09:38:19 +02:00
Peter Hutterer 5d53ec8005 Bubble up the width/height from the protocol to the dbus interface
Fixes #135
2019-07-15 09:38:19 +02:00
Peter Hutterer d3156110b7 wacom: disable a duplicate debugging, enable another one
Print the dimensions during register too. And the "received" message is
duplicate because we log this as the data comes in from the nordic anyway.
2019-07-15 09:38:19 +02:00
Peter Hutterer 4611692b2c wacom: minor tidyup
No functional change, it just uses a dict now to pick the protocol class which
makes it *slightly* easier to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15 09:38:19 +02:00
Peter Hutterer b6494efd40 wacom: move the fw logging into a custom class
Instead of just doing a single log line, let's log this to a yaml file so we
have a permanent record of the interactions with the device for bug reports.
2019-07-15 09:38:19 +02:00
Peter Hutterer bcdf730a72 base: make sure we only connect once to the bluez connect/disconnect signals
This was getting stacked - once on init and once whenever we actually made a
connecting, resulting in the signal never getting disconnected properly and
some races because we tried to sync twice.

The whole "listen()" vs "listening" vs "connected" etc. is a bit of a mess and
should be reworked for a proper fix to this. But for now this will do.

This may fix #124
2019-07-15 09:38:19 +02:00
Peter Hutterer b16a16abde Add a SyncState signal to the DBus interface
Propagated whenever we start talking to the device (and then again when we
stop). The purpose of this signal is merely that a UI can show e.g. a progress
bar while we're talking to the device to ensure the user something is
happening.

Fixes #138
2019-07-15 09:38:19 +02:00
Peter Hutterer 05fd213940 wacom: fetch the battery state during register
Any decent UI will want to know this given the device is online right now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15 09:38:19 +02:00
Peter Hutterer f488d4e130 wacom: make 0xb3 the expected opcode
Virtually all the commands we have that don't have a specific opcode expect
0xb3. Since that's the general ACK command, we can default to that and make
everything else the exception.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15 09:38:19 +02:00
Peter Hutterer a061240b11 base: once the device is registered, we're done
This method is called whenever a bluez property changes, don't prompt the user
(in the logs) to register the device we just finished registering.
2019-07-15 09:38:19 +02:00
Peter Hutterer de3386a88d base: add a helpful comment
This it's more obvious that add_device can really be called every second or so
2019-07-15 10:43:35 +10:00
Peter Hutterer 6aced355b5 wacom: minor change to a debug message 2019-07-15 10:43:35 +10:00
Peter Hutterer 72507b687a wacom: remove some superfluous ''' 2019-07-15 10:43:35 +10:00
Peter Hutterer caa52e0c51 base: when search is turned off, remove unregistered devices again
This is what the dbusserver module does as well, so we end up with a weird
mismatch: to the base module the device is still known and unregistered on the
next search start. So when we see the bluez properties float past, we don't
add a new devices.

To the dbusserver the device is gone though and since we don't add it again in
the base module, we never send a signal for it.

Since there's a reasonable assumption that if we don't register the device, we
don't want it anyway, let's delete it from the base device list too.

This doesn't fix the issue of a device timing out while waiting for a button
press. That device will count as known until the next search stop. But at
least now we don't have to restart tuhi.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-08 10:52:39 +02:00
Peter Hutterer 6ff9f34d08 wacom: fix type error when registering a Intuos Pro paper
gmtime() and localtime() both take seconds, not a struct time.
2019-07-08 10:52:39 +02:00
Peter Hutterer 0ddc33a37b drawing: fix deprecation warning
tuhi/drawing.py:46: PyGIDeprecationWarning: GObject.property is deprecated;
use GObject.Property instead
  @GObject.property

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 15:35:59 +10:00
Daniel Martin b52891f8fd ble: prefix all device logs with address
Use a logger child in BlueZDevice prefixing all log messages with the
device address.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin c719ecf2e2 ble: use properties instead of variables
Replace variables (objpath, interface, uuid) with properties.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin 7f9e58e587 ble: simplify GATT characteristic lookup
No need to get triggered by BlueZDeviceManager when it finds any GATT
characteristic. The BlueZDevice just needs its 'ServicesResolved' and
can resolve the GATT characteristics itself.

This solves a FIXME.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin e7f8cc2bc2 ble: make object manager return sorted object list
The object list returned by object managers get_objects() function is
not sorted. Though, we rely on objects being sorted by their object
path.

Replace the object managers get_objects() function with a variant
fixing that. Additionally, our variant makes it possible to filter
the returned object list by object path and interface.

Examples:

- get_objects():
  /
  /org/bluez
  /org/bluez/hci0
  /org/bluez/hci0/dev_00_00_00_00_00_00
  /org/bluez/hci0/dev_00_00_00_00_00_00/service0000
  /org/bluez/hci0/dev_00_00_00_00_00_00/service0000/char0000
  /org/bluez/hci0/dev_00_00_00_00_00_00/service1111
  /org/bluez/hci0/dev_00_00_00_00_00_00/service1111/char1111
  /org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF
  /org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF/serviceffff
  /org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF/serviceffff/charffff

- get_objects(interface='org.bluez.Adapter1'):
  /org/bluez/hci0

- get_objects(interface='org.bluez.GattCharacteristic1'
              base_path='/org/bluez/hci0/dev_00_00_00_00_00_00'):
  /org/bluez/hci0/dev_00_00_00_00_00_00/service0000/char0000
  /org/bluez/hci0/dev_00_00_00_00_00_00/service1111/char1111

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Peter Hutterer 1b9b7760fd wacom: let's assume any 0xb3 with nonzero data is an error
b3 01 00 seems to be a generic "I'm happy" and the few others we've seen
are errors. So let's encode that and reconsider if it turns out to be false.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 11:14:48 +02:00
Peter Hutterer c1283289b7 wacom: sort the error handling
and use elif for clarity (even though we have exceptions here)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 11:14:48 +02:00
Peter Hutterer 4b02a6f51c Fix flake8-3 complaints
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:58:21 +02:00
Peter Hutterer 82b81b1c34 base: add timestamps to the logs
Fixes #127

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:54:44 +02:00
Ishak BELAHMAR f2263e72cf wacom/live: read Slate dimensions before starting live mode 2019-05-03 09:56:20 +02:00
Benjamin Tissoires c21c8a4633 wacom: do not use relative data when exporting
we already are keeping a record of the x,y and p. So we are trying
to duplicate the effort by using new_rel.
The problem is that some reports have relative coordinates but absolute
pressure data. Which means we are missing the pressure change as it has
a relative value of 0.

By trusting the wacom internal state, we can have the json data that
matches it completely.
2019-04-29 09:36:11 +02:00
Benjamin Tissoires 6d74615085 tuhi: prettify the exported json
having the whole file in a single line is fine for programs, much
less for humans
2019-04-29 09:36:11 +02:00
Peter Hutterer 7e751d45c8 base: if gi.repository fails to import, warn
We need python 3.6 but old Ubuntus only have 3.5. 3.6 can be installed (and
thus we get past the 3.6 sys.version check), but the gi.repository backports
are in various states of disarray (see #103 and #104).

And Python (and in particular gi) makes it hard for users to distinguish
between "the dependencies are a mess" and "this is a bug in tuhi".

So let's catch any error during gi.repository import and print a warning to
the user, in the hope of getting less bugs caused by Ubuntu frankenpythons.
Still won't fix issues like #104, but I'm not sure how to test for those
errors.

Related to #103
2018-03-06 09:33:17 +01:00
Peter Hutterer caf1264952 dbus: add file format version negotiation for the JSON data
Export the supported versions in a Manager property and require the client to
request a specific version in GetJSONData. Without that, the server could
never update the format and clients would have to support every single
historical version to make sure they can run against any version server.

Fixes #98
2018-02-19 11:17:18 +10:00
Peter Hutterer d4ea6e3938 dbus: change the JSON timestamp argument to 64 bit
Because we're totally going to ship tuhi in embedded devices that are going to
be in use until after 2038 when time resets to zero, the world goes big bang
and the only survivers will be 64-bit species. Or something like that. Either
way, the API documentation already said so anyway and the DrawingsAvailable
property is already 64 bit too.

Semi-confusingly: the dbus 64 bit unsigned type is 't', it doesn't stand for
'timestamp'.
2018-02-19 11:16:27 +10:00
Benjamin Tissoires 789c098e82 wacom: do not timeout on long drawing retrievals
It can easily take more than 5 seconds when reading the data. The current
timeout just cuts the connection while it is still reading.

We *could* just remove the timeout here as the device will gracefully
send us a 0xc8 opcode with a blank CRC if we shut the device down while
retrieving the data.

However, better being on the safe side and keep a timeout, but restart it
if we are still getting pen data during the timeout.

Fixes #91
2018-02-16 10:52:49 +01:00
Benjamin Tissoires a5cb084a31 wacom: use semaphore instead of polling
Using polling is bad, true, but it worked. However, using a Semaphore
is better and we can directly benefit from the internal timeout
implementation.
2018-02-16 10:51:09 +01:00
Benjamin Tissoires be2ac9fed3 wacom/live: take into account 'physical' borders of the bloc of paper
When using the live mode on the Slate, the bloc note actually hampers
the pen and prevents it to address all of the pixels on the screen.

Add some artificial boundaries that roughly match the primary design
of the device.

The Intuos Pro has a clip where you put a regular sheet of paper, so there
is no point restraining the active surface.

Fixes #88
2018-02-16 10:47:19 +01:00
Benjamin Tissoires 013de2a6e4 wacom/live: do not fetch the width and height, rely on stored values
It's not like we are handling hundreds of devices. And this allows us to
be more flexible in which fields are replaced in the report descriptor.
2018-02-16 10:47:19 +01:00
Benjamin Tissoires cf4d5b184e wacom/live: make the pressure dependent of the class
The Intuos Pro has 4096 levels of pressure, while the Slate and the Spark
only has 2048. We should do something about it.
2018-02-16 10:47:19 +01:00
Benjamin Tissoires 18221dfd58 wacom/live: fix physical maximums
This way, udevadm shows on the Slate:
E: ID_INPUT_HEIGHT_MM=148
E: ID_INPUT_TABLET=1
E: ID_INPUT_WIDTH_MM=216

Fixes #84
2018-02-16 10:47:19 +01:00
Benjamin Tissoires ee15b474fd wacom/live: make sure the kernel assigns INPUT_PROP_POINTER
The wacom kernel driver assigns INPUT_PROP_DIRECT if we use the
application Pen. Using the Digitizer one fixes that.
2018-02-16 10:47:19 +01:00
Peter Hutterer 7b246e0892 wacom: add packet handling of the two initial packets the IntuosPro sends
One is a fixed header, one  is the stroke timestamp
2018-02-16 15:43:28 +10:00
Peter Hutterer 31ab5f37d3 wacom: move stroke prefix handling into a packet handler 2018-02-16 15:43:28 +10:00
Peter Hutterer 5692a1f3b2 wacom: add PacketHandlers for handling special commands
For data packets other than basic motion/pressure strokes, add a PacketHandler
that can deal with that particular packet. Those handlers are part of the
class declaration, when we instantiate a protocol we pull them all into a
packet_handlers list and go through them. The first one to return True is
considered the right handler and we expect something has been done with the
packet.

This patch includes the handlers for the end-of-stroke and end-of-sequence
packets, the rest to be added later.
2018-02-16 15:43:28 +10:00
Peter Hutterer 43064b58fc wacom: add a WacomPacket class
Instad of carrying around a lot of parameters, move this into a class with
properties. Eventually we can subclass that one for the special opcodes (or
something...)
2018-02-16 15:43:28 +10:00
Peter Hutterer 23e18cea67 drawing: add a stroke.seal() functionality
Makes end-of-stroke handling easier, we can call seal() on the current stroke
and it'll make drawing.current_stroke() None, which is something we can deal
with.
2018-02-16 15:43:28 +10:00
Peter Hutterer 155a11104c wacom: print an error if our device is more than 5 mins out 2018-02-16 15:43:28 +10:00
Peter Hutterer 09bfe44dd7 drawing: rename the stroke from 'l' to 's'
Leftover copy/paste error from when this class had a Layer subclass
2018-02-16 15:43:28 +10:00
Peter Hutterer 9fbfe17e13 ble: disable a debug message
Now that we got the basics running and reliable, this debug message is mostly
just noise, especially when in an office with lots of bluetooth devices
around. Comment it out, to be enabled when necessary.
2018-02-16 15:43:28 +10:00
Benjamin Tissoires 17dc80bea3 wacom: fix report descriptor logical min/max
Changing the python representation is not enough. We also need to change
the HID marker with the correct size.

Fixes 67b4d2b8fe
2018-02-14 13:11:37 +01:00
Peter Hutterer 67b4d2b8fe wacom: allow 4 bytes for width/height
Intuos Paper needs more than 16 bits

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-14 15:52:34 +10:00
Peter Hutterer 138497a73b wacom: add support for the Intuos Pro 2 paper 2018-02-14 15:03:02 +10:00
Peter Hutterer 7796d3c110 wacom: don't add points to the log until we have an absolute value
On the Intuos Pro at least we sometimes get events that are all relative at
first and it can take several events for us to have all three values as
absolute. This is likely a parsing error on our side, but meanwhile don't
write the data until we have at least one known value for all three axes.

And because the SVG writer isn't happy with empty strokes, add a seal()
function to the drawing to purge empty strokes.

Fixed #92 or at least works around it
2018-02-14 14:54:17 +10:00
Peter Hutterer 6c156efc01 wacom: make relative/abs events more obvious in the log
Mark the deltas with a * if they're the ones that changed.
2018-02-14 14:50:49 +10:00
Peter Hutterer 80d0066cef wacom: we only have one drawing per exchange
skip putting a single drawing in a list
2018-02-14 14:50:49 +10:00
Peter Hutterer c39b735e1e wacom: factor out the 'next stroke data' parsing 2018-02-14 14:50:49 +10:00
Peter Hutterer 8ecc397303 wacom: skip over the prefix when handling pen data
The prefix (4 bytes on the spark/slate) is some data that we don't know yet.
It *could* be the size of a tablet/drawing in LE byte order: 14434x29794
although that doesn't quite match the Intuos Pro data where the prefix is
different.

Either way, having this be an opcode of 0x3800 was probably just coincidence.
Let's skip over the header normally and assume that once we have a prefix, we
have a drawing. This opcode never occurs a second time within the same
drawing.
2018-02-14 14:50:49 +10:00
Peter Hutterer 876f35f806 wacom: factor out the prefix handling
The Intuos Pro has a different prefix, we'll need to override this. Dropping
the comment about the 8bt, on the intuos pro the prefix is nonsensical so
let's not leave a false lead there.
2018-02-14 14:50:45 +10:00
Peter Hutterer 726362107b wacom: append multiple nordic answers to each other
On the Spark, the 0xc9 CRC comes almost immediately after the 0xc8
end-of-sequence. This causes a race condition where sometimes we process the
0xc8 before the 0xc9 arrives, other times the 0xc9 overwrites the current
nordic_answer value before we get to it - triggering an unexpected opcode
exception.

Fix this by appending the nordic answer and only ever pulling off enough to
satisfy the current request.

Fixes #90
2018-02-14 11:25:13 +10:00
Peter Hutterer 240b982070 wacom: fix Spark CRC check
All it needs is less reversing
2018-02-14 11:25:13 +10:00
Peter Hutterer 45d4d6fb9b wacom: merge two debug strings 2018-02-14 09:45:49 +10:00
Benjamin Tissoires 422045e2fd wacom: insert proper ranges for X and Y in the uhid device
Also fix the pressure range to be 2047
2018-02-14 06:23:25 +10:00
Benjamin Tissoires d295e12310 wacom: create a uhid device on live mode
uhid code taken from https://github.com/bentiss/hid-tools and stripped out
from the not required parts here
2018-02-14 06:23:25 +10:00
Benjamin Tissoires d4dd672b2f live-mode: properly pack the fds over DBus
Keeping this one as a separate commit, so we can use it as a future
reference.
2018-02-14 06:23:25 +10:00
Benjamin Tissoires 1a6d0205df tuhi: hook up live mode
Currently just enable/disable live mode.
The int parameter is doomed to be an opened fd to the uhid node
2018-02-14 06:23:25 +10:00
Peter Hutterer 7ff760dcbf wacom: add support for a set_name on the Spark
Part of #82
2018-02-13 15:23:05 +01:00
Peter Hutterer 30620dfbf0 tuhi: when a device toggles 'registered', send out the required signal
Related to #80
2018-02-13 14:51:40 +01:00
Peter Hutterer ad0e81b395 base: push the mode down to the TuhiDevice
A device isn't registered or not, it's merely in a *state* of being
registering or not. Pass the current mode down to the TuhiDevice instead of a
boolean for 'registered'. The 'registered' gobject property is left in-place
for now, the dbus server needs it.
2018-02-13 14:51:40 +01:00
Peter Hutterer 720955db7c tuhi: try to register even if the device is not in register mode
Let's throw an exception when trying to connect.
2018-02-13 14:51:40 +01:00
Peter Hutterer 393056d5e8 base: remove another register_mode in favour of DeviceMode 2018-02-13 14:51:40 +01:00
Peter Hutterer 637f539194 ble: drop the 'event' argument from device-added
An 'event' boolean is less than obvious ('is-event' may be better). This
signalled the difference between a device-added during Manager startup and the
device-added at runtime (i.e. device goes online).

We don't need that differentiation. The manager adds all existing devices
immediately after connnect_to_bluez(). All we have to do is run through the
device list, add them locally and then subscribe to the signal.

This keeps the is-event confusion within one file only instead of spreading it
across two and an internal API. And we can re-name it to hotplugged.
2018-02-13 14:51:40 +01:00
Peter Hutterer 2ff4f8bca6 base: make the register/listen call handling more literal
Calling listen on an unregistered device currently triggers a register on the
device. This can happen when the device has been registered but the
ManufacturerData has not yet been updated.

Disentangle this by only calling the right function based on what we're trying
to get. This also requires that the connected/disconnected signals are only
handled when we're actually trying to do something with them.

Fixes #79 (multiple patches required)
2018-02-13 14:51:40 +01:00
Peter Hutterer 4661cf9ae8 wacom: remove state-based decision of whether to listen or register
Previously, we set self._mode and used that to determine what connection to
attempt. This can sometimes lead to a device attempting to register in
response to a listen() request (and vice versa).

Make this dependent on the caller arguments only. So when listen() is
requested do exactly that and generate the right exception if the device is in
the wrong mode.

Fixes #79 (multiple patches required)
2018-02-13 14:51:40 +01:00
Peter Hutterer 0d825e2e3c wacom: replace the signal forwarders with lambdas
We're doing nothing but forwarding the signal here, so let's just replace them
with lambdas so it's immediately obvious what we do with the signal.
2018-02-13 14:51:32 +01:00
Peter Hutterer de033c3b6a wacom: 0x05 appears to be the error for 'invalid opcode' 2018-02-12 15:30:16 +10:00
Peter Hutterer c9d48ed4b2 wacom: document the signals we send 2018-02-12 15:30:14 +10:00
Peter Hutterer 7cd9a89f3b wacom: prettify the 'returned time' debug message 2018-02-12 12:49:48 +10:00
Peter Hutterer 3cbbfbf056 base: remove write-only variable registering_mode 2018-02-12 09:41:54 +10:00
Peter Hutterer 60535a6859 wacom: remove unused define 2018-02-12 09:41:54 +10:00
Peter Hutterer 46ec85d718 ble: make manufacturer_data a property
We only ever used it in conjunction with vendor_id, so we can just make this a
normal property and send GObject notifies when it changes. This allows us to
listen for the MD to change when it finished registration.

[BT: do not add the second indirection by calling vendor_id]
2018-02-09 11:34:42 +01:00
Benjamin Tissoires 72523df3af ble: make sure the length of the manufacturer data is at least 1
We never encounter the issue, but I bet we will
2018-02-09 11:34:42 +01:00
Peter Hutterer 6cff3b8f79 wacom: split the time parsing functions out
Doesn't gain us that much, but we can re-use it when parsing stroke data
lateron.

This also will be useful for the Intuos Pro support
2018-02-09 10:39:18 +01:00
Peter Hutterer b5e6ad6559 wacom: make room for a more diverse register_device
Fold register_connection into register_device and (with comments) handle the
spark and slate here. This makes it easier to handle the Intuos Pro paper
later.
2018-02-09 10:31:37 +01:00
Peter Hutterer b45977c2d2 wacom: fix typo 2018-02-09 10:31:37 +01:00
Peter Hutterer bc95a0b414 wacom: prettify a debug message 2018-02-09 10:31:37 +01:00
Peter Hutterer 654dea6810 wacom: pass the uuid up to the slate's super() constructor 2018-02-09 10:31:37 +01:00
Peter Hutterer ae41b23c10 ble: don't make property updates exclusive
A single event may be sent for multiple properties, we need to check all of
them.
2018-02-09 10:28:43 +01:00
Benjamin Tissoires c2bba6bd43 wacom: move protocol instantiation into a class
During the first attempt to register, we might not know before hand
the protocol of the device. Have a special class for it, and then
instantiate the correct protocol before continuing.

This makes the 'Protocol' entry in the config file mandatory
2018-02-09 13:31:11 +10:00
Benjamin Tissoires 59db1a28ae wacom: make the slate a subclass of the spark
The Slate is more recent than the Spark. We better have the Spark as a
base class that we will never touch again and make the Slate depend on it.

When adding the Intuos Paper, we should make it a subclass of the Slate,
as the 2 protocols are similar.
2018-02-09 13:31:11 +10:00
Benjamin Tissoires f6e7c72d9d wacom: Split out the Nordic communication protocol in its own class
So the low level bits are not in the same class than the protocols
2018-02-09 13:31:11 +10:00
Peter Hutterer 82e7dbf515 wacom: remove the Spark's 0xb3 opcode from register_connection
This is handled in the subclass now
2018-02-09 13:31:11 +10:00
Benjamin Tissoires d62a97a8cd wacom: have subclasses to distinguish between protocols
The Intuos Pro Paper is close enough to the Slate but with some
subtleties. Instead of having a bunch of ifs, let's have nice subclasses
for the differences in the protocol.
2018-02-09 13:31:11 +10:00
Benjamin Tissoires 1f843b1434 wacom: split out the low level protocol from the interface with Tuhi
We are already handling 2 protocols, one for the Spark, and one for
the Slate. That's one too many, and given that there are some subtleties
in the Intuos Pro Paper (see #56), we better start splitting the protocol
from the interface, so we can have different protocols for different
devices instead of having a bunch of 'ifs'
2018-02-09 13:31:11 +10:00
Benjamin Tissoires 4b494917b1 wacom: load the protocol of the device from the config file
We can store this once for all, which will allow to keep the logic
of detecting the protocol while registering only
2018-02-09 13:31:11 +10:00
Benjamin Tissoires ecd99ea9b6 config: store the protocol used by the device in the config file
Instead of having to detect the protocol multiple times, we should just
store it once so we can detect oddities when they arrive.
2018-02-09 13:31:11 +10:00
Peter Hutterer 8f2ad50fa5 base: allow for multiple company IDs
The Intuos Paper uses a different one, because of course it does.
The 'company ID' from the Paper will be added while adding support for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-09 13:31:11 +10:00
Peter Hutterer 7f230859fe wacom: don't save the current time
This is a write-only value. And for read_time() if we want to compare
timestamps we can just do so with time.time()
2018-02-09 13:31:11 +10:00
Benjamin Tissoires f684a0efb3 wacom: decipher 0xbb command
It's just the name of the device :)
2018-02-09 13:31:11 +10:00
Peter Hutterer 112b689bf8 wacom: drop Orientation from the Tuhi daemon
This isn't something we need in the daemon, it depends too much on what the
client expects so let the client save this data and handle the rotation
accordingly.

Note that the sensor in Sparks and Slates is in landscape format, i.e. every
picture is 90 deg rotated from what you'd expect.

Fixes #33 (wontfix)
2018-02-09 13:31:11 +10:00
Peter Hutterer ad145cc078 base: require Python 3.6
Instead of failing with a syntax error on format strings, actually bail out
instead. Likewise for setup.py, require 3.6 and add this to the classifiers
too while we're there.

Related to #71
2018-02-07 09:18:11 +01:00
Benjamin Tissoires 00fbff37ab dbus: fix signal name exported in the dbus introspection
We are using ListeningStopped, not ListenComplete
2018-02-06 15:17:27 +01:00
Peter Hutterer 5e82d1b378 Rename "pair" to "register"
"pair" is alrady taken by Bluetooth and since we have a bluetooth device here,
it can cause confusion. Use "register" instead, with an explanation in the
README for the more paranoid of us.

Fixes #67
2018-02-02 09:23:08 +01:00
Benjamin Tissoires fc219e4c57 janitor: silence deprecated warnings
While running the app in flatpak, there are a few deprecation warnings
coming in:
PyGIDeprecationWarning: GObject.SIGNAL_RUN_FIRST is deprecated;
	use GObject.SignalFlags.RUN_FIRST instead
PyGIDeprecationWarning: GObject.property is deprecated;
	use GObject.Property instead
PyGIDeprecationWarning: GObject.MainLoop is deprecated;
	use GLib.MainLoop instead
2018-02-02 10:46:47 +10:00
Benjamin Tissoires 3f75c927dc tuhi: do not stop discovering if search is on
If a client requested both listen and search, on listen off on the device,
the discovery was stopped too which lead to some unbalanced state in
the client.
2018-02-02 08:13:30 +10:00
Peter Hutterer 31e1f2ad3b Export the Bluez device's object path
Rather than proxying all metadata (name, address, ...) add a reference to the
bluez device instead.

Fixes #60
2018-02-01 10:13:39 +10:00
Peter Hutterer 9cecc1b535 Replace @property with @GObject.property
Let's stick to just one for consistency
2018-02-01 10:13:22 +10:00
Peter Hutterer 2a3b32a4fe base: update the battery state to unknown after 5 minutes
If we don't get battery updates for too long, we don't really know anymore
what the battery is like.

Fixes #47
2018-01-31 06:48:59 +01:00
Peter Hutterer 1a25163733 config: purge all but the last 10 drawings from the config storage directory
Tuhi is not a permanent storage for drawings, this needs to be handled by the
client(s). To make sure no-one is tempted to use it as permanent storage,
always delete all but the last 10 drawings on startup.

Fixes #45
2018-01-31 06:47:18 +01:00
Peter Hutterer 83852701ec config: use os.path.join on the entry directly 2018-01-31 06:47:18 +01:00
Peter Hutterer 47f7ec104a base: remove leftover debug statement 2018-01-31 11:40:07 +10:00
Benjamin Tissoires 2c8c517c71 wacom: strip out first char of firmwares
The first char is the request, so it should be filtered out to match the
display of Inkspace
2018-01-31 10:21:57 +10:00
Benjamin Tissoires ffd052921a wacom: check for is_spark instead of is_slate
Spark is the past, Slate is the future.
Spark seems to have its own protocol, while the Slate and the Folio are
supposed to have the same firmware. We should probably make Spark the
exception than the other way around.
2018-01-31 10:21:57 +10:00
Benjamin Tissoires 34e08db150 wacom: better differentiate the Slate from the Spark
Relying on the name is a bad idea because:
- the Wacom Inkspace app asks the user to change the name of the device
  on pairing
- the FW should be slightly the same between generations (Folio and Slate
  vs Intuos Pro Paper edition vs Spark)

It appears the Spark doesn't have the "Mysterious characteristics"
mentioned here. And this characteristics seems to send a wacom-like
protocol when pairing to the device or from time to time.

Attempt to differentiate between the Spark and the rest based on that
so we can hope to support the Folio too, and maybe the Intuos Pro Paper
Edition.
2018-01-31 10:21:57 +10:00
Peter Hutterer e647e20426 Export the battery level/charge state 2018-01-30 18:53:55 +10:00
Benjamin Tissoires 9f118bbe15 janitor: convert double quotes into single quotes
Let's the developers of tuhi to consume more energy in their monitor
to light up more pixel when displaying single quotes whereas double
quotes.

It also makes the whole bit more uniform.

Fixes #32
2018-01-29 21:18:06 +10:00
Benjamin Tissoires 04f25a0a38 drop .format(), switch to f{} everywhere
and change some double quotes into single quotes when encountering them.

It's a new project, so force use of Python 3.6 right now

Fixes #29
2018-01-29 21:18:06 +10:00
Peter Hutterer 6ad3851afd wacom: set the device time to UTC time on pairing
And let us handle the local time zone conversions in the client, because
having timestamps in localtime in the daemon is confusing and error-prone (how
is the client supposed to know what localtime was?)
2018-01-29 09:44:50 +01:00
Benjamin Tissoires 56be286d68 tuhi: fix cold plug of devices last seen in pairing mode
fix ca82af78de ("tuhi: handle cold-plugged devices").

The point of deciding whether a device was in the pairing mode was actually
ignored when building the list of available devices.
2018-01-29 09:14:41 +01:00
Peter Hutterer ab385bd981 dbus: update the listening property, not the internal variable
Otherwise the PropertiesChanged never gets sent
2018-01-25 16:02:34 +10:00
Peter Hutterer 3bc88bbbb6 config: store/load device drawing in the device's directory 2018-01-25 14:55:10 +10:00
Peter Hutterer 7a31a994fb dbus: return the drawings as array of timestamps
As we're planning to cache the data locally, the timestamps are a
unique-enough way that makes it possible to access a specific drawing.
And this way we can also delete some drawings without all other indices
shifting around.

Fixes #16
2018-01-25 14:55:10 +10:00
Peter Hutterer 80d214c78f Split the Drawing class out into a separate module
No point having multiple implementations of what a drawing is. Let's have it
in one module.
2018-01-25 14:55:10 +10:00
Peter Hutterer 3d516530c6 wacom: throw the exception (if any) to the "done" handler
Attach an errno to all exceptions, so we can bubble that up to the client
and display a message.

Fixes #24
2018-01-25 14:55:10 +10:00
Peter Hutterer bf3842c150 wacom: use a different logger for the firmware communication
This makes it easier to grep for the raw communication with the device.

Fixes #28
2018-01-25 13:42:01 +10:00
Peter Hutterer 2fd781974f dbus: pass the bus name lost signal up to tuhi
If we're losing the bus name (i.e. we can't get it on startup) there really
isn't much we can do other than fail miserably. But in passing signals around
we can't do exceptions, so we have to move the mainloop to Tuhi so we can
quit() it on error.

Fixes #25
2018-01-25 09:18:59 +10:00
Peter Hutterer cae296e030 dbus: don't unset the searching client until we received the signal from tuhi
The API requires us to send the signal after stop
2018-01-25 09:18:59 +10:00
Peter Hutterer 1e31e6cba7 dbus: add a helper for sending signals 2018-01-25 09:18:59 +10:00
Peter Hutterer ba7c62fc0c dbus: add helper for properties changed signal 2018-01-25 09:18:47 +10:00
Peter Hutterer 584925a0d9 dbus: add a DBus base object
Currently just handling some properties that are common, but will do other
things soon.
2018-01-24 21:40:42 +10:00
Peter Hutterer 1a6071b93d dbus: use self.objpath instead of the hardcoded BASE_PATH in the manager 2018-01-24 21:39:56 +10:00
Peter Hutterer fc8f0f6716 __init__: remove empty line that snuck in during rebasing 2018-01-24 21:39:56 +10:00
Peter Hutterer 8bb971cdcd tuhi: don't use a timeout for searching
We track the searching client now, so the timeout is no longer required
2018-01-24 19:25:00 +10:00
Peter Hutterer cfa4aca2df dbus: limit StartSearch to one client only
Basically copied from the device's Listening approach.

While it's possible to have multiple clients searching at the same time it's a
niche case and the effort at fixing the race conditions that come from that is
likely not worth the effort.

Let's add multiple simultaneous clients when we have a real need for it.
2018-01-24 19:23:20 +10:00
Peter Hutterer cce63d267b dbus: stop discovery when the searching client disappears
This is the single-client version only, we can deal with multiple clients
later.

Fixes #21
2018-01-24 19:23:20 +10:00
Peter Hutterer eb5efd2e1c tuhi: move everything to base.py
Let tuhi.py just be the script that calls main. This way we're somewhat
setup.py compatible.
2018-01-24 19:08:12 +10:00
Peter Hutterer 5e32dc4872 dbus: don't update self.paired unless it changes
TuhDevice.paired is set on every device update (RSSI changes!) and that sends
a GObject.notify() for the property. Filter those, otherwise
we're just spamming dbus with PropertiesChanged notify events even
though nothing has actually changed.
2018-01-23 14:57:00 +10:00
Peter Hutterer 7aa4314c3d wacom: use .format instead of hex to generate the timestring
hex() skips leading zeroes, so 180123 turns into 18, 12, 3
2018-01-23 14:44:01 +10:00
Peter Hutterer 44a2d5e8eb ble: if we connect twice, log the error as debug
We likely get multiple 'udpated' notifications as the RSSI property changes,
all causing a Connect() on the device and an ugly error message (that we used
to catch and print). Make that error message prettier.
2018-01-23 14:22:33 +10:00
Peter Hutterer f9ba9fe6ca ble: don't crash if a device doesn't have a Name attribute
Hello, tradies next door with your weird phones...
2018-01-23 14:22:33 +10:00
Peter Hutterer 63ba0462ea dbus: send out PropertiesChanged when we update the drawings 2018-01-23 14:22:33 +10:00
Benjamin Tissoires ca82af78de tuhi: handle cold-plugged devices
When bluez restarts (or the tuhi daemon restarts), the values we have
in the bluez device's field ManufacturerData are quite not accurate.

When bluez restarts they are empty, and if the last time we saw the
device was for the pairing process, the device will still be marked
as in the pairing mode.

So we should mark the cold-plug sequence differently from the hot-plug
one, and we should be more confident in the current configuration we
have stored to export the currently known devices over dbus.

Fixes #13
2018-01-23 14:22:33 +10:00
Benjamin Tissoires ea890958d6 Start discovery mode when one device requests it
We need to check when the discovery stops (timeout from StartSearch)
if we should keep the discover one or not.
2018-01-23 14:22:33 +10:00
Benjamin Tissoires a51663342f dbus: keep track of the senders of the StartListening() method
If the sender disappear, we should stop listening for incoming events.

We match the Start/StopListening() that way, but if a client forgets
to call StopListening() before leaving and some data are being retrieved,
it's not our problem.
2018-01-23 14:22:33 +10:00
Benjamin Tissoires e3fff4015a implement a basic Start/StopListening
This implements the ListeningStopped signal (especially the EAGAIN if we're
already listening) but does not yet actually trigger the listening on the
device.

There is still no timeout, and no signal gets emitted.
The current way of testing this is:
- call StartListening() on the DBus device
- start discovery on the adapter by some other mean
- press the button on the device -> the sync will happen
- call StopDiscovery()
- press the button on the device -> the sync will *not* happen
2018-01-23 14:22:33 +10:00
Peter Hutterer 010c651d6f dbus: add a __repr__ for the TuhiDBusDevice
And remove a now obsolete debugging statement, this was just put there to
debug the PropertyChanged code
2018-01-23 14:22:33 +10:00
Peter Hutterer d3192dc070 dbus: Send out a PropertyChanged event when a device is paired
Just updating the array isn't enough, we need to bubble up the property
change and then manually send the PropertyChanged event
2018-01-22 17:14:37 +10:00
Peter Hutterer daac6e6d96 dbus: drop the "paired" flag from create_device
We can get this from the device now
2018-01-22 17:14:37 +10:00
Peter Hutterer 645c7577fe config: use uppercase 'UUID' in debug message 2018-01-22 17:14:37 +10:00
Peter Hutterer a2fd3cd8d1 dbus: on StartSearch(), emit PairableDevice signals for already known devices
If we created a device before StartSearch was called, we need to manually
send the signal to make sure the client sees it.
2018-01-22 15:25:34 +10:00
Peter Hutterer 0b7f756ba0 dbus: add the device's Address to the introspection XML
Code was already there, but the XML was missing the address
2018-01-22 15:24:56 +10:00
Benjamin Tissoires 3e5ef6c939 ble: remove the duplicate events filter
So we get more chances of capturing the advertisement from the device
if it is rather static.
2018-01-22 15:24:56 +10:00
Benjamin Tissoires 380518d0c7 ble: keep track of Start/StopDiscovery
discovery-stopped may call stop_discovery() if there
is no client listening, resulting in an infinite loop
2018-01-22 15:24:26 +10:00
Benjamin Tissoires f6d09d7086 dbus: fix timeout error if the index is invalid
If the index is not valid, a python exception was raised, and the dbus
message was left without and answer.

Coincidentally, this matches the documentation
2018-01-20 12:37:50 +10:00
Benjamin Tissoires 1b73de68b2 config: make sure we create the config file properly
I guess this code was tested with an existing config file only, because
I have the following:

DEBUG: tuhi.config: E0:61:C6:BF:14:4E: adding new config, uuid 8bbc6be4347a
Traceback (most recent call last):
  File "./tuhi.py", line 153, in _on_uuid_updated
    self.config.new_device(bluez_device.address, wacom_device.uuid)
  File "tuhi/tuhi/config.py", line 89, in new_device
    config['Device']['Address'] = address
  File "/usr/lib64/python3.6/configparser.py", line 959, in __getitem__
    raise KeyError(key)
KeyError: 'Device'
2018-01-20 12:37:50 +10:00
Peter Hutterer 4ee07a18b6 Hook up UUID changes to be written in the config file
Make the uuid property a GObject.Property so we can listen to it. Notify about
the uuid change at the end of the pairing process, then write that value into
the device's config file.
2018-01-19 16:17:44 +10:00
Peter Hutterer 8e50421f2e wacom: generate the uuid on pairing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-19 16:17:44 +10:00
Peter Hutterer 76449bf608 config: add a basic storage backend
$XDG_DATA_HOME/tuhi/<mac address>/settings.ini

And that file contains a [Device] section with two entries, address and uuid.
2018-01-19 16:17:44 +10:00
Peter Hutterer 5f9766cb71 ble: catch and ignore the InProgress error when we're already listening 2018-01-19 13:45:32 +10:00
Peter Hutterer d4405cc1ef Hook up a ButtonPressRequired signal
When the nordic communication requires us to notify the user to press the
button, emit a signal and pass that up.
2018-01-19 13:40:26 +10:00
Peter Hutterer aa1a5e6689 Revamp the pairing process and rename to Search
The previous process had a problem: the device object didn't exist until after
pairing was complete. But to pair we need some user interaction (press button
on device) and thus the ability to send notifications from the device to the
dbus client at the right time. This wasn't possible with the previous
approach.

The new approach:
* renames Start/StopPairing to Start/StopSearch to indicate we're just
  searching, not pairing in the manager
* creates a org.freedesktop.tuhi1.Device object when a suitable device is
  found. That object is not in Manager.Devices, it's "hidden" unless you know
  the object path.
* Sends a PairableDevice signal with the new device's object path
* Requires the client to call Pair() on the device
* If the timeout expires without pairing, the device is removed again
2018-01-19 13:40:26 +10:00
Peter Hutterer f6519016f9 wacom: rename the register* calls to pair* calls
Because that's what we call them everywhere else
2018-01-19 13:40:26 +10:00
Peter Hutterer 81033c3139 wacom: drop the multiple definitions of SMARTPAD_UUID
Let's use deadbeef for now until we have the generation code in place.
2018-01-19 13:40:26 +10:00
Benjamin Tissoires 06e8d69e9d Implement pairing of a new device
This includes the new pairing code for the Spark which is slightly different
to the one from the Slate
2018-01-19 13:40:26 +10:00
Peter Hutterer aa1820e21c Send out the PairableDevice signal when we have a device 2018-01-19 11:15:12 +10:00
Benjamin Tissoires c073ff2f06 ignore Wacom devices that are in pairing mode
When the device is in pairing mode (blinking blue), the manufacturer
data contains less than 7 fields. We should ignore those devices
as we are not supposed to pull pen data out of them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-19 11:08:16 +10:00
Peter Hutterer 43b1c4057c dbus: implement StartPairing/StopPairing on the manager
Triggers a StartDiscovery()/StopDiscovery() on the bluetooth adapters, but
with a fixed timeout of 30s.
2018-01-19 11:07:25 +10:00
Peter Hutterer 5f5ce71aef dbus: properly return from Listen()
If we don't do the dbus dance for returning a value here, we get a timeout
eventually.
2018-01-17 13:41:35 +01:00
Peter Hutterer f9756a71ce Add commandline arguments to enable verbose mode
Create a logger hierarchy, that way we only need to set the root logger to
DEBUG and the rest goes along with it.
2018-01-17 13:41:35 +01:00
Benjamin Tissoires 8a81b1c245 Make sure we retrieve the data atomically
Ignore any requests to sync the device while the previous sync is still
ongoing. This should be the exception anyway, we shouldn't get another
"connected" signal from the device while we're syncing.
2018-01-17 13:41:35 +01:00
Benjamin Tissoires f88a5b2222 wacom: disconnect when we have finished retrieving the data
There is no point keeping the connection alive just to drain the battery.
2018-01-17 13:41:35 +01:00
Peter Hutterer dde2ad4b46 ble: use ServicesResolved for the connected signal 2018-01-17 13:41:35 +01:00
Benjamin Tissoires f30f47d454 wacom: fix from_bytes little/big endianness
Looks like they are all the wrong way but the time_offset one.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-17 13:41:35 +01:00
Peter Hutterer 1841508c33 Pass the timestamps to the json file 2018-01-15 16:15:35 +10:00
Peter Hutterer 3a23610e08 Connect the WacomDevice drawings to the TuhiDrawings
And fixing a few issues with pressure, etc. on the way
2018-01-15 16:15:35 +10:00
Peter Hutterer cf68ebc9ce tuhi: create a TuhiDevice as glue object between front and backends 2018-01-15 16:15:33 +10:00
Peter Hutterer b7ce16fd38 dbus: remove the now-obsolete main() method 2018-01-15 16:14:19 +10:00
Peter Hutterer f293ef6e14 dbus: use the logging class too 2018-01-15 16:14:11 +10:00
Peter Hutterer febde33f0a ble: wrap the DBus properties into property functions 2018-01-15 16:14:11 +10:00
Peter Hutterer 6de262d2e9 ble: more documentation 2018-01-15 16:14:11 +10:00
Peter Hutterer 35e75b4aa7 ble: match the disconnected signal with 'connect'
No need to pass self as argument, it's the first argument to the signal
handler anyway
2018-01-15 16:14:11 +10:00
Peter Hutterer 20b78b89b7 wacom: remove superfluous time.sleep()
Leftover from an earlier debugging process
2018-01-15 16:14:11 +10:00
Peter Hutterer f3a39ee57c ble: remove leftover wacom-specific code 2018-01-15 16:14:11 +10:00
Peter Hutterer 4ec3069f78 ble: add two FIXMEs, we need to handle ServicesResolved
Connected can be True when ServicesResolved is False but without the latter we
can't do anything.
2018-01-15 11:59:57 +10:00
Peter Hutterer e29c201756 ble: remove obsolete comment
Filtering is done a layer above now
2018-01-15 11:50:52 +10:00
Peter Hutterer 5336f02df1 wacom: use int.from_bytes to convert from signed char to int 2018-01-15 11:34:46 +10:00
Peter Hutterer 1527fae191 wacom: replace the list2le/be helpers with int.from_bytes 2018-01-15 11:34:46 +10:00
Peter Hutterer c64446b48c ble: drop unused objectpath variable 2018-01-15 11:34:46 +10:00
Peter Hutterer c4b0807c3c dbusserver: emit the bus-name-owned when we have the bus
And rename from 'owned' to 'acquired', that's better english
2018-01-15 09:14:29 +10:00
Benjamin Tissoires 0d88d9d0e7 ble: fix flake8 warnings
./tuhi/ble.py:14:1: F401 'sys' imported but unused
./tuhi/ble.py:15:1: F401 'enum.Enum' imported but unused
./tuhi/ble.py:16:1: F401 'gi.repository.GLib' imported but unused
./tuhi/ble.py:26:1: E302 expected 2 blank lines, found 1
./tuhi/ble.py:81:1: W293 blank line contains whitespace
./tuhi/ble.py:84:13: E126 continuation line over-indented for hanging indent
./tuhi/ble.py:85:17: E131 continuation line unaligned for hanging indent
./tuhi/ble.py:203:39: F821 undefined name 'WACOM_CHRC_LIVE_PEN_DATA_UUID'
./tuhi/ble.py:204:38: E128 continuation line under-indented for visual indent
./tuhi/ble.py:205:39: F821 undefined name 'WACOM_OFFLINE_CHRC_PEN_DATA_UUID'
./tuhi/ble.py:206:38: E128 continuation line under-indented for visual indent
./tuhi/ble.py:207:39: F821 undefined name 'NORDIC_UART_CHRC_RX_UUID'
./tuhi/ble.py:208:38: E128 continuation line under-indented for visual indent
./tuhi/ble.py:232:1: E302 expected 2 blank lines, found 1
./tuhi/ble.py:240:13: E126 continuation line over-indented for hanging indent
./tuhi/ble.py:241:17: E131 continuation line unaligned for hanging indent
./tuhi/ble.py:250:21: E126 continuation line over-indented for hanging indent
./tuhi/ble.py:263:43: W291 trailing whitespace
./tuhi/ble.py:272:72: W291 trailing whitespace
./tuhi/ble.py:310:1: W391 blank line at end of file

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 20:23:47 +01:00
Benjamin Tissoires af42bc1b27 dbusserver.py: fix flake8 warnings
./tuhi/dbusserver.py:55:1: E302 expected 2 blank lines, found 1
./tuhi/dbusserver.py:75:17: E126 continuation line over-indented for hanging indent
./tuhi/dbusserver.py:77:29: E203 whitespace before ':'
./tuhi/dbusserver.py:155:13: E126 continuation line over-indented for hanging indent
./tuhi/dbusserver.py:156:17: E131 continuation line unaligned for hanging indent

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 20:23:47 +01:00
Benjamin Tissoires 3491ff68e4 wacom: fix flake8 warnings
tuhi/wacom.py:18:1: F401 'sys' imported but unused
tuhi/wacom.py:22:1: F401 'tuhi.dbusserver.TuhiDBusServer' imported but unused
tuhi/wacom.py:23:1: F401 'tuhi.ble.BlueZDeviceManager' imported but unused
tuhi/wacom.py:52:1: E302 expected 2 blank lines, found 1
tuhi/wacom.py:140:13: E126 continuation line over-indented for hanging indent
tuhi/wacom.py:141:17: E131 continuation line unaligned for hanging indent
tuhi/wacom.py:592:1: W391 blank line at end of file

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 20:23:47 +01:00
Benjamin Tissoires 79a95bbe18 Handle tablet orientation
It didn't make quite sense to have y before x, and with some inverted
x value. The sensors are designed in the landscape mode, and the rotation
needs to be determined in the software.
Implement an orientation parameter to WacomDevice so we always have
normal X and Y

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 20:23:47 +01:00
Benjamin Tissoires bbeca669e2 wacom: turn back the log lines to be greater than 79 chars
It's better to have a full log on one line. However, flake8 now complains.
I am not that happy with this situation, we should figure out a way
to selectively disable the length check for logger messages only.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 20:23:47 +01:00
Benjamin Tissoires 7437cb6f93 wacom: opcode 0xeeff is the time since boot
This is an actual timestamp

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 20:23:47 +01:00
Benjamin Tissoires b49225c890 wacom: add helpers for big/little endian conversions
There is for sure some standard ones, but this will fit in the meantime.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 19:50:23 +01:00
Benjamin Tissoires bbded4f558 wacom: fix slate logging
leftover from a conversion

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-01-12 19:42:55 +01:00
Peter Hutterer 4aca12b6e7 Add the signals to expose the device over Tuhi's DBus interface
bus_own_name is asynchronous, so we first need to send a signal back and then
we can start connecting to the devices. Otherwise we'll have to implement a
queue which would be a lot harder than just waiting.
2018-01-12 20:32:09 +10:00
Peter Hutterer 8e907ba81a wacom: notify via signal when a drawing is available 2018-01-12 16:18:40 +10:00
Peter Hutterer 723282eb56 wacom: make the stroke object more generic, less SVG 2018-01-12 16:18:20 +10:00
Peter Hutterer d214778a1c Add the wacom nordic communication bits
Mostly copy/paste from an earlier project. Needs some more cleanup for
integration with Tuhi
2018-01-12 16:11:00 +10:00