From owner-freebsd-current@FreeBSD.ORG Sun May 25 17:59:08 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7472A1065670 for ; Sun, 25 May 2008 17:59:08 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-3.dlr.de (smtp-3.dlr.de [195.37.61.187]) by mx1.freebsd.org (Postfix) with ESMTP id 0CD8B8FC15 for ; Sun, 25 May 2008 17:59:07 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from [129.247.12.14] ([129.247.12.14]) by smtp-3.dlr.de with Microsoft SMTPSVC(6.0.3790.1830); Sun, 25 May 2008 19:59:05 +0200 Message-ID: <4839A8E6.40101@dlr.de> Date: Sun, 25 May 2008 19:59:02 +0200 From: Hartmut Brandt Organization: German Aerospace Center User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Chuck Robey References: <4839945E.5090500@telenix.org> In-Reply-To: <4839945E.5090500@telenix.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 May 2008 17:59:05.0582 (UTC) FILETIME=[05BC48E0:01C8BE91] Cc: freebsd-current@freebsd.org Subject: Re: my usb prog X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 May 2008 17:59:08 -0000 Chuck Robey wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Man, I'm just not sure if I am making a mistake posting here, but I tried the > usb list, and no answer to either subject, so I am risking bothering you. If > I'm wrong, and you jump all over me, I will learn that way, at least, not to do > it again. Ok, 2 parts below, here's part 1: > > I've been working trying to get my UC-Logic graphic tablet to work under > - -current. First thing I did, I began with an equivalent of a "Hello, world" and > added different features so I could get more experience playing with uhid0 > (where dmesg puts my tablet). One part of it is a reader/dumper of the > descriptor using libusbhid, and one part it printed out, the usage page, kept on > printing as a 0x0D (the number of a Digitizer) instead of what I thought it > should have been, the word "Digitizer". I looked over libusbhid, and found a > small change I could put into usage.c to get the right part to print ... > > cvs diff: Diffing . > Index: usage.c > =================================================================== > RCS file: /home/ncvs/src/lib/libusbhid/usage.c,v > retrieving revision 1.8 > diff -u -r1.8 usage.c > - --- usage.c 9 Apr 2003 01:52:48 -0000 1.8 > +++ usage.c 24 May 2008 16:34:17 -0000 > @@ -164,7 +164,7 @@ > errx(1, "no hid table"); > > for (k = 0; k < npages; k++) > - - if (pages[k].usage == i) > + if (pages[k].usage == HID_PAGE(i)) > return pages[k].name; > sprintf(b, "0x%04x", i); > return b; > > I wanted to apply this myself, but I wanted someone else to verify it looks ok > to apply. I used to be pretty active wtih ports, but didn't work in src before > (publicly), so if you'd just NOT apply this, just tell me if it's ok or not, I > will see about applying it. I have a freebsd.org ssh login from long while > back, it still works, so if this is a good diff, please leave it to me to do, ok? > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2nd part is that my other prog, a uhid0 dumper, which is the first part of a > Xinput module for my tablet, is not able to correctly dump the uhid0. At first > it looked like: > > while(nread = read(udev, buf, 1024) > 0){ > for(i=0; i fprintf(stderr,"i;%d:%x",nread,buf[i]); > } > > This always returns ";1;9" in endless repetitions, no changes, and nread is > always 1. nread is a ssize_t. Well, finally, I got to wondering if it might be > possible that nread was wrong, so I made these changes to show me the first few > bytes following, no matter what the nread was: > > while(nread = read(udev, buf, 1024) > 0){ > fprintf(stderr,";%d",nread); > for(i=0; i<5; i++) > fprintf(stderr,":%x",buf[i]); > } > Cannot comment on the other stuff, but you probably want while ((nread = read(udev, buf, 1024)) > 0) { fprintf(stderr, ";%zd", nread); As a matter of style, I even would write while ((nread = read(udev, buf, 1024)) != -1) { (read is supposed to return -1 on errors, not 'something negative', I think). harti > Well, the funny thing is, the data coming out changes! I get the strong notion > that I really outght to simply read the number of bytes that the report > descriptor tells me to, but the first code sample above, shouldn't it work just > as I wrote it? What am I doing wrong? Or, is it possible that the uhid code is > wrong, I should maybe read the uhid driver and fix something? I can easily dump > enough of the desciptor to find out how much to read, no problem there, I just > can't figure out why the "correct" approach fails. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.4 (FreeBSD) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFIOZRez62J6PPcoOkRAi0TAJ9aV1dY4SMBSmyqv9hHski3J0IlkQCeLHex > zz42d1+2Tf6SERctKLE/+gM= > =mWZN > -----END PGP SIGNATURE----- > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >