1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

Fine Offset Weather Station Reader

This commit is contained in:
Alexander Leidinger 2010-09-01 10:35:12 +00:00
parent 065c12ba87
commit cd20669ff6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=260351
5 changed files with 107 additions and 0 deletions

View File

@ -16,6 +16,7 @@
SUBDIR += cfitsio
SUBDIR += dgpsip
SUBDIR += ephem
SUBDIR += fowsr
SUBDIR += gaia
SUBDIR += gkrellmoon
SUBDIR += gkrellmoon2

37
astro/fowsr/Makefile Normal file
View File

@ -0,0 +1,37 @@
# ports collection makefile for: fowsr
# Date created: 01 Sep 2010
# Whom: Alexander Leidinger
#
# $FreeBSD$
#
PORTNAME= fowsr
PORTVERSION= ${FILEVER}.${FILEDATE}
CATEGORIES= astro
MASTER_SITES= GOOGLE_CODE
DISTNAME= fowsr-${FILEVER}-${FILEDATE}
MAINTAINER= netchild@FreeBSD.org
COMMENT= Fine Offset Weather Station Reader
FILEVER= 1.0
FILEDATE= 20100718
WRKSRC= ${WRKDIR}/${PORTNAME}-${FILEVER}
LICENSE= GPLv3
USE_GMAKE= yes
MAKE_JOBS_SAFE= yes
PLIST_FILES= bin/fowsr
USE_DOS2UNIX= yes
post-patch:
${REINPLACE_CMD} 's:gcc:${CC}:g' ${WRKSRC}/Makefile
${REINPLACE_CMD} 's:/usr/bin/fowsr:fowsr:g ; s://var//://var/tmp//:g' \
${WRKSRC}/*.sh ${WRKSRC}/fowsr.c
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/fowsr ${PREFIX}/bin/
.include <bsd.port.mk>

3
astro/fowsr/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (fowsr-1.0-20100718.tar.gz) = 34a53f0ba60a62636feef3e09d9e4312
SHA256 (fowsr-1.0-20100718.tar.gz) = ec43baea6bfe4523f8b5badd62c0adea239012a9bdd4c0d4d0c3fbc1a3e6ecbb
SIZE (fowsr-1.0-20100718.tar.gz) = 35716

View File

@ -0,0 +1,43 @@
--- fowsr.c.orig 2010-07-18 18:06:30.000000000 +0200
+++ fowsr.c 2010-09-01 10:59:58.004518772 +0200
@@ -110,13 +110,17 @@
signal(SIGTERM, release_usb_device);
+#ifdef LIBUSB_HAS_GET_DRIVER_NP
ret = usb_get_driver_np(devh, 0, buf, sizeof(buf));
printf("usb_get_driver_np returned %d\n", ret);
if (ret == 0) {
printf("interface 0 already claimed by driver \\'%s\\', attempting to detach it\n", buf);
+#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
ret = usb_detach_kernel_driver_np(devh, 0);
printf("usb_detach_kernel_driver_np returned %d\n", ret);
+#endif
}
+#endif
ret = usb_claim_interface(devh, 0);
if (ret != 0) {
printf("claim failed with error %d\n", ret);
@@ -159,12 +163,14 @@
FILE* f;
if (isStoring == ISREADING) {
if (f=fopen(fname,"rb")) {
+ printf("using cache file %s\n", fname);
n=fread(&m_previous_timestamp,sizeof(m_previous_timestamp),1,f);
n=fread(m_buf,sizeof(m_buf[0]),WS_BUFFER_SIZE,f);
}
print_bytes((char *)&m_previous_timestamp, sizeof(time_t));
} else { // ISWRITING
if (f=fopen(fname,"wb")) {
+ printf("updating cache file %s\n", fname);
n=fwrite(&m_timestamp,sizeof(m_timestamp),1,f);
n=fwrite(m_buf,sizeof(m_buf[0]),WS_BUFFER_SIZE,f);
}
@@ -566,6 +572,7 @@
FILE* f;
if (f=fopen(fname,"a+s")) {
+ printf("writing to %s\n", fname);
// Header
switch (arg) {

23
astro/fowsr/pkg-descr Normal file
View File

@ -0,0 +1,23 @@
fowsr is an application that reads from wireless weather stations
* WH1080 / WH1081 / WH1090 / WH1091 / WH2080 / WH2081
* Watson W-8681
* Scientific Sales Pro Touch Screen Weather Station
* TOPCOM NATIONAL GEOGRAPHIC 265NE
* PCE-FWS 20
* ...
and other similar USB devices from Fine Offset Electronics Co., LTD.
compatible with the EasyWeather application .
The result is a weather history log file that can be uploaded to a central
server for further processing. Example script files for uploads is included.
So far the following formats are supported:
* Weather Underground
* pywws
* XML
fowsr performs a complete read out of the weather station memory using its
USB port, and stores the result in a cache file to speed up later read-outs.
Rain data is then calculated per hour, day, week and month if data for these
periods exist. No further data processing is performed. This makes fowsr
very small and well suited for running in embedded devices at remote
locations.