Commit Graph

642 Commits (16b0f9d2d57f65cfe3b434eb8f183c052522e074)

Author SHA1 Message Date
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 285c7991bc tuhi: fix reconnection of the WacomDevice
Previously we created a new instance on every connected signal. We should
instead create the device once and then just re-start the sync process when
we get the connected data.
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 2e716f2278 README: Bamboo Spark notes on how to get the connection dance happening
This device behaves differently depending on whether drawings are available or
not. Spell it out.
2018-01-15 11:24:17 +10:00
Peter Hutterer 8fa2f3503c README: three backticks is enough for code formatting 2018-01-15 11:20:58 +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 d20e2b70ad tuhi: fix flake8 warning
./tuhi.py:68:5: F841 local variable 't' is assigned to but never used

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 ffcad95337 README: format a bit better for readability 2018-01-12 20:37:22 +10: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
Peter Hutterer bf2c000b57 Add a BLE abstraction layer 2018-01-12 16:00:24 +10:00
Peter Hutterer 89cf8ef67d Add the basic DBus server implementation 2018-01-12 07:46:06 +10:00
Peter Hutterer ea91eef4bc Add initial README for Tuhi 2018-01-12 07:45:56 +10:00