Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 2009 19:41:31 +0100
From:      Olivier GARNIER <oli.garnier@wanadoo.fr>
To:        freebsd-questions@freebsd.org
Subject:   Re: read/write data on usb weather station WMR100
Message-ID:  <4B0AD75B.6090002@wanadoo.fr>
In-Reply-To: <20091123174531.GA49267@slackbox.xs4all.nl>
References:  <4B0A94C7.9030400@wanadoo.fr> <20091123174531.GA49267@slackbox.xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Roland Smith a écrit :
> On Mon, Nov 23, 2009 at 02:57:27PM +0100, Olivier GARNIER wrote:
>   
>> Hi,
>>
>> I have an usb weather station (oregon wmr100).
>> It's an usb device only.
>> I want to be able to get data from it (T°, H°, wind, ...)
>>     
> This machine probably only comes with windoze software? If you don't know the
> protocol for data exchange used between the hard- and software it might be
> difficult getting it to work on FreeBSD.
>   
I've found some internet site witch speak about it. I've asked oregon, 
but they do not want to talk about it...
> There seems to be a Linux program (WeatherD) that works with this
> station. Maybe you can get that to work? Or you could try running the windows
> softere under emulators/wine.
>   
Yes, but i want to get back data and put it in a postgresql database, 
and i found no way to use it as i want.
>> I tried to use libusb to make a c software but it seems not to work 
>> (exemple witch are in /usr/ports/devel/libusb/work/...test/ do not work).
>>     
> Can you elaborate a bit? This is too little info for anyone to help you.
> If you plug the device in, do you see an ugen device being created? What does
> dmesg report?
>   
When I plug in and out the device that's what i see :
uhid0: <vendor 0x0fde Universal Bridge, class 0/0, rev 1.10/3.02, addr 
2> on uhub0
uhid0: at uhub0 port 1 (addr 2) disconnected
uhid0: detached

# pkg_info | grep libusb
libusb-0.1.12_4     Library giving userland programs access to USB devices

# cd /usr/ports/devel/libusb/work/libusb-0.1.12/tests
#  ./descriptor_test
bus/device  idVendor/idProduct
# ./find_hubs
Class/SubClass/Protocol
#  ./find_mice
idVendor/idProduct/bcdDevice
# ./get_resolution
idVendor/idProduct/bcdDevice
# ./hub_strings
Class/SubClass/Protocol
#./id_test
bus/device  idVendor/idProduct/bcdDevice  Class/SubClass/Protocol
# ./testlibusb

As it does not work i tried this i named test.c :
#include <usb.h>
// discover devices
libusb_device **list;
libusb_device *found = NULL;
ssize_t cnt = libusb_get_device_list(NULL, &list);
ssize_t i = 0;
int err = 0;
if (cnt < 0)
  error();
for (i = 0; i < cnt; i++) {
  libusb_device *device = list[i];
  if (is_interesting(device)) {
    found = device;
    break;
  }
 }
if (found) {
  libusb_device_handle *handle;
  err = libusb_open(found, &handle);
  if (err)
    error();
}
libusb_free_device_list(list, 1);

But it seems not to work
# make
gcc -g -Wall -c test.c
test.c:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 
'*' token
test.c:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 
'*' token
test.c:6: warning: implicit declaration of function 'libusb_get_device_list'
test.c:6: error: 'list' undeclared here (not in a function)
test.c:6: error: initializer element is not constant
test.c:9: error: expected identifier or '(' before 'if'
test.c:12: error: expected identifier or '(' before 'for'
test.c:12: error: expected '=', ',', ';', 'asm' or '__attribute__' 
before '<' token
test.c:12: error: expected '=', ',', ';', 'asm' or '__attribute__' 
before '++' token
test.c:20: error: expected identifier or '(' before 'if'
test.c:29: error: expected ')' before numeric constant
*** Error code 1


As it always not work, i look after something else.
I found this http://www.castro.aus.net/~maurice/usb/panic/panicbutton.tar.gz
When i modifie it a little this is what it give me :
# ./wmr100
-device: Trouve le device cherche : IDVendeur FDE, IDProduit : CA01, 
IDNom : Universal Bridge
-device: uhid0

so i know i can find the device (i expect i can also speak with it)
I don't know how i can use libusb ....


>> I've seen what's written on /usr/ports/UPDATING (20090309) so i 
>> reinstall libusb
>>     
> The note you reference only affected what was then CURRENT, i.e. what is now
> 8.0-PRERELEASE. It shouldn't bother people on 7.x.
>
>   
>> But it since doesn't work. libusb will not work with FreeBSD 7.0 ?
>>     
> It works.
>
> Roland
>   

Thanks you,

Olivier





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B0AD75B.6090002>