| Name | rtcirqus JSON |
| Version |
0.2.1
JSON |
| download |
| home_page | None |
| Summary | Set real-time priorities of IRQ threads dynamically |
| upload_time | 2025-10-21 18:20:57 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.6 |
| license | None |
| keywords |
real-time
priorities
audio
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
========
rtcirqus
========
Introduction
------------
rtcirqus, real-time config IRQ udev service, is a Python script that sets the
real-time priority of IRQ threads of onboard and USB audio interfaces
automatically using udev. It is heavily inspired by Joakim Hernberg's
`udev-rtirq <https://github.com/jhernberg/udev-rtirq/>`_ project. It is
especially useful when using ALSA directly or when using JACK. It can also be
used with PipeWire but currently this hasn't been tested extensively.
Features
--------
- Automatic real-time prioritisation of onboard audio devices.
- Automatic real-time prioritisation of USB audio and MIDI devices upon
connection and disconnection.
- Custom real-time prioritisation of audio devices.
Installation
------------
rtcirqus needs at least Python 3.6 and the following Python modules:
- pyalsaaudio
- psutil
- pyudev
On a Debian 12 system these modules can be installed with the following
command:
::
sudo apt install python3-alsaaudio python3-psutil python3-pyudev
Clone this repository:
::
git clone https://codeberg.org/autostatic/rtcirqus.git
Copy ``src/rtcirqus/rtcirqus.py`` to ``/usr/local/bin/rtcirqus``:
::
sudo cp src/rtcirqus/rtcirqus.py /usr/local/bin/rtcirqus
sudo chmod 755 /usr/local/bin/rtcirqus
Copy ``resources/99-rtcirqus.rules`` to ``/etc/udev/rules.d/``:
::
sudo cp resources/99-rtcirqus.rules /etc/udev/rules.d/
And reload the udev rules:
::
sudo udevadm control --reload-rules
Optionally you could copy ``rtcirqus.conf`` to ``/etc/rtcirqus.d/rtcirqus.conf``:
::
sudo mkdir /etc/rtcirqus.d/
sudo cp resources/rtcirqus.conf /etc/rtcirqus.d/rtcirqus.conf
And modify it to your needs. So far the ``deny_list``, ``prio_list``,
``prio_max`` and ``prio_step`` options are available. The ``deny_list`` and
``prio_list`` options take a comma separated list of device names as produced
by ``rtcirqus`` itself or by ``aplay -l``. In the case of ``aplay -l`` the
device names are the names between the brackets. For more information on the
rtcirqus configuration file see `The configuration file`_.
Installation in a Virtual Environment
-------------------------------------
To install the ``rtcirqus`` project in a Python virtual environment for development:
::
cd /path/to/clone/of/rtcirqus
python3.9 -m venv /path/to/venv # Python >= 3.9
/path/to/venv/bin/pip install -e .
``pip`` will install the dependencies, and create a script, ``rtcirqus`` in its
``bin/`` directory, which you can run directly:
::
/path/to/venv/bin/rtcirqus --help
You can then copy that script to ``/usr/local/bin/rtcirqus``:
::
sudo cp /path/to/venv/bin/rtcirqus /usr/local/bin/
and proceed as above, adding ``udev`` rules and copying / updating configuration.
Overview
--------
You can now check if rtcirqus works properly by running it as a normal user. It
will produce output similar to the following:
::
$ rtcirqus
WARNING: No configuration file found, continuing with defaults
INFO: Loaded kernel is using threaded IRQS and threaded IRQ processes detected
INFO: Onboard cards found: HD-Audio Generic, HD-Audio Generic, acp63
INFO: USB cards found: Babyface (23596862)
ERROR: Not running as root, rtcirqus needs to be run as root in order to set IRQ priorities
You can check if rtcirqus gets triggered by udev by plugging in a USB device
while running ``sudo journalctl -f | grep -E "kernel|rtcirqus"``. You should see something in the lines of:
::
Sep 22 20:56:08 lenovo kernel: usb 7-1: new high-speed USB device number 8 using xhci_hcd
Sep 22 20:56:08 lenovo kernel: usb 7-1: New USB device found, idVendor=0424, idProduct=3fb7, bcdDevice= 0.01
Sep 22 20:56:08 lenovo kernel: usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep 22 20:56:08 lenovo kernel: usb 7-1: Product: Babyface (23596862)
Sep 22 20:56:08 lenovo kernel: usb 7-1: Manufacturer: RME
Sep 22 20:56:08 lenovo kernel: usb 7-1: SerialNumber: 18C0A73560538C8
Sep 22 20:56:08 lenovo kernel: usb 7-1: Quirk or no altset; falling back to MIDI 1.0
Sep 22 20:56:08 lenovo systemd[1]: Started run-rbb0fc57dc9614ca88fe1df4fae086cde.service - /usr/local/bin/rtcirqus --action add --dev-path /devices/pci0000:00/0000:00:08.3/0000:66:00.4/usb7/7-1/7-1:1.0/sound/card0.
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Loaded kernel is using threaded IRQs and threaded IRQ processes detected
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Onboard cards found: HD-Audio Generic, HD-Audio Generic, acp63
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: USB cards found: Babyface (23596862)
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 90 for USB card Babyface (23596862) with IRQ 49
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 85 for onboard card HD-Audio Generic with IRQ 91
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 80 for onboard card HD-Audio Generic with IRQ 92
Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 75 for onboard card acp63 with IRQ 90
.. _The configuration file:
The configuration file
----------------------
rtcirqus accepts an INI-style configuration file of which the path can be
passed to rtcirqus with the ``-c`` or ``--configuration`` option. By default
rtcirqus looks for ``/etc/rtcirqus.d/rtcirqus.conf``.
The following parameters can be adjusted with the rtcirqus configuration file:
- **deny_list**: A comma separated list of audio or MIDI devices that will be
excluded from getting a real-time priority. Example:
::
deny_list = acp63, HD-Audio Generic
The device names rtcirqus accepts can be found with `aplay -l`. The device
names are the names between the brackets.
- **prio_list**: A comma separated list of audio or MIDI devices that will get
a real-time priority corresponding to the order they are in. So the first
device will get the highest real-time priority followed by any other device
in this list. If there are more devices on the system then there are defined
in this list then those will get the next available real-time priority. By
default rtcirqus will assign real-time priorities according to the index ALSA
assigns to the devices available on the system. So the device (or card within
the ALSA context) with index 0 will get the highest priority.
- **prio_max**: The maximum real-time priority rtcirqus will set. The default
is 90.
- **prio_step**: The size of the steps between the real-time priorities
assigned by rtcirqus. The default is 5.
Future plans
------------
- Always give audio or MIDI device that gets plugged in the highest priority.
- Improve handling of USB devices connected to USB2 ports using the ehci_hcd kernel module
- Add an option to choose between static mode and dynamic mode:
- Static mode: priorities of connected devices stay the same upon connection
or disconnection of devices (the current default).
- Dynamic mode: priorities of connected devices get reinitialised upon
connection or disconnection of devices.
- Add possibility to prioritise USB or onboard devices separately.
- Think of a logo.
Contact
-------
To contact me send me a mail or if it's a technical issue or question, use
the project's issue tracker at `codeberg.org
<https://codeberg.org/autostatic/rtcirqus/issues>`_.
Raw data
{
"_id": null,
"home_page": null,
"name": "rtcirqus",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "real-time, priorities, audio",
"author": null,
"author_email": "Jeremy Jongepier <jeremy@autostatic.com>",
"download_url": "https://files.pythonhosted.org/packages/f6/e0/903ef8a63963fc10a8c8b744402d136221a064d5c38bde98c155d9d9020a/rtcirqus-0.2.1.tar.gz",
"platform": null,
"description": "========\nrtcirqus\n========\n\nIntroduction\n------------\n\nrtcirqus, real-time config IRQ udev service, is a Python script that sets the\nreal-time priority of IRQ threads of onboard and USB audio interfaces\nautomatically using udev. It is heavily inspired by Joakim Hernberg's\n`udev-rtirq <https://github.com/jhernberg/udev-rtirq/>`_ project. It is\nespecially useful when using ALSA directly or when using JACK. It can also be\nused with PipeWire but currently this hasn't been tested extensively.\n\nFeatures\n--------\n- Automatic real-time prioritisation of onboard audio devices.\n- Automatic real-time prioritisation of USB audio and MIDI devices upon \n connection and disconnection.\n- Custom real-time prioritisation of audio devices.\n\nInstallation\n------------\nrtcirqus needs at least Python 3.6 and the following Python modules:\n\n- pyalsaaudio\n- psutil\n- pyudev\n\nOn a Debian 12 system these modules can be installed with the following \ncommand:\n\n::\n\n sudo apt install python3-alsaaudio python3-psutil python3-pyudev\n\nClone this repository:\n\n::\n\n git clone https://codeberg.org/autostatic/rtcirqus.git\n\nCopy ``src/rtcirqus/rtcirqus.py`` to ``/usr/local/bin/rtcirqus``:\n\n::\n\n sudo cp src/rtcirqus/rtcirqus.py /usr/local/bin/rtcirqus\n sudo chmod 755 /usr/local/bin/rtcirqus\n\nCopy ``resources/99-rtcirqus.rules`` to ``/etc/udev/rules.d/``:\n\n::\n\n sudo cp resources/99-rtcirqus.rules /etc/udev/rules.d/\n\nAnd reload the udev rules:\n\n::\n\n sudo udevadm control --reload-rules\n\nOptionally you could copy ``rtcirqus.conf`` to ``/etc/rtcirqus.d/rtcirqus.conf``:\n\n::\n\n sudo mkdir /etc/rtcirqus.d/\n sudo cp resources/rtcirqus.conf /etc/rtcirqus.d/rtcirqus.conf\n\nAnd modify it to your needs. So far the ``deny_list``, ``prio_list``, \n``prio_max`` and ``prio_step`` options are available. The ``deny_list`` and \n``prio_list`` options take a comma separated list of device names as produced\nby ``rtcirqus`` itself or by ``aplay -l``. In the case of ``aplay -l`` the\ndevice names are the names between the brackets. For more information on the\nrtcirqus configuration file see `The configuration file`_.\n\n\nInstallation in a Virtual Environment\n-------------------------------------\n\nTo install the ``rtcirqus`` project in a Python virtual environment for development:\n\n::\n\n cd /path/to/clone/of/rtcirqus\n python3.9 -m venv /path/to/venv # Python >= 3.9\n /path/to/venv/bin/pip install -e .\n\n``pip`` will install the dependencies, and create a script, ``rtcirqus`` in its\n``bin/`` directory, which you can run directly:\n\n::\n\n /path/to/venv/bin/rtcirqus --help\n\n\nYou can then copy that script to ``/usr/local/bin/rtcirqus``:\n\n::\n\n sudo cp /path/to/venv/bin/rtcirqus /usr/local/bin/\n\nand proceed as above, adding ``udev`` rules and copying / updating configuration.\n\n\nOverview\n--------\nYou can now check if rtcirqus works properly by running it as a normal user. It\nwill produce output similar to the following:\n\n::\n\n $ rtcirqus \n WARNING: No configuration file found, continuing with defaults\n INFO: Loaded kernel is using threaded IRQS and threaded IRQ processes detected\n INFO: Onboard cards found: HD-Audio Generic, HD-Audio Generic, acp63\n INFO: USB cards found: Babyface (23596862)\n ERROR: Not running as root, rtcirqus needs to be run as root in order to set IRQ priorities\n\nYou can check if rtcirqus gets triggered by udev by plugging in a USB device\nwhile running ``sudo journalctl -f | grep -E \"kernel|rtcirqus\"``. You should see something in the lines of:\n\n::\n\n Sep 22 20:56:08 lenovo kernel: usb 7-1: new high-speed USB device number 8 using xhci_hcd\n Sep 22 20:56:08 lenovo kernel: usb 7-1: New USB device found, idVendor=0424, idProduct=3fb7, bcdDevice= 0.01\n Sep 22 20:56:08 lenovo kernel: usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3\n Sep 22 20:56:08 lenovo kernel: usb 7-1: Product: Babyface (23596862)\n Sep 22 20:56:08 lenovo kernel: usb 7-1: Manufacturer: RME\n Sep 22 20:56:08 lenovo kernel: usb 7-1: SerialNumber: 18C0A73560538C8\n Sep 22 20:56:08 lenovo kernel: usb 7-1: Quirk or no altset; falling back to MIDI 1.0\n Sep 22 20:56:08 lenovo systemd[1]: Started run-rbb0fc57dc9614ca88fe1df4fae086cde.service - /usr/local/bin/rtcirqus --action add --dev-path /devices/pci0000:00/0000:00:08.3/0000:66:00.4/usb7/7-1/7-1:1.0/sound/card0.\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Loaded kernel is using threaded IRQs and threaded IRQ processes detected\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Onboard cards found: HD-Audio Generic, HD-Audio Generic, acp63\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: USB cards found: Babyface (23596862)\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 90 for USB card Babyface (23596862) with IRQ 49\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 85 for onboard card HD-Audio Generic with IRQ 91\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 80 for onboard card HD-Audio Generic with IRQ 92\n Sep 22 20:56:08 lenovo rtcirqus[9531]: INFO: Setting RT priority 75 for onboard card acp63 with IRQ 90\n\n.. _The configuration file:\n\nThe configuration file\n----------------------\nrtcirqus accepts an INI-style configuration file of which the path can be \npassed to rtcirqus with the ``-c`` or ``--configuration`` option. By default \nrtcirqus looks for ``/etc/rtcirqus.d/rtcirqus.conf``.\n\nThe following parameters can be adjusted with the rtcirqus configuration file:\n\n- **deny_list**: A comma separated list of audio or MIDI devices that will be\n excluded from getting a real-time priority. Example:\n \n ::\n \n deny_list = acp63, HD-Audio Generic\n \n The device names rtcirqus accepts can be found with `aplay -l`. The device\n names are the names between the brackets.\n- **prio_list**: A comma separated list of audio or MIDI devices that will get\n a real-time priority corresponding to the order they are in. So the first\n device will get the highest real-time priority followed by any other device\n in this list. If there are more devices on the system then there are defined\n in this list then those will get the next available real-time priority. By\n default rtcirqus will assign real-time priorities according to the index ALSA\n assigns to the devices available on the system. So the device (or card within\n the ALSA context) with index 0 will get the highest priority.\n- **prio_max**: The maximum real-time priority rtcirqus will set. The default\n is 90.\n- **prio_step**: The size of the steps between the real-time priorities\n assigned by rtcirqus. The default is 5.\n\n\nFuture plans\n------------\n- Always give audio or MIDI device that gets plugged in the highest priority.\n- Improve handling of USB devices connected to USB2 ports using the ehci_hcd kernel module\n- Add an option to choose between static mode and dynamic mode:\n \n - Static mode: priorities of connected devices stay the same upon connection\n or disconnection of devices (the current default).\n - Dynamic mode: priorities of connected devices get reinitialised upon\n connection or disconnection of devices.\n- Add possibility to prioritise USB or onboard devices separately.\n- Think of a logo.\n\nContact\n-------\n\nTo contact me send me a mail or if it's a technical issue or question, use \nthe project's issue tracker at `codeberg.org\n<https://codeberg.org/autostatic/rtcirqus/issues>`_.\n",
"bugtrack_url": null,
"license": null,
"summary": "Set real-time priorities of IRQ threads dynamically",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://codeberg.org/autostatic/rtcirqus"
},
"split_keywords": [
"real-time",
" priorities",
" audio"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a4fa58b0a7b214cf2c2d1a00358ff0727e5d0d319ef945a46572ac8836c0000b",
"md5": "502a72e41086868dd9c6e4fef3bf605f",
"sha256": "500ab4f447c37d09d7efd395a42ca1f74773f620156649c451b60d5b025e7385"
},
"downloads": -1,
"filename": "rtcirqus-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "502a72e41086868dd9c6e4fef3bf605f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7387,
"upload_time": "2025-10-21T18:20:56",
"upload_time_iso_8601": "2025-10-21T18:20:56.400678Z",
"url": "https://files.pythonhosted.org/packages/a4/fa/58b0a7b214cf2c2d1a00358ff0727e5d0d319ef945a46572ac8836c0000b/rtcirqus-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f6e0903ef8a63963fc10a8c8b744402d136221a064d5c38bde98c155d9d9020a",
"md5": "997498f670d00a82893373fb82f8d858",
"sha256": "bb5909779af7cfe1550f3b39520821aa22ce9b18ea77049ec9463524726ce749"
},
"downloads": -1,
"filename": "rtcirqus-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "997498f670d00a82893373fb82f8d858",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7430,
"upload_time": "2025-10-21T18:20:57",
"upload_time_iso_8601": "2025-10-21T18:20:57.335036Z",
"url": "https://files.pythonhosted.org/packages/f6/e0/903ef8a63963fc10a8c8b744402d136221a064d5c38bde98c155d9d9020a/rtcirqus-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-21 18:20:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": true,
"codeberg_user": "autostatic",
"codeberg_project": "rtcirqus",
"lcname": "rtcirqus"
}