From owner-freebsd-usb@FreeBSD.ORG Wed Dec 1 22:59:04 2004 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D85DD16A4CE for ; Wed, 1 Dec 2004 22:59:04 +0000 (GMT) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id A579343D1D for ; Wed, 1 Dec 2004 22:59:04 +0000 (GMT) (envelope-from fernando@bsdmail.org) Received: from wfilter.us4.outblaze.com (wfilter.us4.outblaze.com [205.158.62.180])89EB618001A4 for ; Wed, 1 Dec 2004 22:59:04 +0000 (GMT) X-OB-Received: from unknown (205.158.62.86) by wfilter.us4.outblaze.com; 1 Dec 2004 22:59:04 -0000 Received: by ws5-4.us4.outblaze.com (Postfix, from userid 1001) id 35FA323EF6B; Wed, 1 Dec 2004 22:59:03 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received: from [216.213.8.24] by ws5-4.us4.outblaze.com with http for fernando@bsdmail.org; Thu, 02 Dec 2004 06:59:03 +0800 From: "Fernando Durango" To: freebsd-usb@freebsd.org Date: Thu, 02 Dec 2004 06:59:03 +0800 X-Originating-Ip: 216.213.8.24 X-Originating-Server: ws5-4.us4.outblaze.com Message-Id: <20041201225903.35FA323EF6B@ws5-4.us4.outblaze.com> Subject: Fw: trouble sending bytes to uhid (Griffin PowerMate on 5.3-STABLE/i386) X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Dec 2004 22:59:05 -0000 Hello all, I originally posted this to hackers@ a while back. Mathew Kanner suggested I try NetBSD as their USB framework seemed a bit more up to date. Then I noticed the new usb@ list and figured I'd try my request here. TIA, -F ----- Original Message ----- From: "Fernando Durango" To: freebsd-hackers@freebsd.org Subject: trouble sending bytes to uhid (Griffin PowerMate on 5.3-STABLE/i38= 6) Date: Wed, 17 Nov 2004 03:36:11 +0800 >=20 > Hello all, >=20 > I have a Griffin PowerMate[1] that I would love to be able to manipulate > via uhid on FreeBSD. Running a USB sniffer on a win32 box shows the device > spews 6 bytes of data on dial movement and/or button pressing, and the pc > sending one byte to the PowerMate occasionally, which seems to effect LED > brightness on the Powermate. I am able to read and interpret the device > output with perl(sysopen & sysread), but I am unable to send bytes back to > the device (syswrite). >=20 > The device shows up as follows: > $ dmesg | grep uhid > uhid0: Griffin Technology, Inc. Griffin PowerMate, rev 1.00/4.00,=20 > addr 2, iclass 3/0 > $ usbdevs -d -v > addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),=20 > Intel(0x0000), rev 1.00 > uhub1 > port 1 addr 2: low speed, power 100 mA, config 1, Griffin=20 > PowerMate(0x0410), Griffin Technology, Inc.(0x077d), rev 4.00 > uhid0 > $ usbhidctl -r -f /dev/uhid0 > Report descriptor: > Collection page=3DConsumer usage=3DConsumer_Control > Input size=3D1 count=3D1 page=3DButton usage=3DButton_1, logical range = 0..1 > Input size=3D8 count=3D1 page=3DGeneric_Desktop usage=3DRx, logical ran= ge -127..127 > Input size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Input size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Input size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Input size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Output size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > Feature size=3D8 count=3D1 page=3DConsumer usage=3DConsumer_Control,=20 > logical range 0..255 > End collection > Total input size 6 bytes > Total output size 0 bytes > Total feature size 0 bytes >=20 > perl code for reading: > sysopen(DATA, "/dev/uhid0", O_RDONLY | O_NODELAY | O_BINARY) > or die "could not open $device!\n"; >=20 > while (1) { > my $buf; > if (sysread(DATA, $buf, 6)) { > my @ascii =3D map { ord } split //, $buf; > foreach ( @ascii ) { > print "$_\t"; > } > print "\n"; > } > } >=20 > perl code for writing: > sysopen(DATA, "/dev/uhid0", O_RDWR) > or die "could not open $device!\n"; >=20 > $val =3D 0xff; > if (length($val) !=3D syswrite(DATA, $val, length($val))) { > die "This is Bad: $!\n"; > } >=20 > close(DATA); >=20 > When trying to write, I get the error "This is Bad: Bad file descriptor" > Is it not possible to write to a uhid device? >=20 > Thanks in advance! >=20 > -F >=20 > [1] http://www.griffintechnology.com/products/powermate/ >=20 --=20 _______________________________________________ Get your free email from http://mymail.bsdmail.com Powered by Outblaze