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.
pull/49/head
Benjamin Tissoires 2018-01-30 14:06:29 +01:00 committed by Peter Hutterer
parent 5889052fb1
commit 34e08db150
1 changed files with 9 additions and 1 deletions

View File

@ -35,6 +35,9 @@ WACOM_CHRC_LIVE_PEN_DATA_UUID = '00001524-1212-efde-1523-785feabcd123'
WACOM_OFFLINE_SERVICE_UUID = 'ffee0001-bbaa-9988-7766-554433221100'
WACOM_OFFLINE_CHRC_PEN_DATA_UUID = 'ffee0003-bbaa-9988-7766-554433221100'
MYSTERIOUS_NOTIFICATION_SERVICE_UUID = '3a340720-c572-11e5-86c5-0002a5d5c51b'
MYSTERIOUS_NOTIFICATION_CHRC_UUID = '3a340721-c572-11e5-86c5-0002a5d5c51b'
WACOM_SLATE_WIDTH = 21600
WACOM_SLATE_HEIGHT = 14800
@ -131,6 +134,8 @@ class WacomDevice(GObject.Object):
self._on_pen_data_received)
device.connect_gatt_value(NORDIC_UART_CHRC_RX_UUID,
self._on_nordic_data_received)
device.connect_gatt_value(MYSTERIOUS_NOTIFICATION_CHRC_UUID,
self._on_mysterious_data_received)
@GObject.Property
def uuid(self):
@ -138,7 +143,10 @@ class WacomDevice(GObject.Object):
return self._uuid
def is_slate(self):
return self.name == 'Bamboo Slate'
return MYSTERIOUS_NOTIFICATION_CHRC_UUID in self.device.characteristics
def _on_mysterious_data_received(self, name, value):
self.fw_logger.debug(f'mysterious: {binascii.hexlify(bytes(value))}')
def _on_pen_data_changed(self, name, value):
logger.debug(binascii.hexlify(bytes(value)))