storborg/pyminicircuits

get_serial() not returning when running from Rapbery pi

Opened this issue · 4 comments

Hi,

I have a raspberry pi Linux mypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux which i would like to controll a miniciruits attenuator using pyminicircuits. i have this working in python3 on a PC and i have this working on a ubuntu environment but the raspberry is either reporting :

Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyminicircuits import Attenuator
>>>
>>> a = Attenuator()
Failed to open device. You may need to follow these steps:

Install dependencies:

    $ sudo apt install libudev-dev
    $ pip install hidapi

Create a new file /etc/udev/rules.d/85-minicircuits.rules with:

    ATTR{idVendor}=="20ce", MODE="660", GROUP="plugdev"

This will tell udev to allow members of the plugdev group to access all
Mini-Circuits USB devices.

Ensure that your user is a member of the plugdev group:

    $ sudo usermod -a -G plugdev <username>

Reload the udev rules:

    $ sudo udevadm control --reload-rules
    $ sudo udevadm trigger

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/pyminicircuits/__init__.py", line 38, in __init__
    self.h.open(vid, pid)
  File "hid.pyx", line 66, in hid.device.open
OSError: open failed

or not returning from any of the sub functions like get_serial()

I have done the steps mentioned but i always get these results do you have any tips for me? id like to use this on my target

Br Martijn

Can you have a look at dmesg and see if you see any output related to the attenuator USB device? This may the biggest indicator of some kind of USB error.

Also, which attenuator model are you using? Particularly, is it one of the USB-only models or USB+ethernet?

Hi Scot,

do you have any update on this topic? anything else you would want me to try??

Br Martijn

Hi, sorry, I've been meaning to try to grab an RCDAT and a Pi and try this but haven't gotten it yet.

My guess is that this is related to the usbhid support on that kernel build, or the USB permissions. Some things you could try:

  • Does a normal keyboard (or other usbhid device) work?
  • Can you try running Python as root (to see if it's a permissions issue)?

Also, I'm not quite sure from your message: when you cleared dmesg and then ran the test, did you plug in the device after clearing dmesg? If not, can you try that, and post the dmesg output you get when plugging in the device?