From owner-freebsd-questions@FreeBSD.ORG Mon Nov 23 18:41:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C02E1065676 for ; Mon, 23 Nov 2009 18:41:38 +0000 (UTC) (envelope-from oli.garnier@wanadoo.fr) Received: from smtp2b.orange.fr (smtp2b.orange.fr [80.12.242.146]) by mx1.freebsd.org (Postfix) with ESMTP id 9A2108FC1B for ; Mon, 23 Nov 2009 18:41:37 +0000 (UTC) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2b22.orange.fr (SMTP Server) with ESMTP id 7CDEB7000121 for ; Mon, 23 Nov 2009 19:41:36 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2b22.orange.fr (SMTP Server) with ESMTP id 702EB7000158 for ; Mon, 23 Nov 2009 19:41:36 +0100 (CET) Received: from [127.0.0.1] (ALagny-155-1-11-24.w90-3.abo.wanadoo.fr [90.3.154.24]) by mwinf2b22.orange.fr (SMTP Server) with ESMTP id F27697000121 for ; Mon, 23 Nov 2009 19:41:35 +0100 (CET) X-ME-UUID: 20091123184135995.F27697000121@mwinf2b22.orange.fr Message-ID: <4B0AD75B.6090002@wanadoo.fr> Date: Mon, 23 Nov 2009 19:41:31 +0100 From: Olivier GARNIER User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4B0A94C7.9030400@wanadoo.fr> <20091123174531.GA49267@slackbox.xs4all.nl> In-Reply-To: <20091123174531.GA49267@slackbox.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 091123-1, 23/11/2009), Outbound message X-Antivirus-Status: Clean Subject: Re: read/write data on usb weather station WMR100 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2009 18:41:38 -0000 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: 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 // 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