Skip to content

Port Drivers

Calin Crisan edited this page Apr 25, 2020 · 5 revisions

What Are Port Drivers?

A port driver creates a real (as opposed to virtual) port that will be exposed by the server. Port drivers indicate:

  • the id, type and all other common attributes of the exposed ports
  • any additional attributes for the ports, along with their definitions
  • what actually happens when values are written to or read from ports

For example, qtoggleserver-rpigpio provides a driver that will create ports for selected GPIOs on a Raspberry Pi.

You may also want to take a look over peripheral drivers.

Location On Disk

Port drivers provided by qToggleServer are found in the qtoggleserver/drivers/ports package.

External port drivers may be provided by add-ons, shipped via Python packages that usually go into your Python virtual environment or directly into your system's Python site packages path.

User-provided drivers can be placed in any folder covered by the Python interpreter path. The PYTHONPATH environment variable can be adjusted to include custom paths.

Installing And Using Port Drivers

Most port drivers come in the form of an add-on and are installable using pip. Adding a port to qToggleServer is done by adding an entry in the ports section of the qtoggleserver.conf file. Follow the add-on documentation in order to install and add it to qToggleServer.

Writing Port Drivers

If you haven't found an add-on that offers the functionality you need and you're interested in writing one yourself, start off by reading the Writing Port Drivers page.