There is no fix as such, but if you attach the WH1080 console through a
USB hub that supports per-port power control then you can reset the
console's interface programmatically when it hangs.
Hello,
i have an wh1080, raspberry pi and pywws and it works normally fine.
but sometimes i have usb connection fail.
root@raspberrypi ~/weather/pywws-12.10_r547> python TestWeatherStation.py
Traceback (most recent call last):
File "TestWeatherStation.py", line 145, in <module>
sys.exit(main())
File "TestWeatherStation.py", line 91, in main
raw_fixed = ws.get_raw_fixed_block()
File "/root/weather/pywws-12.10_r547/pywws/WeatherStation.py", line 578, in get_raw_fixed_block
self._fixed_block = self._read_fixed_block()
File "/root/weather/pywws-12.10_r547/pywws/WeatherStation.py", line 610, in _read_fixed_block
result += self._read_block(mempos)
File "/root/weather/pywws-12.10_r547/pywws/WeatherStation.py", line 598, in _read_block
new_block = self.cusb.read_block(ptr)
File "/root/weather/pywws-12.10_r547/pywws/WeatherStation.py", line 309, in read_block
return self.dev.read_data(32)
File "/root/weather/pywws-12.10_r547/pywws/device_pyusb.py", line 132, in read_data
result = self.devh.interruptRead(0x81, size, 1200)
usb.USBError: Connection timed out
lsusb output:root@raspberrypi ~/weather/pywws-12.10_r547> lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher
the only way to solve this problem is a reset of the wh1080. if i do that i lose all date in the wh1080.
is it possible to fix this???
notwithstanding, it a great program
/* usbreset -- send a USB port reset to a USB device */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
int main(int argc, char **argv)
{
const char *filename;
int fd;
int rc;
if (argc != 2) {
fprintf(stderr, "Usage: usbreset device-filename\n");
return 1;
}
filename = argv[1];
fd = open(filename, O_WRONLY);
if (fd < 0) {
perror("Error opening output file");
return 1;
}
printf("Resetting USB device %s\n", filename);
rc = ioctl(fd, USBDEVFS_RESET, 0);
if (rc < 0) {
perror("Error in ioctl");
return 1;
}
printf("Reset successful\n");
close(fd);
return 0;
}
cc usbreset.c -o usbreset
chmod +x usbreset
lsusb
[root@localhost zurli]# lsusb
Bus 001 Device 002: ID 1941:8021 Dream Link USB Missile Launcher
sudo ./usbreset /dev/bus/usb/001/002
[root@localhost zurli]# sudo ./usbreset /dev/bus/usb/001/002
Resetting USB device /dev/bus/usb/001/002
Reset successful
Hello Tony,Where did you insert this code ? In the weatherstation.py ?Could you send me the modified program where you inserted this snippet of code ?I' ve got the samel problem and wish the problem to be solved, or to find the best workaround.Thanks a lot in advance.Gaëtan