Skip to content
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

Add a backend for Silicon Labs CP2110/4 HID-to-UART bridge. #411

Merged
merged 1 commit into from Aug 13, 2019

Conversation

@Flameeyes
Copy link
Contributor

commented Jan 29, 2019

These two chips implement UART access via a HID protocol, which can be
implemented purely in user space. The protocol is documented by Silicon
Labs AN434:
https://www.silabs.com/documents/public/application-notes/AN434-CP2110-4-Interface-Specification.pdf

The backend is implemented based on cython-hidapi
(https://github.com/trezor/cython-hidapi), making it OS-independent, if a
bit awkward.

@zsquareplusc

This comment has been minimized.

Copy link
Member

commented Feb 7, 2019

could you move the complete code into serial/urlhandler/protocol_cp2110.py? I don't think that anyone would need to import serial.cp2110.

And there should probably be a note in documentation/url_handlers.rst mentioning the handler and that the hidapi module needs to be installed separately (i would not like to install that by default, but as option would be possible, via extras_require={'cp2210': [hidapi']} in setup.py).

I've also used HID here and did my own low-level access:
https://github.com/zsquareplusc/python-msp430-tools/blob/master/msp430/bsl5/hid.py#L84
hoever that does not (yet) support MacOSX

@Flameeyes Flameeyes force-pushed the Flameeyes:master branch from 8994c36 to 02cb0d1 Feb 8, 2019

Add a backend for Silicon Labs CP2110/4 HID-to-UART bridge.
These two chips implement UART access via a HID protocol, which can be
implemented purely in user space. The protocol is documented by Silicon
Labs AN434:
https://www.silabs.com/documents/public/application-notes/AN434-CP2110-4-Interface-Specification.pdf

The backend is implemented based on cython-hidapi
(https://github.com/trezor/cython-hidapi), making it OS-independent, if a
bit awkward.

@Flameeyes Flameeyes force-pushed the Flameeyes:master branch from 02cb0d1 to 8b24cbb Feb 8, 2019

@Flameeyes

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2019

Thanks for the review!

Code moved and documentation and extras_require added.

I have implemented raw HID support myself before, and honestly it's sometimes nicer particularly with the ability to have a more rational path compared to hidapi. But the problem with that is that implementing select/timeout on it is more fragile than HIDAPI, which is why I'm not terribly keen on doing that here.

@zsquareplusc zsquareplusc merged commit 3a6ae5a into pyserial:master Aug 13, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@zsquareplusc

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.