New Version 2.0

174 views
Skip to first unread message

Josch 600

unread,
Aug 30, 2013, 5:43:09 PM8/30/13
to fo...@googlegroups.com
Hi folks,

I wanted to use fowsr to connect a WS-0101 weatherstation to a raspberri pi. While dealing with the task to get it run some errors came up. I also needed a different format with output to stdout. So I decided to extend the sources in the way I needed and to fix the found bugs. Now I'm done with this. Because of major changes in option handling I increased the version number to 2.0.
The function of fowsr has been tested with the WS-0101 weather station on UBUNTU 12.10 and RASPBIAN WHEEZY using the WS3600 format.
I hope, that the other formats work as they did before because I left them almost unchanged (order has changed: now oldest to newest dataset). The new sources can be found in the repository. The scripts are not tested, I did only replace the old options by the new ones. Would be nice to hear, if it also works for others.

Enjoy!
Josch

How I got it work (Logged in as 'me'):

group for weather handling
  • 'sudo addgroup --system weather'            --> make a group for all weather related stuff
  • 'sudo adduser me weather'                        --> add the actual user 'me'

FOWSR application
  • 'mkdir /home/me/fowsr'
  • copy fowsr.c, fowsr.h and makefile into it
  • set the appropriate log path in fowsr.c (/var/log/fowsr)
  • install development files for libusb0.1-4 (on ubuntu: package libusb-dev)
  • 'make'                                                             --> build fowsr
  • 'sudo chgrp weather ./fowsr'
  • 'chmod g+s fowsr'                                         --> ensures, that files written by fowsr are owned by the caller of fowsr

log folder
  • 'mkdir /var/log/fowsr'
  • me as owner and weather as group to allow write access for fowsr:
  •    'sudo chown fhem /var/log/fowsr'
  •    'sudo chgrp weather /var/log/fowsr'
  • set group subst bit with 'chmod g+s /var/log/fowsr', so written Files are owned by the group
  • 'chmod g+w /var/log/fowsr'  --> write access for the group

USB connection
  • connect the weather station to the usb port
  • 'ls -l /dev/usb/hiddev0'                                    --> shows root as owner and group:
crw------- 1 root root 180, 96 Jul  4 15:36 /dev/usb/hiddev0

  • we need an udev rule to change the group to 'weather', so appropriate attributes have to be discovered. See tutorial at

  • 'sudo nano /etc/udev/rules.d/38-weather-station.rules'    --> create UDEV rule with following content (has to be  modified according to the tutorial above:
# WS-0101 Weather Station from Pollin
ACTION!="add|change", GOTO="weather_station_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1941", ATTRS{idProduct}=="8021", GROUP="weather"

LABEL="weather_station_end"

  • reboot computer, then 'ls -l /dev/usb/hiddev0' should give the requested write access for group 'weather':
crw-rw---- 1 root weather 180, 0 Mai 15 22:47 /dev/usb/hiddev0
crw-rw---T 1 root weather 180, 96 Jan  1  1970 hiddev0

FOWSR invocation
  • copy the executable to an appropriate folder (e.g. /usr/bin) or use it from where you built it
  • call it manually or cyclic by a cron job with the appropriate options, i.e. if you want
  • detailed error logging into file (caution: error log can grow extensively, it will not be clipped, so for longterm use a max. Loglevel of '1' is recommended)
  • every day a new pws weather data file into the folder /home/me/weatherdata, then call:
'fowsr -fs -n/home/me/weatherdata/PWSLog%Y-%m-%d.log -v3f'
  • cache file and error log are always written to /var/log/fowsr. If you don't specify '-n', the data is written also there.
  • call FOWSR without parameters to get a detailed description of options.

James Nichols

unread,
Sep 15, 2013, 7:43:47 AM9/15/13
to fo...@googlegroups.com
Hello,
I'd like to compile your source for OpenWRT 12.09 / ar71xx.
I tried the build instructions from OpenWRT without success.
Could I use your ubuntu instructions and copy the build files to my router?

cheers,
James

Josch

unread,
Sep 16, 2013, 3:30:43 PM9/16/13
to fo...@googlegroups.com
Hi James,

I think the instructions are similar for ubuntu and OpenWrt, but I don't know exactly because I don't have OpenWrt. Important is to have libusb0.1 installed.
If your router and your ubuntu machine have the same processor, then it could also work to compile on ubuntu and copy the binary to the router. But I think it's better to compile on the router.

Josch

James Nichols

unread,
Sep 17, 2013, 12:37:12 AM9/17/13
to fo...@googlegroups.com
Thanks for the reply!  

I actually found the missing link I needed to compile an OpenWRT package here:
Might help to add that link to the wiki custom build instructions.

https://code.google.com/p/fowsr/wiki/OpenWrt


Now I'm stuck on a dependency for libusb-compat.
I'll try compiling fowsr v1.0 next to see if I get the same error.
Do you have any ideas?
Should I put this in a new thread?


OpenWRT dependency for libusb-compat:
root@OpenWrt:~# opkg install /tmp/fowsr_2.0.130910-1_ar71xx.ipk
Upgrading fowsr on root from 1.0-20110904-1 to 2.0.130910-1...
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for fowsr:
 * libusb-compat * 
 * opkg_install_cmd: Cannot install package fowsr.

Relevant output from make (anything with to "usb" in it):
make[2]: Entering directory `/media/extra/openwrt/trunk/package/libs/libusb'
if [ -f /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb.default.install.clean ]; then rm -f /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb.default.install /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb.default.install.clean; fi; echo "libusb-1.0" >> /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb.default.install
make[2]: Leaving directory `/media/extra/openwrt/trunk/package/libs/libusb'
make[2]: Entering directory `/media/extra/openwrt/trunk/package/libs/libusb-compat'
if [ -f /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb-compat.default.install.clean ]; then rm -f /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb-compat.default.install /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb-compat.default.install.clean; fi; echo "libusb-compat" >> /media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/libusb-compat.default.install
make[2]: Leaving directory `/media/extra/openwrt/trunk/package/libs/libusb-compat'
make[2]: Entering directory `/media/extra/openwrt/trunk/feeds/packages/utils/fowsr'

And

make[3]: Entering directory `/media/extra/openwrt/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/fowsr-2.0.130910'
mips-openwrt-linux-uclibc-gcc -o fowsr fowsr.c -L/media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib -L/media/extra/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/lib -L/media/extra/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib -L/media/extra/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib  -lm -lusb -g
cc1: note: someone does not honour COPTS correctly, passed 0 times
make[3]: Leaving directory `/media/extra/openwrt/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/fowsr-2.0.130910'

And

( echo "Package: fowsr"; echo "Version: 2.0.130910-1"; DEPENDS=''; for depend in libc libusb-compat; do DEPENDS=${DEPENDS:+$DEPENDS, }${depend##+}; done; [ -z "$DEPENDS" ] || echo "Depends: $DEPENDS";  echo "Source: feeds/packages/utils/fowsr";  echo "SourceFile: fowsr-2.0.130910.tar.gz";   echo "SourceURL: http://fowsr.googlecode.com/files";    echo "Section: utils";    echo "Architecture: ar71xx"; echo "Installed-Size: 0"; echo -n "Description: "; . /media/extra/openwrt/trunk/include/shell.sh; getvar V_Package_fowsr_description | sed -e 's,^[[:space:]]*, ,g'; ) > /media/extra/openwrt/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/fowsr-2.0.130910/ipkg-ar71xx/fowsr/CONTROL/control


Cheers,
James
Reply all
Reply to author
Forward
0 new messages