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

running IO error #37

Open
asteriosgr opened this issue Jun 23, 2018 · 16 comments
Open

running IO error #37

asteriosgr opened this issue Jun 23, 2018 · 16 comments

Comments

@asteriosgr
Copy link

When executing sudo python -m decoding-contour-next-link.read_minimed_next24
I am receiving the following:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 1333, in
downloadPumpSession(pumpDownload)
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 1227, in downloadPumpSession
mt.openDevice()
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 759, in openDevice
self.device.open( self.USB_VID, self.USB_PID )
File "hid.pyx", line 66, in hid.device.open
IOError: open failed
Any idea on how to proceed?

@mortlind
Copy link

It is probably lack of privileges to the device. You could try running with sudo or as root. I added the following udev-rule in /etc/udev/rules.d/90-contour-next-link24.rules, which works when the user is a member of dialout. I am not certain if dialout is the appropriate group, though.

 SUBSYSTEM=="usb", ATTRS{idVendor}=="1a79", ATTRS{idProduct}=="6210", ACTION=="add", GROUP="dialout", MODE="0660"

@asteriosgr
Copy link
Author

I have tried both as sudo and as root. Are you certain it is privilege related issue?

@mortlind
Copy link

I had the exact same error when it was a privilege issue for me. It may arise too, I guess, if the device is not present. What does dmesg say when you plug in the device?

@asteriosgr
Copy link
Author

[ 30.160254] usb 1-3: new full-speed USB device number 5 using xhci_hcd
[ 30.312991] usb 1-3: New USB device found, idVendor=1a79, idProduct=7800
[ 30.312998] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 30.313003] usb 1-3: Product: Contour7801-1438844
[ 30.313008] usb 1-3: Manufacturer: AscensiaDiabetesCare
[ 30.313012] usb 1-3: SerialNumber: Contour7801-1438844

@mortlind
Copy link

Hmmm .... that is a different device than mine. I do not know if that makes a difference regarding privileges and permissions.

[121124.965785] usb 1-1.3: new full-speed USB device number 27 using dwc_otg
[121125.104372] usb 1-1.3: New USB device found, idVendor=1a79, idProduct=6210
[121125.104386] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[121125.104395] usb 1-1.3: Product: Contour Link USB Device
[121125.104404] usb 1-1.3: Manufacturer: Bayer HealthCare LLC
[121125.104412] usb 1-1.3: SerialNumber: 0000000001004354
[121125.113952] hid-generic 0003:1A79:6210.000E: hiddev96,hidraw0: USB HID v1.11 Device [Bayer HealthCare LLC Contour Link USB Device] on usb-3f980000.usb-1.3/input0

@asteriosgr
Copy link
Author

Ok is there a file where you define the vendor and product ID?

@mortlind
Copy link

Those come from the device. I use them in the udev-rule to ensure that the device can be used by the dialout group. But this will not help you, if not even root can access the device.

@mortlind
Copy link

Hmmm ... look at my last line from the output of dmesg. There it says that the HID-system recognizes the device. Do you have a similar line? Maybe your device is too new, that the HID-system does not know about it.

@asteriosgr
Copy link
Author

If you could provide me with an output of the python command, when the device is not connected, I would be grateful.

@asteriosgr
Copy link
Author

[ 318.364998] usbcore: registered new interface driver usbhid
[ 318.365000] usbhid: USB HID core driver
[ 318.370933] hid-generic 0003:1A79:7800.0001: hiddev0,hidraw0: USB HID v1.11 Device [AscensiaDiabetesCare Contour7801-1438844] on usb-0000:00:14.0-3/input0
*Also I think it is recognised

@mortlind
Copy link

mortlind commented Jun 23, 2018

Ah, now I see. The device that the code is trying to open is specified at line 742 in read_minimed_next24.py. It is hardcoded, which may mean that the code does only work with the device of USB_PID = 0x6210. But if the binary interface have not changed, you could try substituting 0x7800 for 0x6210 in that line. Then, at least, HID should be able to open the device.

@asteriosgr
Copy link
Author

Yeah device got recognized. Now we reached a point of having invalid packages. E.g.
2018-06-24 03:49:35,568 ERROR [main] Recieved invalid USB packet
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 1333, in
downloadPumpSession(pumpDownload)
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 1229, in downloadPumpSession
mt.getDeviceInfo()
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 807, in getDeviceInfo
msg = self.readMessage()
File "/home/asterios/decoding-contour-next-link/read_minimed_next24.py", line 776, in readMessage
raise RuntimeError( 'Recieved invalid USB packet')
RuntimeError: Recieved invalid USB packet

@mortlind
Copy link

OK. Then this device is probably using a different binary interface. Some of the gurus must help you out here ... @paulokow @pazaan ?

@pazaan
Copy link
Owner

pazaan commented Jun 24, 2018

What kind of device are you connecting with? Is it a Next Link 2.4?

@asteriosgr
Copy link
Author

It is a contour next-one

@andyrozman
Copy link

You can't connect with countour Next One. you need to have one of Contours that has "Link" in name. So Contour Next Link, Contour Link or Contour Next Link 2.4 (for 6xx).

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

4 participants