Linak-ctrl
Simple python script to control Linak powered desks and USB2LIN06 cable.
Requirements
Linak desk ;)
USB2LIN06 device
Python
Installation
There are couple of different ways for installing linak-ctrl. One of the preferred ways is to use virtualenv and pip:
$ 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:
$ 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
Currently, script have two available commands: status and move.
Invoking status will give information about desk height - both in absolute number, and in centimeters, and information if desk is moving.
$ linak_ctrl.py status
Position: 767, height: 78.80cm, moving: False
Note, that height was measured manually and may differ depending if desk have casters or regular foots.
Command status accept optional parameter --loop for fetching information from USB2LIN06 device every 0.2 seconds:
$ linak_ctrl.py status -l
Position: 2161, height: 100.25cm, moving: True
Position: 2109, height: 99.45cm, moving: True
Position: 2026, height: 98.17cm, moving: True
Position: 1960, height: 97.15cm, moving: True
Position: 1872, height: 95.80cm, moving: True
Position: 1797, height: 94.65cm, moving: True
Position: 1728, height: 93.58cm, moving: True
Position: 1675, height: 92.77cm, moving: True
Position: 1652, height: 92.42cm, moving: True
Position: 1651, height: 92.40cm, moving: False
Command move is used for adjusting desk height. It needs parameter position, which is absolute number, and its range is between 0 and 6480 (in my case). For example:
$ linak_ctrl.py move 1000
For displaying debug information verbosity can be increased using --verbose parameter:
$ linak_ctrl.py -v move 1000
Current position: 771
Current position: 792
Current position: 825
Current position: 873
Current position: 939
Current position: 988
Current position: 1000
Adding more -v will increase amount of information:
$ linak_ctrl.py -vv move 1000
array('B', [4, 56, 17, 8, 3, 3, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 771
array('B', [4, 56, 17, 0, 21, 3, 0, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 789
array('B', [4, 56, 17, 0, 55, 3, 0, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 823
array('B', [4, 56, 17, 0, 101, 3, 16, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 869
array('B', [4, 56, 17, 0, 162, 3, 16, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 930
array('B', [4, 56, 17, 0, 217, 3, 0, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 985
array('B', [4, 56, 17, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0])
Current position: 1000
Alternatives
There are two projects, which more or less are doing the same. Fist one can be treated as a reference project - lots of information in the source code, second one is a python project, which uses libusb1 wrapper library instead of pyusb:
License
This software is licensed under 3-clause BSD license. See LICENSE file for details.
Metadata
Release files for linak-ctrl 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| linak-ctrl-1.0.4.tar.gz | 6.9 kB | Without provenance | Details for linak-ctrl-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| linak_ctrl-1.0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for linak_ctrl-1.0.4-py2.py3-none-any.whl |
Total release size: 14.1 kB
Release files / linak-ctrl-1.0.4.tar.gz
| Download URL | linak-ctrl-1.0.4.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9942a0b6ac0d4dd4436c3ae85e2fbeeea330053f78f654bde17e407333b3ca30
|
|
BLAKE2b-256 checksum How to use checksums |
1aa64c36601f50c43dfd5dc670112aec856183047c54415ad99b1ef4e0758326
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Release files / linak_ctrl-1.0.4-py2.py3-none-any.whl
| Download URL | linak_ctrl-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7fc75f0df7b591841b499574f07351115591875026bda39d72133125fe516360
|
|
BLAKE2b-256 checksum How to use checksums |
8376e66765f90190b62aa04c411c4d5e60f6ca1360c48e476eec45616e87543c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Security for linak-ctrl 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.