Skip to main content

Support for the CANtact Controller Area Network Devices

Project description

CANtact

crates.io crates.io PyPI docs.rs Rust Build Python Build

Software support for CANtact devices. Includes a driver (see driver/), APIs, and a cross-platform command line interface.

Getting a Device

CANtact Pro is currently a pre-launch project on CrowdSupply. You can subscribe on the product page to get updates about the hardware release.

This tool should work fine with other CANtact/gs_usb compatible devices such as CANable.

Installing

The CLI and driver are built using cargo, which can be installed using rustup.

Once cargo is installed, use it to build and install the can binary:

git clone https://github.com/linklayer/cantact
cd cantact
cargo install --path .

Setting udev Rules (Linux only)

On Linux, only root can access the device by default. This results in a DeviceNotFound error when trying to access the device as a normal user. To allow access for all users, create a file at /etc/udev/rules.d/99-cantact.rules which contains:

SUBSYSTEM=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="606f", MODE="0666"

Then reload the udev rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

Command Line Interface

The CLI is invoked using the can binary:

can help

can 0.1.0
Eric Evenchick <eric@evenchick.com>
Command line utilities for CANtact devices

USAGE:
    can [FLAGS] [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -v, --verbose    Print verbose debugging information
    -V, --version    Prints version information

SUBCOMMANDS:
    cfg     Set device configurations
    dump    Receive and display CAN frames
    help    Prints this message or the help of the given subcommand(s)
    send    Send a single CAN frame

The can cfg command is used to set the bitrate and other device settings. Once set, other commands will use these options.

For example, to set channels 0 and 1 to 500000 kbps, then dump all frames on all channels:

can cfg --channel 0 --bitrate 500000
can cfg --channel 1 --bitrate 500000
can dump

Use can help [subcommand] for additional documentation.

Rust Support

The driver can be used from Rust by installing the cantact-driver crate. Documentation for the crate can be found on docs.rs.

Python Support

CANtact supports Python 3.5+ on Windows, macOS, and Linux. The Python modules are hosted on PyPI. Installation requires pip 19.0+ (for manylinux2010 wheels).

Python end-users should not use this repository directly. Instead, install Python support using pip:

python3 -m pip -U pip
python3 -m pip install cantact

This will attempt to install a binary distribution for your system. If none exists, it will attempt to build from source. This requires nightly rust, which can be enabled by running rustup default nightly before installing.

See the examples/ folder for Python examples. python-can supports CANtact, and is recommended over using the cantact module directly. To install CANtact, python-can, and run a test:

python3 -m pip install cantact git+https://github.com/ericevenchick/python-can@cantact
can_logger.py -i cantact -c 0 -b 500000

Building Python Support

Building Python support is only required if you want to make modifications to the cantact Python module, or if you are using a platform that does not have packaged support.

Python support is implemented using PyO3, and is gated by the python feature. Thanks to rust-setuptools, the cantact Python module can be built like any other Python module using setuptools. PyO3 requires nightly Rust, which can be configured using rustup override.

cd driver
rustup override set nightly
python setup.py build

Python builds for Windows, macOS, and manylinux are automated using Github Actions. Tagged releases are automatically pushed to PyPI.

C / C++ Support

C / C++ support is provided by the driver. This is currently used to implement BUSMASTER support on Windows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

cantact-0.1.3-cp312-cp312-win_amd64.whl (223.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

cantact-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738.6 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

cantact-0.1.3-cp311-cp311-win_amd64.whl (223.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

cantact-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

cantact-0.1.3-cp310-cp310-win_amd64.whl (223.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

cantact-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

cantact-0.1.3-cp39-cp39-win_amd64.whl (223.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

cantact-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

cantact-0.1.3-cp38-cp38-win_amd64.whl (223.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

cantact-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file cantact-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: cantact-0.1.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for cantact-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c55a5427fe9db4f8ff446772ab657e83e4f6b28ef9cbe0d1c2f849e71bf919d7
MD5 6c84e29cf5ed3a6192bca88fd66cfc2d
BLAKE2b-256 461c7ab0737bf8b6a96d0f73ca30318a9a3fcdf6e9aca607873939c02d0fcdcb

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cantact-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1941c91840551b00398acc0f4e56ca07868e9ac01fd881cd4e90d65a3e56574
MD5 f9adf04469d0ccf34cd69905a2e98381
BLAKE2b-256 6754a273cf222bce5b39fac7a397ee748369c5c698bb0ef5bdf716b41e7567d7

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: cantact-0.1.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for cantact-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f0d4f994546104f14e25d6c59e3856743534bd7113a8c956afc2b1b7907a0fa7
MD5 0ba0238f1661775fa697f422dfc257f7
BLAKE2b-256 e9eedc97f76addbb3d7ad200aaabd342f4a052075f1baaec55d4e03be65ed9c0

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cantact-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 414b21a6ff1fa81b347539babb5affc25207c7ae487e9e8d1f223f9723d0b1ea
MD5 d038c38c2a5d495707811cb2e234ddec
BLAKE2b-256 6a39bebd34440499865fe95d579dae776940f4ed2e6582f59a34acad9f1877ed

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: cantact-0.1.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for cantact-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b892b3c415ebd238d42f52fc21df6b84f5e2066839faea738920e5f19c422a0a
MD5 10bcb1ae0f8d1fbbae3b8f739d5f4836
BLAKE2b-256 db2c1642b884e0a55d7cdd0f211031f54ca9b6073ceff0746399a71a1f2006a0

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cantact-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e606180b26526d39502a56b061c113bc0ad7d86179e9064672a15316456883e
MD5 d23967781d84455d1e7f6283b5dd23cb
BLAKE2b-256 9e8adf36dffacb5800a466dcea0d2e046eec37740fc66284deb33461d8b66295

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: cantact-0.1.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.13

File hashes

Hashes for cantact-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f3fa3ac898c420db670361687adacbc7118ca8a6012fb20aad98e81173bd2464
MD5 2c4fe3045c9a3ba7b09479cc80fa234d
BLAKE2b-256 0e6ef19be0b5e40a8d4ce8d90133ed898b3a82c09582fea04e8e5855b18b62dc

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cantact-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99f94bb8e0a4f001f1a52bf10c01009f6a4056a7c9469030e4fea7597fdd9f66
MD5 6ef7843c56631e14590bfafb4b0c67fc
BLAKE2b-256 b89b65f489781309cf8253a1a56cb0b717b7f597f78139d8f5e800d1f29c5417

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cantact-0.1.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for cantact-0.1.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 69699309eabdc371d2fc209d9a46b30e2d353677ef19914346de102f129d1421
MD5 310c0e21d190dce914e57fddd4b2df9b
BLAKE2b-256 7e8627a173a8047a1c2fa243dfd76370c8fab33fdb5e835c4e8909d02a8db042

See more details on using hashes here.

File details

Details for the file cantact-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cantact-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab16abdb8f1fcb32a3a7fecf876c80904c0e0aa0a056a3eaa061df20b8644b73
MD5 453e4078d334af7f9f3c7cd6af6cb186
BLAKE2b-256 f754e9605f1c3681e8334b482a9425d6fb9813064c86b5acaf1b7ecd2e3a299d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page