1
0
mirror of https://github.com/gryf/linak-ctrl.git synced 2026-04-26 00:11:30 +02:00

3 Commits

Author SHA1 Message Date
gryf 13d2f008ad Make the package instead of bare module. 2022-04-13 17:39:43 +02:00
gryf 8793e55695 Fix typo in the url. 2022-04-08 18:20:03 +02:00
gryf 32b49bd278 Cover case when no device has been found. 2021-07-29 19:31:21 +02:00
2 changed files with 11 additions and 2 deletions
+9 -1
View File
@@ -111,6 +111,10 @@ class LinakDevice:
def __init__(self):
self._dev = usb.core.find(idVendor=LinakDevice.VEND,
idProduct=LinakDevice.PROD)
if not self._dev:
raise ValueError(f'Device {LinakDevice.VEND}:'
f'{LinakDevice.PROD:04d} '
f'not found!')
# detach kernel driver, if attached
if self._dev.is_kernel_driver_active(0):
@@ -188,7 +192,11 @@ class LinakDevice:
def main():
device = LinakDevice()
try:
device = LinakDevice()
except ValueError as ex:
sys.stderr.write(ex.args[0] + '\n')
sys.exit(1)
parser = argparse.ArgumentParser('An utility to interact with USB2LIN06 '
'device.')
+2 -1
View File
@@ -4,7 +4,7 @@ summary = Control Linak powered desks using USB2LIN06 cable.
description-file = README.rst
author = Roman Dobosz
author-email = gryf73@gmail.com
home-page = https://gihtub.com/gryf/linak-ctrl
home-page = https://github.com/gryf/linak-ctrl
license = BSD
classifier =
Development Status :: 5 - Production/Stable
@@ -27,6 +27,7 @@ console_scripts =
linak-ctrl= linak_ctrl:main
[options]
packages = find:
install_requires =
pyusb