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>
pull/1/head
Benjamin Tissoires 2018-01-12 20:01:44 +01:00
parent 7437cb6f93
commit bbeca669e2
1 changed files with 7 additions and 15 deletions

View File

@ -196,23 +196,19 @@ class WacomDevice(GObject.Object):
def send_nordic_command(self, command, arguments): def send_nordic_command(self, command, arguments):
chrc = self.device.characteristics[NORDIC_UART_CHRC_TX_UUID] chrc = self.device.characteristics[NORDIC_UART_CHRC_TX_UUID]
data = [command, len(arguments), *arguments] data = [command, len(arguments), *arguments]
logger.debug(f'sending ' + logger.debug(f'sending {command:02x} / {len(arguments):02x} / {list2hex(arguments)}')
f'{command:02x} / {len(arguments):02x} / {list2hex(arguments)}')
chrc.write_value(data) chrc.write_value(data)
def check_nordic_incoming(self): def check_nordic_incoming(self):
if self.nordic_answer is None: if self.nordic_answer is None:
raise WacomTimeoutException(f"{self.name}:" + raise WacomTimeoutException(f"{self.name}: Timeout while reading data")
" Timeout while reading data")
answer = self.nordic_answer answer = self.nordic_answer
self.nordic_answer = None self.nordic_answer = None
length = answer[1] length = answer[1]
args = answer[2:] args = answer[2:]
if length != len(args): if length != len(args):
raise WacomException(f"error while processing answer, should" + raise WacomException(f"error while processing answer, should get an answer of size {length} instead of {len(args)}")
" get an answer of size {length} instead" +
" of {len(args)}")
return NordicData(answer) return NordicData(answer)
def wait_nordic_data(self, expected_opcode, timeout): def wait_nordic_data(self, expected_opcode, timeout):
@ -317,8 +313,7 @@ class WacomDevice(GObject.Object):
arguments=args) arguments=args)
if len(data) != 6: if len(data) != 6:
str_data = binascii.hexlify(bytes(data)) str_data = binascii.hexlify(bytes(data))
raise WacomCorruptDataException(f'unexpected answer for ' + raise WacomCorruptDataException(f'unexpected answer for get_dimensions: {str_data}')
f'get_dimensions: {str_data}')
return list2le(data[2:4]) return list2le(data[2:4])
def ec_command(self): def ec_command(self):
@ -506,8 +501,7 @@ class WacomDevice(GObject.Object):
y += dy y += dy
p += dp p += dp
logger.info(f'point at {x},{y} ({dx:+}, {dy:+}) ' + logger.info(f'point at {x},{y} ({dx:+}, {dy:+}) with pressure {p} ({dp:+})')
f'with pressure {p} ({dp:+})')
if bitmask & 0b00111100 == 0: if bitmask & 0b00111100 == 0:
continue continue
@ -523,8 +517,7 @@ class WacomDevice(GObject.Object):
transaction_count = 0 transaction_count = 0
while self.is_data_available(): while self.is_data_available():
count, timestamp = self.get_stroke_data() count, timestamp = self.get_stroke_data()
logger.info(f"receiving {count} bytes" + logger.info(f"receiving {count} bytes drawn on {time.asctime(timestamp)}")
f" drawn on {time.asctime(timestamp)}")
self.start_reading() self.start_reading()
pen_data = self.wait_for_end_read() pen_data = self.wait_for_end_read()
str_pen = binascii.hexlify(bytes(pen_data)) str_pen = binascii.hexlify(bytes(pen_data))
@ -563,8 +556,7 @@ class WacomDevice(GObject.Object):
if self.read_offline_data() == 0: if self.read_offline_data() == 0:
logger.info("no data to retrieve") logger.info("no data to retrieve")
except WacomEEAGAINException: except WacomEEAGAINException:
logger.warning("no data, please make sure the LED is blue and" + logger.warning("no data, please make sure the LED is blue and the button is pressed to switch it back to green")
"the button is pressed to switch it back to green")
def run(self): def run(self):
time.sleep(2) time.sleep(2)