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

7 Commits

Author SHA1 Message Date
gryf 3abdbfaa6a Removed license classifier in favor of SPDX entry. 2025-04-18 16:07:12 +02:00
gryf ab18c7d90f Move from setup.cfg to pyproject.toml. 2025-03-26 19:34:52 +01:00
gryf 4ae101603e Readme update. 2022-04-13 17:44:42 +02:00
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
gryf 9a33f742e1 Readme update. 2021-07-07 18:00:00 +02:00
7 changed files with 87 additions and 46 deletions
+3
View File
@@ -0,0 +1,3 @@
.venv
*.egg-info
build
+33 -5
View File
@@ -2,6 +2,9 @@
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.
@@ -14,6 +17,31 @@ Requirements
* `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
=====
@@ -24,7 +52,7 @@ number, and in centimeters, and information if desk is moving.
.. code:: shell-session
$ linak_ctrl.py status
$ linak_ctrl/__init__.py status
Position: 767, height: 78.80cm, moving: False
Note, that height was measured manually and may differ depending if desk have
@@ -35,7 +63,7 @@ information from USB2LIN06 device every 0.2 seconds:
.. code:: shell-session
$ linak_ctrl.py status -l
$ linak_ctrl/__init__.py status -l
Position: 2161, height: 100.25cm, moving: True
Position: 2109, height: 99.45cm, moving: True
Position: 2026, height: 98.17cm, moving: True
@@ -53,14 +81,14 @@ my case). For example:
.. code:: shell-session
$ linak_ctrl.py move 1000
$ linak_ctrl/__init__.py move 1000
For displaying debug information verbosity can be increased using ``--verbose``
parameter:
.. code:: shell-session
$ linak_ctrl.py -v move 1000
$ linak_ctrl/__init__.py -v move 1000
Current position: 771
Current position: 792
Current position: 825
@@ -73,7 +101,7 @@ Adding more `-v` will increase amount of information:
.. code:: shell-session
$ linak_ctrl.py -vv move 1000
$ linak_ctrl/__init__.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])
+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.')
+42
View File
@@ -0,0 +1,42 @@
[build-system]
requires = ["setuptools >= 77.0"]
build-backend = "setuptools.build_meta"
[project]
name = "linak-ctrl"
version = "1.0.5"
requires-python = ">= 3.10"
description = "Control Linak powered desks using USB2LIN06 cable."
dependencies = [
"pyusb>=1.3.1"
]
readme = "README.rst"
authors = [
{name = "Roman Dobosz", email = "gryf73@gmail.com"}
]
license = "BSD-3-Clause"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: System :: Networking"
]
[tool.setuptools]
py-modules = ["linak_ctrl"]
[project.urls]
Repository = "https://github.com/gryf/linak-ctrl"
[project.scripts]
linak-ctrl = "linak_ctrl:main"
[tool.distutils.bdist_wheel]
universal = true
-2
View File
@@ -1,2 +0,0 @@
pbr
pyusb>=1.1.1
-34
View File
@@ -1,34 +0,0 @@
[metadata]
name = linak-ctrl
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
license = BSD
classifier =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: End Users/Desktop
License :: OSI Approved :: BSD License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: System :: Networking
[install]
record = install.log
[options.entry_points]
console_scripts =
linak-ctrl= linak_ctrl:main
[options]
install_requires =
pyusb
[bdist_wheel]
universal = 1
-4
View File
@@ -1,4 +0,0 @@
import setuptools
setuptools.setup(setup_requires=['pbr>=2.0.0'], pbr=True)