Commit Graph

85 Commits

Author SHA1 Message Date
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 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 8cf85c3e5d Fix a few typos 2019-07-11 08:52:22 +10:00
Benjamin Tissoires 594297f7fb kete: fix typo
s/stoke_width/stroke_width/
2019-04-29 09:38:02 +02:00
Benjamin Tissoires 359502b134 kete: various flake8 fixes
>$ flake8 --ignore=E501,W504 tools
tools/kete.py:35:1: E302 expected 2 blank lines, found 1
tools/kete.py:553:12: E713 test for membership should be 'not in'
tools/kete.py:599:42: E226 missing whitespace around arithmetic operator
tools/kete.py:599:61: E226 missing whitespace around arithmetic operator
tools/kete.py:615:25: E226 missing whitespace around arithmetic operator
tools/kete.py:615:32: E226 missing whitespace around arithmetic operator
tools/kete.py:624:49: E225 missing whitespace around operator
tools/kete.py:871:9: F841 local variable 'e' is assigned to but never used
2019-04-29 09:36:11 +02:00
Benjamin Tissoires 146b480a84 kete: add more documentation for the default settings.ini 2019-04-29 09:36:11 +02:00
Ishak BELAHMAR a1ed978db9 kete: Handle variable stroke pressure
This is a first implementation of variable stroke pressure. It is based
on a set of individual-width-variable strokes. The ideal implementation
should convert the variable-stroke-width path into an outlined shape.
2019-04-23 11:31:05 +02:00
Ishak BELAHMAR b10ede69c4 kete: Read tablet orientation from settings.ini 2019-04-23 11:31:05 +02:00
Ishak BELAHMAR 7cd269b092 kete: Normalize SVG dimensions (increase viewer compatibility) 2019-04-23 11:31:05 +02:00
Benjamin Tissoires 83d669c059 kete-sandboxed: fix tuhi-kete import path
fixes e4e0a3b ("kete: rename the script from tuhi-kete.py to kete.py")

When renaming tuhi-kete into kete, we forgot to also update
tuhi-kete-sandboxed.py.
2018-03-06 10:02:23 +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
Peter Hutterer e0949a2a5e kete: rename indices/index to timestamp
That's what it is, it hasn't been an index for a while now.
2018-02-19 10:50:41 +10:00
Peter Hutterer d0001e18ed tools: chmod +x on tuhi-live 2018-02-14 16:25:56 +10:00
Benjamin Tissoires 99a2f7bdc5 kete: parse incoming uhid data 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 fec265cb68 live: add a script to run as root that enable live mode
we want to be able to open uhid, so we need root access.
Root access is bad, so we fork the process, and then immediately drop
the privileges to talk to the dbus dameon (or to create one).
2018-02-14 06:23:25 +10:00
Benjamin Tissoires 3eca8da251 kete: add live debugging mode
Just start/stop live mode, the debug happens in the tuhi process.

That's enough until we figure out the DBus API if we need one
2018-02-14 06:23:25 +10:00
Benjamin Tissoires 41a3c85b59 kete: export the connected state of the bluez device to the tuhiketedevice
We need this in the live mode as the connection will be longer than
the usual retrieval of the data.
2018-02-14 06:23:25 +10:00
Benjamin Tissoires e4e0a3b8aa kete: rename the script from tuhi-kete.py to kete.py
Python doesn't really like minus signs in file names, especially
when you start importing the modules. Rename kete from tuhi-kete.py
to kete.py so it makes it easier to have other scripts in the tools
folder to borrow code from kete.
2018-02-14 06:23:25 +10:00
Benjamin Tissoires 590de68269 kete: make Searcher and Listener symmetrical regarding logs
The 'searching' notification was only emitted when it goes to stop, which
means we do not get notifications when it starts.
This makes SearchStopped signal redundant for the generic case, but allows
to get notifications if the search failed to start.

Rest is just making sure we have the same handling of events in Listener
and Searcher.
2018-02-13 14:51:40 +01:00
Benjamin Tissoires d8808e144f kete: better handling of clean up of connection/disconnection of signals
If stop() is called more than once, we might try to disconnect the
signals more than once, which raises some errors.
Better having one central place that handles the disconnect properly.
2018-02-13 14:51:40 +01:00
Peter Hutterer 58220efe31 kete: don't assume all devices are unregistered when searching
Instead, wait for the signal from tuhi and then go for it.

Fixes #80
2018-02-13 14:51:40 +01:00
Peter Hutterer 94bc52efb6 kete: if listening/searching is stopped by the daemon, clean up after us 2018-02-13 14:49:39 +01:00
Benjamin Tissoires abfb0db6a8 kete: catch the ServiceUnknown exception in TuhiKeteDevice
This allows to have more symmetrical handling of the Searcher and
the Listener
2018-02-13 14:49:17 +01:00
Benjamin Tissoires c86c318d6b kete: rename the history file to be histfile
for googleability, as being said
2018-02-07 09:15:59 +01:00
Benjamin Tissoires e63785b5b2 kete: persistent history
We write the history immediately after receiving a new command,
just in case something bad happens.

