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

Segfault on OS X #8

Closed
pepijndevos opened this issue Feb 20, 2015 · 7 comments
Closed

Segfault on OS X #8

pepijndevos opened this issue Feb 20, 2015 · 7 comments

Comments

@pepijndevos
Copy link

I just did a pip install, so I have version 0.7.99-5, running on Python 3.4.

$ python3
Python 3.4.2 (default, Oct 30 2014, 14:56:46) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
>>> dev = hid.device(5824, 1158)
>>> dev.read(64)
Segmentation fault: 11
@prusnak
Copy link
Member

prusnak commented Feb 20, 2015

Read https://github.com/trezor/cython-hidapi/blob/master/try.py

You are using library incorrectly. Correct way is:

>>> import hid
>>> dev = hid.device()
>>> dev.open(5824, 1158)
>>> dev.read(64)

@prusnak prusnak closed this as completed Feb 20, 2015
@pepijndevos
Copy link
Author

Oh derp. Would it make sense to add a null check for groggy people like me? Anyway, thanks, I'll give it another go.

@prusnak
Copy link
Member

prusnak commented Feb 20, 2015

This is a hidapi issue, not cython-hidapi. But feel free to create a pull request.

@pepijndevos
Copy link
Author

Not really related to this issue, but while I have a communication channel open, I have two entries for the same vendor and product. One is my raw HID device, the other is the emulated serial from the Teensy. Your suggested code just picks one at random it seems. The way to tell them apart is by the usage field. https://forum.pjrc.com/archive/index.php/t-6838.html

@prusnak
Copy link
Member

prusnak commented Feb 20, 2015

Better way is to enumerate devices using enumerate method and then open the one you want using open_path method.

@pepijndevos
Copy link
Author

The path is also the same. But HIDAPI has the same limitation: signal11/hidapi#193 So I'm fucked until that patch gets merged, or I build this project from source with the patch applied.

@prusnak
Copy link
Member

prusnak commented Feb 21, 2015

That's really stupid. Blame crappy OS X USB stack ... :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants