Weewx has problems finding USB device

353 views
Skip to first unread message

Hiljo Lodewijk

unread,
Jun 17, 2018, 3:51:20 AM6/17/18
to weewx-user
Hello everyone,

I’ve been running Weewx on my Synology NAS DS216+II for about 4 years now. I always used the attached manual to install Weewx. This worked great. Untill a recent update of the OS. Suddenly Weewx cannot find the USB device of my TFA Primus anymore..

The USB device is attached. The command lsusb shows:
Bus 001 Device 002: ID 6666:5555
Bus 001 Device 003: ID f400:f400
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003

When I run weewx I get exception 'No backend available'. More users have had this error. The problem of most users is that python cannot find the USB modules.

The strange thing is that if I run python on the command line, it cannot find the libUSB library first, but if I import it manually (import usb.backend.libusb01), it does work. See below:

$ python
Python 2.7.12 (default, May 15 2018, 03:33:53)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import usb
>>> usb.core.find()
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
 
File "/usr/lib/python2.7/site-packages/usb/core.py", line 829, in find
   
raise ValueError('No backend available')
ValueError: No backend available
>>> import usb.backend.libusb01
>>> usb.core.find()
<usb.core.Device object at 0x7f3d511fb250>

So my question is that if it is possible to import the usb.backend.libusb01 library somewhere in the Weewx core (or driver) to make it run correctly again.
I already tried to import it in the WS28xx.py file, but that doesn’t work unfortunately. Any ideas for help?

Thanks in advance!
Install weewx on Synology NAS-new.docx

Thomas Keffer

unread,
Jun 17, 2018, 8:49:27 AM6/17/18
to weewx-user
It looks like the underlying "C" library is missing. Try this:

find /usr/lib -name "libusb*"

If it is missing, you may have to install it.

-tk


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bernhard Frieß

unread,
Jun 17, 2018, 1:54:17 PM6/17/18
to weewx-user
Hi There,

I had the same error message as you although I was about to install weewx on OpenWRT and not on a synology running DSM. I found a solution for my problem and if you're interested you can read through it at https://groups.google.com/forum/#!topic/weewx-user/sY5TJijPPv8.

I also updated the wiki page about running weewx on OpenWRT at https://github.com/weewx/weewx/wiki/weewx-on-openwrt.

The original description gave the impression that there is only an issue with a specific driver wmr200.py while it looks to me know that all drivers are affected which are relying on USB.

Perhaps this helps you as well?

Best regards

Bernhard
Message has been deleted

Hiljo Lodewijk

unread,
Apr 11, 2019, 3:35:22 PM4/11/19
to weewx-user
I've managed to get the WS2800 driver working by doing the same as Bernhard has done:

Then to fix error with backend driver missing you need to help the /home/weewx/bin/weewx/drivers/wmr200.py driver file find the installed usb driver:

import usb

import usb.backend.libusb1
backend
= usb.backend.libusb1.get_backend(find_library=lambda x: "/usr/lib/libusb-1.0.so")


before:
import usb

import weewx.drivers

after:
import usb

import usb.backend.libusb1
backend
= usb.backend.libusb1.get_backend(find_library=lambda x: "/usr/lib/libusb-1.0.so")

import weewx.drivers



Op zondag 17 juni 2018 09:51:20 UTC+2 schreef Hiljo Lodewijk:

vince

unread,
Apr 11, 2019, 3:49:17 PM4/11/19
to weewx-user
On Thursday, April 11, 2019 at 12:35:22 PM UTC-7, Hiljo Lodewijk wrote:
I've managed to get the WS2800 driver working by doing the same as Bernhard has done:

Then to fix error with backend driver missing you need to help the /home/weewx/bin/weewx/drivers/wmr200.py driver file find the installed usb driver:

import usb

import usb.backend.libusb1
backend
= usb.backend.libusb1.get_backend(find_library=lambda x: "/usr/lib/libusb-1.0.so")


That is going to be a problem when somebody uses a different version of the library or runs on a different operating system.  Hard-coding things like this in a 'one size fits all' piece of software is rarely a good idea.....


Thomas Keffer

unread,
Apr 11, 2019, 4:41:46 PM4/11/19
to weewx-user
See this thread. In that particular instance, the problem was a missing copy of ldconfig on the user's operating system.

Hiljo Lodewijk

unread,
Apr 17, 2019, 3:04:08 PM4/17/19
to weewx-user
I do agree that there is a problem with my configuration (Synology NAS). But i've tried many ways to fix this problem. Currently this is the fastest solution.


Op donderdag 11 april 2019 22:41:46 UTC+2 schreef Thomas Keffer:
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Thomas Keffer

unread,
Apr 17, 2019, 10:15:51 PM4/17/19
to weewx-user
That's fine. Just remember to reapply the fix if/when you upgrade. 

To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages