<snip>
> You know that you are getting structured events, don't you?
Nop, but I now now :o)

> Have you read http://www.frogmouth.net/hid-doco/linux-hid.html ?
done!!

> That has a reasonable explanation of how to read events for the event
> interface (which is probably what you should be doing, rather than hiddev,
> now I understand what you are doing). The hiddev interface is pretty similar
> though.

I made a small program, you can probably recognize the (your) code ;-)

int main (int argc, char **argv) {
  int fd = -1;
  struct hiddev_event device_read;

  if (argc != 2) {
    fprintf(stderr, "usage: %s hiddevice - probably /dev/usb/hiddev0\n",
argv[0]);
    exit(1);
  }
  if ((fd = open(argv[1], O_RDONLY)) < 0) {
    perror("hiddev open");
    exit(1);
  }

  read(fd,&device_read,sizeof(struct hiddev_event ));
  printf("hid %d \nvalue %d \n", device_read.hid, device_read.value);

  close(fd);
  exit(0);
}

The output from the program when I press 5 on the keypad is:

EUBH-andon:/andon/bin# ./a.out /dev/usb/hiddev0
hid 458845
value 0

Next time the program run, it just terminal:
EUBH-andon:/andon/bin# ./a.out /dev/usb/hiddev0
hid 458846
value 1

And now the program is ready again, an I press 6:
EUBH-andon:/andon/bin# ./a.out /dev/usb/hiddev
hid 458846
value 0

of course I can live whit it, but why this behaviour?


> > Furthermore the system shall only handle USB keypad and USB HUB, so it
> > will be easy to change hiddev.c whitout any things to break.
> There is a #define at the top of hiddev.c for the number of minors. Just
> change it from 16 to 32 or 64. You'd have to turn off other drivers though.
>
> In 2.5 kernels there is a way to dynamically allocate minors, so you get 256
> for any driver.

Fabulous, and running :o)

/morten



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to