Skip to content

CANtact Support #853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 4, 2020
Merged

CANtact Support #853

merged 15 commits into from
Aug 4, 2020

Conversation

ericevenchick
Copy link
Contributor

Hi, this PR adds support for the CANtact devices, including the original device running candleLight firmware, the CANable/CANable Pro, and the upcoming CANtact Pro.

Users can install the driver and supporting packages using pip: pip install cantact. This is tested across Mac, Windows and Linux.

The CANtact Pro will support CAN-FD as well, but currently none of these devices support FD. I will provide another PR once FD support is ready!

Thanks,
Eric

@zariiii9003
Copy link
Collaborator

You could add cantact to extras_require in setup.py

@codecov
Copy link

codecov bot commented Jun 6, 2020

Codecov Report

Merging #853 into develop will increase coverage by 0.31%.
The diff coverage is 92.53%.

@@             Coverage Diff             @@
##           develop     #853      +/-   ##
===========================================
+ Coverage    70.39%   70.71%   +0.31%     
===========================================
  Files           70       71       +1     
  Lines         6840     6907      +67     
===========================================
+ Hits          4815     4884      +69     
+ Misses        2025     2023       -2     

@ericevenchick
Copy link
Contributor Author

I've added the package to extras_require and fixed formatting.

@ericevenchick
Copy link
Contributor Author

Added testing and resolved issues with running them on Travis.

Also, SimpleCyclicSendTaskTest was randomly causing failures in CI, which also seems to be true of the develop branch. I've disabled this test in CI to resolve the issue. I'm not sure if this is the best place to make that fix, but it was needed for CI to run reliably.

@hardbyte
Copy link
Owner

hardbyte commented Jun 9, 2020

Eric it would be great to add CANtact support directly to python-can. 🚀

I was under the impression that CANtact is supported via slcan and socketcan? If so might be worth adding a note on what advantages one method might have or what operating systems require what backend etc.

Can you please add an interface documentation page and link to it from interfaces. I'd like to see upstream links so people can easily find the right place to look if/when they run into trouble.

Is hardware filtering supported?

@ericevenchick
Copy link
Contributor Author

I was under the impression that CANtact is supported via slcan and socketcan? If so might be worth adding a note on what advantages one method might have or what operating systems require what backend etc.

CANtact was originally slcan + SocketCAN, but now has a driver based on gs_usb. Of course, this only works well on Linux. The main benefit of adding direct support will be easy cross-platform support.

With this PR, getting setup with CANtact + python-can consists of:

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

This works across Linux, macOS, and Windows.

Can you please add an interface documentation page and link to it from interfaces. I'd like to see upstream links so people can easily find the right place to look if/when they run into trouble.

Will do.

Is hardware filtering supported?

Not right now. This is because gs_usb doesn't have that feature. However, CANtact is going to branch from the gs_usb driver very shortly to add features such as CAN-FD and single wire CAN for the new CANtact Pro. The goal is to continue reverse compatibility with gs_usb, at least until I can get a driver mainlined into the kernel (no idea how long that'll take), but probably forever since having support on older kernels is nice.

When I add FD support, I'll be adding the other non-gs_usb features as well. I anticipate another PR for the update, but the driver code and firmware are still in the works.

@ericevenchick
Copy link
Contributor Author

Just checking in to see if there's anything missing from this PR. Happy to made whatever edits are needed to get it merged :)

Copy link
Collaborator

@zariiii9003 zariiii9003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@ericevenchick
Copy link
Contributor Author

Made some improvements based on your feedback @zariiii9003. Timestamp and is_rx are now provided by the driver. There is now an option to use custom bit timings. Updated documentation based on feedback and added additional test for bit timing.

@hardbyte hardbyte requested a review from zariiii9003 August 4, 2020 04:07
Copy link
Owner

@hardbyte hardbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me.

@hardbyte hardbyte added this to the 4.0 Release milestone Aug 4, 2020
@hardbyte hardbyte merged commit 1a6ecfc into hardbyte:develop Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants