matthewwall / weewx-hp3000

weewx driver for fine offset hp3000 temperature/humidity sensors
GNU General Public License v3.0
5 stars 5 forks source link

USBError with HP3000 on RaspberryPi 3 #2

Open tommy3824 opened 6 years ago

tommy3824 commented 6 years ago

I was about to go through the tedious process of decoding packets when I came across this driver. It is really great you went through the effort to make a driver for the WS-3000 weather station, thank you!

Anyways, it looks like everything installed correctly as it starts up with no issues and finds my device. However, when it starts the main packet loop, I get an USB error when the program tries to send a message. I have embedded programming experience but when it comes to Linux/Raspbian I usually have to google my way through for answers. I am sure I am not setting up something correctly ( I usually find it to be permissions related) or not doing something simple but I have not been able to figure it out yet. I was hoping you may be able to help me? Below is the log when I start weewx, let me know if you need anything else. Thank you in advance.

Nov 30 13:05:42 raspberrypi systemd[1]: Starting LSB: weewx weather system... Nov 30 13:05:42 raspberrypi weewx[1418]: engine: Initializing weewx version 3.8.0a2 Nov 30 13:05:42 raspberrypi weewx[1418]: engine: Using Python 2.7.9 (default, Sep 17 2016, 20:26:04] Nov 30 13:05:42 raspberrypi weewx[1418]: engine: Platform Linux-4.9.35-v7+-armv7l-with-debian-8.0 Nov 30 13:05:42 raspberrypi weewx[1418]: engine: Locale is 'en_GB.UTF-8' Nov 30 13:05:42 raspberrypi weewx[1418]: engine: pid file is /var/run/weewx.pid Nov 30 13:05:42 raspberrypi weewx[1422]: engine: Using configuration file /home/weewx/weewx.conf Nov 30 13:05:42 raspberrypi weewx[1422]: engine: Loading station type HP3000 (user.hp3000) Nov 30 13:05:42 raspberrypi weewx[1408]: Starting weewx weather system: weewx. Nov 30 13:05:42 raspberrypi systemd[1]: Started LSB: weewx weather system. Nov 30 13:05:43 raspberrypi weewx[1422]: hp3000: driver version is 0.5 Nov 30 13:05:43 raspberrypi weewx[1422]: hp3000: usb info: pyusb_version=1.0.2 Nov 30 13:05:43 raspberrypi weewx[1422]: hp3000: sensor map: {'outHumidity': 'h_2', 'extraHumid6': } Nov 30 13:05:43 raspberrypi weewx[1422]: usbhid: pyusb_version=1.0.2 Nov 30 13:05:43 raspberrypi weewx[1422]: usbhid: Found USB device with VendorID=0x0483 ProductID=0x0 Nov 30 13:05:43 raspberrypi weewx[1422]: engine: StdConvert target unit is 0x1 Nov 30 13:05:43 raspberrypi weewx[1422]: wxcalculate: The following values will be calculated: baroe Nov 30 13:05:43 raspberrypi weewx[1422]: wxcalculate: The following algorithms will be used for calS Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Archive will use data binding wx_binding Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Record generation will be attempted in 'software' Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Using archive interval of 300 seconds (specified i) Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Using binding 'wx_binding' to database 'weewx.sdb' Nov 30 13:05:43 raspberrypi weewx[1422]: manager: Starting backfill of daily summaries Nov 30 13:05:43 raspberrypi weewx[1422]: restx: StationRegistry: Registration not requested. Nov 30 13:05:43 raspberrypi weewx[1422]: restx: Wunderground: Posting not enabled. Nov 30 13:05:43 raspberrypi weewx[1422]: restx: PWSweather: Posting not enabled. Nov 30 13:05:43 raspberrypi weewx[1422]: restx: CWOP: Posting not enabled. Nov 30 13:05:43 raspberrypi weewx[1422]: restx: WOW: Posting not enabled. Nov 30 13:05:43 raspberrypi weewx[1422]: restx: AWEKAS: Posting not enabled. Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Starting up weewx version 3.8.0a2 Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Starting main packet loop. Nov 30 13:05:43 raspberrypi weewx[1422]: engine: Caught unrecoverable exception in engine: Nov 30 13:05:43 raspberrypi weewx[1422]: [Errno 32] Pipe error Nov 30 13:05:43 raspberrypi weewx[1422]: Traceback (most recent call last): Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/weewx/engine.py", line 8n Nov 30 13:05:43 raspberrypi weewx[1422]: engine.run() Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/weewx/engine.py", line 1n Nov 30 13:05:43 raspberrypi weewx[1422]: for packet in self.console.genLoopPackets(): Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/user/hp3000.py", line 45s Nov 30 13:05:43 raspberrypi weewx[1422]: self._station.send_sequence() Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/user/hp3000.py", line 51e Nov 30 13:05:43 raspberrypi weewx[1422]: self.send_cmd(0x06) Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/user/hp3000.py", line 51d Nov 30 13:05:43 raspberrypi weewx[1422]: self.write([0x7b, cmd, 0x40, 0x7d]) Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/user/hp3000.py", line 49e Nov 30 13:05:43 raspberrypi weewx[1422]: return self._write(buf) Nov 30 13:05:43 raspberrypi weewx[1422]: File "/home/weewx/bin/weeusb/usbhid_pyusb1.py"e Nov 30 13:05:43 raspberrypi weewx[1422]: timeout=timeout) Nov 30 13:05:43 raspberrypi weewx[1422]: File "build/bdist.linux-armv7l/egg/usb/core.pyr Nov 30 13:05:43 raspberrypi weewx[1422]: self.__get_timeout(timeout)) Nov 30 13:05:43 raspberrypi weewx[1422]: File "build/bdist.linux-armv7l/egg/usb/backendr Nov 30 13:05:43 raspberrypi weewx[1422]: timeout)) Nov 30 13:05:43 raspberrypi weewx[1422]: File "build/bdist.linux-armv7l/egg/usb/backendk Nov 30 13:05:43 raspberrypi weewx[1422]: raise USBError(_strerror(ret), ret, libusb) Nov 30 13:05:43 raspberrypi weewx[1422]: USBError: [Errno 32] Pipe error Nov 30 13:05:43 raspberrypi weewx[1422]: Exiting.