Fixes #54
2018-02-07 09:38:31 +10:00
Benjamin Tissoires 9829fa6822 flatpak: ship tuhi-kete in the sandbox
To be able to run tuhi-kete, we need a tuhi server running. Provide a
script that spawns one if none is running.

Running simple 'python3 setup.py --install' started to go havoc by
complaining that /app/lib/python3.6/site-packages/easy-install.pth
was read-only.

The solution mentioned in https://github.com/flatpak/flatpak-builder/issues/5
didn't do the trick.

So using https://stackoverflow.com/questions/6301003/stopping-setup-py-from-installing-as-egg/27175492#27175492
as a trick to install the dependencies without the egg part

To start tuhi-kete:
$> flatpak run --command=tuhi-kete org.freedesktop.tuhi

Note that currently the fetched files are not available outside of the
sandbox

Related to #62
2018-02-06 09:03:47 +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
Peter Hutterer b305d6e287 kete: ignore dbus errors during StopSearch
we may call StopSearch after the daemon vanished and while we're stopping all
the workers. Ignore the ServiceUnknown error here.
2018-02-02 09:56:24 +10:00
Peter Hutterer ddef5ea38a kete: allow 'help' even when not connected 2018-02-02 08:55:48 +10:00
Peter Hutterer 02e8cf53ce kete: while disconnected, print a message to that effect
$> ./tools/tuhi-kete.py
Tuhi shell control
WARNING: Tuhi daemon not running
tuhi> list
Not connected to the Tuhi daemon

Better than just a noop
2018-02-02 08:55:13 +10:00
Peter Hutterer 1f93db6ca0 kete: improve some messaging
In the normal mode (without -v) we'd see the errors, but not the messages when
we reconnect. Elevate the "connected to" message to info so it shows up.

And slight rewording, which may or may not be better.
2018-02-02 08:27:23 +10:00
Benjamin Tissoires 3e444d6a0c kete: make the shell survive the disappearing of the daemon
We need to move the mainloop in the Shell as we need to watch on the
name there.

Fixes #55
2018-02-02 08:13:30 +10:00
Benjamin Tissoires 277523c7d5 kete: stop listening when pairing a device
Or the internal state of kete is that the device is listening while
tuhi says it is not.
2018-02-02 08:13:30 +10:00
Benjamin Tissoires db2f37c561 kete: do_fetch: do not remember the worker
There is no stop() method attached to Fetcher, so we don't really need
to remember we called it once to call a NOOP
2018-02-02 08:13:30 +10:00
Benjamin Tissoires 5368e49f5d kete: rename 'list' command into 'devices'
'list' and 'listen' are just too close to each other, meaning the
completion stops at 'list' while the lazy developer/tester want to
do a 'listen'.

Change the name of the less used command so we have separate spaces
for completion
2018-02-02 08:13:30 +10:00
Benjamin Tissoires 0c829754cd tools: add the parse_log script we used to dump the raw btsnoop logs
Better keep this in a public place where it won't vanish from our disks.
Note that this is a python 2 script (because btsnoop), and it should not
be part of the installation, ever.
2018-02-02 08:00:41 +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
Benjamin Tissoires 501c891a12 kete: bubble up the dbus vanished errors
Not much is done for now, but the shell is notified, which is a big step
2018-01-31 17:03:25 +01:00
Benjamin Tissoires 9b18339890 kete: remove pointless indirection class Printer
In this case, it's easier to just iterate in the do_list() call than
having a Worker element
2018-01-31 17:03:24 +01:00
Benjamin Tissoires 0bc516b13c kete: do_search: make sure we have only one searcher element
This prevents duplicate signals to be sent when the search stops
2018-01-31 17:03:24 +01:00
Benjamin Tissoires a164ea291e kete: clean up the Searcher class
now that there is no more standalone commands, the Searcher can be striped
off of its interactive bits.
2018-01-31 17:03:13 +01:00
Benjamin Tissoires c2ceba7483 kete: clean up a little bit the Worker class
The Worker subclasses now only need to implement run() and stop().
2018-01-31 16:06:09 +01:00
Benjamin Tissoires e4b0f9768d kete: drop TuhiKeteShellWorker and directly use TuhiKeteShell 2018-01-31 16:06:09 +01:00
Benjamin Tissoires 5757bcfab1 kete: move the mainloop thread into the manager
The manager handles the mainloop, so it's easier if it handles the
attached thread too.
2018-01-31 16:06:09 +01:00
Peter Hutterer 8affec2002 kete: drop the _run/_stop indirection, not necessary 2018-01-31 15:47:29 +01:00
Peter Hutterer dba5ddc60c kete: drop the non-interactive bits from tuhi-kete
Fixes #51
2018-01-31 15:47:29 +01:00
Benjamin Tissoires 5889052fb1 kete: fix log errors when the device is not paired anymore
Tuhi raise -EACCES if the UUID stored is not valid anymore.
Instead of shouting some obscure error, we should notify the
user that a pairing need to happen or the device will not talk
to us.

Also fix a small sign mistake in calling os.strerror() for general
errors

Fixes #6
2018-01-31 10:21:57 +10:00