Skip to main content

python-can-usb8dev

✍️ Written with Claude Opus 4.8.

A pure-Python python-can backend for the 8devices USB2CAN / Korlan adapter (VID 0483, PID 1234).

It reimplements the vendor usb2can.dll (CANAL API) entirely in Python, speaking the device's native usb_8dev USB protocol directly over libusb — no vendor DLL and no python-can usb2can/CANAL interface. The protocol matches the mainline Linux kernel driver drivers/net/can/usb/usb_8dev.c (used as documentation, not copied). Works on Windows, macOS, and Linux.

Install

pip install python-can-usb8dev

This pulls in python-can, pyusb, and libusb-package (which vendors the libusb-1.0 native library as a wheel, so nothing native needs to be installed separately).

Use

It registers itself as the python-can interface usb8dev, so it behaves like any built-in backend:

import can

print(can.detect_available_configs(interfaces=["usb8dev"]))   # find adapters

with can.Bus(interface="usb8dev", channel="ED000001", bitrate=250000) as bus:
    for msg in bus:
        print(msg)

Works with python-can's CLIs too:

can_logger -i usb8dev -c ED000001 -b 250000 -f capture.asc
can_viewer -i usb8dev -c ED000001 -b 250000

Options

kwarg default meaning
channel / serial first found device serial number
bitrate 250000 CAN bitrate (bit/s)
listen_only False silent / listen-only (real SILENT mode bit)
loopback False internal loopback, no bus needed (real LOOPBACK bit)
one_shot False disable automatic retransmission
status_frames True surface bus error/status frames as error Messages
sample_point 0.875 target sample point for bit-timing

Standalone recorder

The package also installs a small recorder / test harness, handy to confirm an adapter works on its own:

usb8dev-record --list                      # list connected adapters
usb8dev-record -b 250000                    # print frames live
usb8dev-record -b 250000 -o capture.asc     # + log to file (.asc/.blf/.csv/.log)
usb8dev-record -b 250000 --loopback         # self-test with no bus attached

(Equivalently python -m can_usb8dev ….)

Driver setup

  • Windows — the adapter must be bound to a libusb-compatible driver. The 8devices WinUSB package binds WinUSB, which libusb drives; otherwise use Zadig to bind WinUSB or libusbK.
  • macOS — no driver setup: no kernel driver claims this vendor device, so libusb talks to it directly.
  • Linux — the mainline usb_8dev SocketCAN driver is the native path (ip link set can0 up type can bitrate 250000); this package is mainly useful on platforms without SocketCAN, but works on Linux too via libusb (detach the kernel driver first if it has claimed the device).

How it works

  • Bit timing is solved from the 32 MHz device clock at an 87.5% sample point (e.g. 250k → brp=8, tseg1=13, tseg2=2, sjw=2).
  • Four bulk endpoints: data RX/TX and command RX/TX. A 16-byte command message (start 0x11 / end 0x22, reply opt1==0 == success) carries OPEN/CLOSE with timing + mode flags; CAN frames use fixed 21-byte (RX) / 16-byte (TX) framed messages with start 0x55 / end 0xAA.

License

MIT

Metadata

Release files for python-can-usb8dev 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-can-usb8dev 0.1.0
File Size Uploaded
python_can_usb8dev-0.1.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-can-usb8dev 0.1.0
File Interpreter ABI Platform
python_can_usb8dev-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / python_can_usb8dev-0.1.0.tar.gz

Download URL python_can_usb8dev-0.1.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
04163b7d8a9005128275646bc184eb96731b631116e8116e919bd4f6a5380259
BLAKE2b-256 checksum
How to use checksums
29afca2776b056157da1457bb4aba2f8048859a4c0644c3a1715089f18c3b040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Jul 30, 2026.

Transparency log

Release files / python_can_usb8dev-0.1.0-py3-none-any.whl

Download URL python_can_usb8dev-0.1.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c214d13331ad48d86f0aa1f64616b91ee4568438177c015d35df40cdbf0f8778
BLAKE2b-256 checksum
How to use checksums
358f11987c934308e48cbbbb8acf3150759e6a06a5b58655ee973ba0d40fa5af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Jul 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page