matthewwall commented 6 years ago

are you using the usb branch of weewx?

tommy3824 commented 6 years ago

I am pretty sure. I followed your instructions in the other post from issue#1 doing:

git clone https://github.com/weewx/weewx cd weewx git checkout usb ./setup.py install

It looks like it can open the USB device, I'm guessing it wouldn't get that far in the other version? For some reason it isn't able to write to the endpoint. I also added a USB rule to give the hub's product id and vendor id full access when connected hoping that would solve it. Any thoughts? Still seems like a permissions thing.

hyvenglaven commented 5 years ago

@tommy3824 did you ever figure out a fix for this? I am running into the same issue. I run the following as superuser, btw, otherwise I never get past a message on insufficient permissions to claim the USB interface.

@matthewwall I also followed the instructions for installing the usb branch of weewx. Any thoughts?

/home/michael/Documents/weewx/bin/user# PYTHONPATH=/home/michael/Documents/weewx/bin python hp3000.py
Traceback (most recent call last):
  File "hp3000.py", line 658, in <module>
    s.send_sequence()
  File "hp3000.py", line 520, in send_sequence
    self.send_cmd(0x06)
  File "hp3000.py", line 517, in send_cmd
    self.write([0x7b, cmd, 0x40, 0x7d])
  File "hp3000.py", line 493, in write
    return self._write(buf)
  File "/home/michael/Documents/weewx/bin/weeusb/usbhid_pyusb1.py", line 83, in _write
    timeout=timeout)
  File "/usr/lib/python2.7/dist-packages/usb/core.py", line 971, in ctrl_transfer
    self.__get_timeout(timeout))
  File "/usr/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 819, in ctrl_transfer
    timeout))
  File "/usr/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 552, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 32] Pipe error