mirror of
https://github.com/gryf/linak-ctrl.git
synced 2026-04-25 16:01:31 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 32b49bd278 | |||
| 9a33f742e1 |
+28
@@ -2,6 +2,9 @@
|
|||||||
Linak-ctrl
|
Linak-ctrl
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
.. image:: https://badge.fury.io/py/linak-ctrl.svg
|
||||||
|
:target: https://badge.fury.io/py/linak-ctrl
|
||||||
|
|
||||||
Simple python script to control Linak powered desks and USB2LIN06 cable.
|
Simple python script to control Linak powered desks and USB2LIN06 cable.
|
||||||
|
|
||||||
|
|
||||||
@@ -14,6 +17,31 @@ Requirements
|
|||||||
* `pyusb`_
|
* `pyusb`_
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
There are couple of different ways for installing ``linak-ctrl``. One of the
|
||||||
|
preferred ways is to use virtualenv and pip:
|
||||||
|
|
||||||
|
.. code:: shell-session
|
||||||
|
|
||||||
|
$ git clone https://github.com/gryf/linak-ctrl
|
||||||
|
$ cd linak-ctrl
|
||||||
|
linak-ctrl $ python -m venv linak
|
||||||
|
(linak) linak-ctrl $ pip install .
|
||||||
|
(linak) linak-ctrl $ linak-ctrl status
|
||||||
|
Position: 767, height: 78.80cm, moving: False
|
||||||
|
|
||||||
|
Or, you can install it system-wide:
|
||||||
|
|
||||||
|
.. code:: shell-session
|
||||||
|
|
||||||
|
$ sudo pip install linak-ctrl
|
||||||
|
|
||||||
|
And finally, you could also install dependences from your system repositories,
|
||||||
|
and use script directly, by placing it somewhere in your ``$PATH``.
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -111,6 +111,10 @@ class LinakDevice:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dev = usb.core.find(idVendor=LinakDevice.VEND,
|
self._dev = usb.core.find(idVendor=LinakDevice.VEND,
|
||||||
idProduct=LinakDevice.PROD)
|
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
|
# detach kernel driver, if attached
|
||||||
if self._dev.is_kernel_driver_active(0):
|
if self._dev.is_kernel_driver_active(0):
|
||||||
@@ -188,7 +192,11 @@ class LinakDevice:
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
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 '
|
parser = argparse.ArgumentParser('An utility to interact with USB2LIN06 '
|
||||||
'device.')
|
'device.')
|
||||||
|
|||||||
Reference in New Issue
Block a user