candle-usb
Python CAN / CAN FD driver for candleLight USB adapters and Geschwister Schneider gs_usb devices — Windows, Linux, macOS.
Install
pip install candle-usb
Requires libusb. On Linux install libusb-1.0-0 and add a udev rule; on Windows use Zadig to bind WinUSB to the device.
pycandump
A candump-style live monitor is included and available on the PATH after install:
pycandump # classic CAN, 500 kbps, listen-only
pycandump --bitrate 250000
pycandump --data-bitrate 1000000 # enables CAN FD mode
pycandump --active # required when adapter is sole receiver
pycandump --filter 0x100:0x7FF
pycandump --fd-only
pycandump --log trace.log
pycandump --device 6:14 # pick a specific USB device
Note on
--active: in listen-only mode the adapter sends no ACK bits. If it is the only receiver on the bus the sender will retransmit the same frame indefinitely. Pass--activewhenever you are the sole node.
API usage
Classic CAN
from candle_usb.gs_usb import GsUsb
from candle_usb.gs_usb_frame import GsUsbFrame
from candle_usb.constants import CAN_EFF_FLAG
devs = GsUsb.scan()
dev = devs[0]
dev.set_bitrate(500000)
dev.start()
frame = GsUsbFrame(can_id=0x7FF, data=b"\x01\x02\x03")
dev.send(frame)
rx = GsUsbFrame()
if dev.read(rx, timeout_ms=100):
print(rx)
dev.stop()
CAN FD
from candle_usb.gs_usb import GsUsb
from candle_usb.gs_usb_frame import GsUsbFrame
from candle_usb.constants import (
GS_CAN_MODE_FD, GS_CAN_MODE_HW_TIMESTAMP,
GS_CAN_FEATURE_FD, GS_CAN_FEATURE_HW_TIMESTAMP,
)
dev = GsUsb.scan()[0]
dev.set_bitrate(250000)
dev.set_data_bitrate(1000000)
dev.start(GS_CAN_MODE_FD | GS_CAN_MODE_HW_TIMESTAMP)
frame = GsUsbFrame()
if dev.read(frame, timeout_ms=200):
print(frame) # shows FD / BRS / ESI flags automatically
dev.stop()
Publishing a new release
Push a version tag and GitHub Actions builds and publishes to PyPI automatically:
git tag v0.4.0
git push origin v0.4.0
The workflow uses PyPI Trusted Publishing (OIDC — no API token needed). On first use, configure the publisher on PyPI under the project settings:
- Publisher: GitHub Actions
- Owner:
diegoasanza - Repository:
candle-usb - Workflow:
publish.yml - Environment:
pypi
Fork notice
This is a fork of gs_usb by jxltom, extended with:
- Correct CAN FD frame parsing — dispatch on
GS_CAN_FLAG_FDin the frame header (matching the Linux kernel driver) instead of packet size, which breaks whenGS_CAN_MODE_PAD_PKTS_TO_MAX_PKT_SIZEis active - Hardware timestamp support (
GS_CAN_MODE_HW_TIMESTAMP) set_data_bitrate()and full CAN FD mode setuppycandumpCLI monitor- Identify LED and bus termination control
License
MIT — see LICENSE.
Original work © 2020 jxltom. Modifications © 2024 Diego Asanza.
Metadata
Release files for candle-usb 0.4.1
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 |
|---|---|---|---|---|
| candle_usb-0.4.1.tar.gz | 16.9 kB | With provenance | Details for candle_usb-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| candle_usb-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for candle_usb-0.4.1-py3-none-any.whl |
Total release size: 31.9 kB
Release files / candle_usb-0.4.1.tar.gz
| Download URL | candle_usb-0.4.1.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92b8987135132040fafbb072208abdb3094a127bb28c23281c6d6e8675d95e6e
|
|
BLAKE2b-256 checksum How to use checksums |
1e91ccccf8acc066889fedff200e1b8cc011c71e86dae10466686678316f2a07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logRelease files / candle_usb-0.4.1-py3-none-any.whl
| Download URL | candle_usb-0.4.1-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e145457dd02225255a5e8138a87dea4c762598389d14254483152d008ae2eee
|
|
BLAKE2b-256 checksum How to use checksums |
caf60ab3328857439c664d951775d708e59165ce4730636f5c0117f3a5c6c317
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logSecurity for candle-usb 0.4.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for candle_usb-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logA 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.