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.
This commit is contained in:
parent
cf4d5b184e
commit
013de2a6e4
|
@ -619,20 +619,15 @@ class WacomProtocolBase(WacomProtocolLowLevelComm):
|
||||||
arguments=args)
|
arguments=args)
|
||||||
|
|
||||||
def start_live(self, fd):
|
def start_live(self, fd):
|
||||||
w = self.get_dimensions('width')
|
|
||||||
h = self.get_dimensions('height')
|
|
||||||
self.send_nordic_command_sync(command=0xb1,
|
self.send_nordic_command_sync(command=0xb1,
|
||||||
expected_opcode=0xb3)
|
expected_opcode=0xb3)
|
||||||
logger.debug(f'Starting wacom live mode on fd: {fd}')
|
logger.debug(f'Starting wacom live mode on fd: {fd}')
|
||||||
|
|
||||||
rdesc = wacom_live_rdesc_template[:]
|
rdesc = wacom_live_rdesc_template[:]
|
||||||
for i, v in enumerate(rdesc):
|
for i, v in enumerate(rdesc):
|
||||||
if v == 'width':
|
if isinstance(v, str):
|
||||||
rdesc[i] = list(int.to_bytes(w, 4, 'little', signed=True))
|
v = getattr(self, v)
|
||||||
elif v == 'height':
|
rdesc[i] = list(int.to_bytes(v, 4, 'little', signed=True))
|
||||||
rdesc[i] = list(int.to_bytes(h, 4, 'little', signed=True))
|
|
||||||
elif v == 'pressure':
|
|
||||||
rdesc[i] = list(int.to_bytes(self.pressure, 2, 'little', signed=True))
|
|
||||||
|
|
||||||
uhid_device = UHIDDevice(fd)
|
uhid_device = UHIDDevice(fd)
|
||||||
uhid_device.rdesc = list(flatten(rdesc))
|
uhid_device.rdesc = list(flatten(rdesc))
|
||||||
|
|
Loading…
Reference in New Issue