Date: Sun, 25 May 2008 12:31:26 -0400 From: Chuck Robey <chuckr@telenix.org> To: freebsd-current@freebsd.org Subject: my usb prog Message-ID: <4839945E.5090500@telenix.org>
next in thread | raw e-mail | index | archive | help
-----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<nread; 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]);
}
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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4839945E.5090500>
