From owner-freebsd-questions@FreeBSD.ORG Mon Jul 21 15:05:26 2008 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 C4D1E1065670 for ; Mon, 21 Jul 2008 15:05:26 +0000 (UTC) (envelope-from chuckr@telenix.org) Received: from mail7.sea5.speakeasy.net (mail7.sea5.speakeasy.net [69.17.117.9]) by mx1.freebsd.org (Postfix) with ESMTP id 8F1A48FC16 for ; Mon, 21 Jul 2008 15:05:26 +0000 (UTC) (envelope-from chuckr@telenix.org) Received: (qmail 3917 invoked from network); 21 Jul 2008 15:05:25 -0000 Received: from april.chuckr.org (HELO april.telenix.org) (chuckr@[66.92.151.30]) (envelope-sender ) by mail7.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 21 Jul 2008 15:05:25 -0000 Message-ID: <4884A5BD.4040603@telenix.org> Date: Mon, 21 Jul 2008 11:05:33 -0400 From: Chuck Robey User-Agent: Thunderbird 2.0.0.6 (X11/20071107) MIME-Version: 1.0 To: Lowell Gilbert References: <48829090.4050508@gmail.com> <44od4r8g9e.fsf@be-well.ilk.org> In-Reply-To: <44od4r8g9e.fsf@be-well.ilk.org> X-Enigmail-Version: 0.95.5 OpenPGP: id=F3DCA0E9; url=http://pgp.mit.edu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org, Andrew Falanga Subject: Re: Reading from USB devices 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, 21 Jul 2008 15:05:26 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Lowell Gilbert wrote: > Andrew Falanga writes: > >> I'd like to read data from a USB device that is not a thumb drive. >> How would I do this? For instance, it's an oximeter for reading >> biometrics. What libraries exist for reading things like VID/PID, and >> most importantly, reading the data from the device? > > Start with usb(4). HID devices tend to be easier to deal with than > others, but I doubt your instruments are in that category. > Actually, if it was a thumb drive, yes it would surely not be a hid device, but an oximeter? Seems like it stands a very good chance, and it's easy enough to check, just see if it can run the uhid driver. If it comes up as the uhid (just kill off the ugen for a run) then it's a uhid. I disagree that its all that easy even then, because you need to know how to read the report descriptor. Kai Wang's krepdump util will give you the report descriptor in binary, and if you needed help in parsing it, I wrote a helpful demonstration hid parser, in python (with a nice GUI), if you have python with tkinter working, then give me a email, I'll email the stuff to you, it's only a 25K tarball. If you read that descriptor, it gives you enough info to be able to parse the stuff coming from the oximeter, so just loop a C program using read(), to pick up the bytes. All the info needed to do that's in the report descriptor. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkiEpbwACgkQz62J6PPcoOlmUQCeKQoRJUa5FpPctCuh1dB0nPDC YpwAnAw2I7a8cg778TBVpioEl7P33BWF =KCaA -----END PGP SIGNATURE-----