On 2020-10-22, Mario St-Gelais <mario....@videotron.ca> wrote: > I am attempting to get data from USB or an Accurite Weather Sensor, > model 06006 through python program called weewx. I wrote the weewx dist > list but got no answer so far. I am in foact not sure it's related to > weewx itself as I can not connect to the device even through ipython. > Throuh ipython I get this output: >======================= > /usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py in _check(ret) > 583 if ret < 0: > 584 if ret == LIBUSB_ERROR_NOT_SUPPORTED: > --> 585 raise NotImplementedError(_strerror(ret)) > 586 elif ret == LIBUSB_ERROR_TIMEOUT: > 587 raise USBTimeoutError(_strerror(ret), ret, > _libusb_errno[ret]) > > NotImplementedError: Operation not supported or unimplemented on this > platform > > I of course get similar output if I try the acurite.py drive used by weewx: >=============== > PYTHONPATH=bin doas python3.8 bin/weewx/drivers/acurite.py > > > Traceback (most recent call last): > File "bin/weewx/drivers/acurite.py", line 982, in <module> > with Station() as s: > File "bin/weewx/drivers/acurite.py", line 587, in __enter__ > self.open() > File "bin/weewx/drivers/acurite.py", line 612, in open > self.handle.detachKernelDriver(interface) > File "/usr/local/lib/python3.8/site-packages/usb/legacy.py", line > 294, in detachKernelDriver > self.dev.detach_kernel_driver(interface) > File "/usr/local/lib/python3.8/site-packages/usb/core.py", line 1094, > in detach_kernel_driver > self._ctx.backend.detach_kernel_driver( > File "/usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py", > line 905, in detach_kernel_driver > _check(self.lib.libusb_detach_kernel_driver(dev_handle.handle, intf)) > File "/usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py", > line 585, in _check > raise NotImplementedError(_strerror(ret)) > > NotImplementedError: Operation not supported or unimplemented on this > platform > > usbdevs output: >============= > YTHONPATH=bin doas python3.8 bin/weewx/drivers/acurite.py > > > Traceback (most recent call last): > File "bin/weewx/drivers/acurite.py", line 982, in <module> > with Station() as s: > File "bin/weewx/drivers/acurite.py", line 587, in __enter__ > self.open() > File "bin/weewx/drivers/acurite.py", line 612, in open > self.handle.detachKernelDriver(interface) > File "/usr/local/lib/python3.8/site-packages/usb/legacy.py", line > 294, in detachKernelDriver > self.dev.detach_kernel_driver(interface) > File "/usr/local/lib/python3.8/site-packages/usb/core.py", line 1094, > in detach_kernel_driver > self._ctx.backend.detach_kernel_driver( > File "/usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py", > line 905, in detach_kernel_driver > _check(self.lib.libusb_detach_kernel_driver(dev_handle.handle, intf)) > File "/usr/local/lib/python3.8/site-packages/usb/backend/ > > Could someone shed some light on this. I will provide more info if > required. Any other alternative to access this device? > > usbdevs output: > > doas usbdevs -v -d /dev/usb0 > Controller /dev/usb0: > addr 01: 8086:0000 Intel, xHCI root hub > super speed, self powered, config 1, rev 1.00 > driver: uhub0 > addr 02: 24c0:0003 vendor 0x24c0, Chaney Instrument > low speed, power 100 mA, config 1, rev 0.20 > driver: uhidev0 >
Try removing the call to detachKernelDriver, https://github.com/weewx/weewx/blob/master/bin/weewx/drivers/acurite.py#L610 You can also try building a kernel with the device blacklisted from the uhid driver, it should then attach to ugen(4) which will allow libusb to do more things with it. Diff below; after applying run "make" in sys/dev/usb before building/installing a new kernel. Index: usb_quirks.c =================================================================== RCS file: /cvs/src/sys/dev/usb/usb_quirks.c,v retrieving revision 1.76 diff -u -p -r1.76 usb_quirks.c --- usb_quirks.c 5 Jan 2020 00:54:13 -0000 1.76 +++ usb_quirks.c 22 Oct 2020 10:40:11 -0000 @@ -123,6 +123,7 @@ const struct usbd_quirk_entry { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPAD, ANY, { UQ_BAD_HID }}, { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPAD2, ANY, { UQ_BAD_HID }}, { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_SPEAKERS, ANY, { UQ_BAD_HID }}, + { USB_VENDOR_CHANEY, USB_PRODUCT_CHANEY_ACURITE, ANY, { UQ_BAD_HID }}, { USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_SISPM_OLD, ANY, { UQ_BAD_HID }}, { USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_SISPM, ANY, { UQ_BAD_HID }}, { USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_SISPM_FLASH, ANY, { UQ_BAD_HID }}, Index: usbdevs =================================================================== RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.720 diff -u -p -r1.720 usbdevs --- usbdevs 3 Aug 2020 14:25:44 -0000 1.720 +++ usbdevs 22 Oct 2020 10:40:12 -0000 @@ -630,6 +630,7 @@ vendor ARDUINO 0x2341 Arduino SA vendor TPLINK 0x2357 TP-Link vendor WMR 0x2405 West Mountain Radio vendor TRIPPLITE 0x2478 Tripp-Lite +vendor CHANEY 0x24co Chaney Instrument vendor ARUBA 0x2626 Aruba vendor XIAOMI 0x2717 Xiaomi vendor NHJ 0x2770 NHJ @@ -1302,6 +1303,9 @@ product CHENSOURCE CM12402 0x933d CM1240 /* Cherry products */ product CHERRY MY3000KBD 0x0001 My3000 keyboard product CHERRY MY3000HUB 0x0003 My3000 hub + +/* Chaney Instrument products */ +product CHANEY ACURITE 0x0003 AcuRite Weather Station /* Chic Technology products */ product CHIC MOUSE1 0x0001 mouse