Ok it appears older kernels do not recognize the cash drawer at all. At
least not with the hid driver.
The current kernel 2.4.22 does and I can access the driver via the hid
driver and /dev/usb/hiddev*.
I can send write events and open the cash drawer with no problems or
errors.
However it seems when ever ioctl(cd,HIDIOCINITREPORT,0) is called there
is a pause. When I do a dmesg I get the following
host/usb-uhci.c: interrupt, status 2, frame# 1910
usb_control/bulk_msg: timeout
host/usb-uhci.c: interrupt, status 3, frame# 772
Also during initial recognition of the cash drawer I get a similar entry
usb_control/bulk_msg: timeout
hiddev0: USB HID v1.00 Device [APG Cash Drawer 554 HID USBPro(tm)II Interface] on
usb1:2.0
I would not care, except that the timeout causes reading the status to
take longer than it should.
I have removed that call from the following code, and it still runs, but
it does not update. Basically in order for the following code to work I
have to make that call. Which slows things down and makes it so I can't
use the status of cash drawer in apps.
Is there another call I can make to get the data to update to current
device status? Is there something I can do to get avoid the timeout or
change it?
Here is the code I am using to determine the status
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <asm/types.h>
#include <sys/signal.h>
#include <linux/hiddev.h>
int main (int argc, char **argv) {
int cd = -1;
struct hiddev_usage_ref usage_ref;
if(argc!=2) {
fprintf(stderr, "usage: %s hiddevice - probably /dev/usb/hiddev0\n",
argv[0]);
exit(1);
}
if((cd=open(argv[1],O_RDONLY))<0) {
perror("hiddev open");
exit(1);
}
if(ioctl(cd,HIDIOCINITREPORT,0)<0)
exit(1);
memset(&usage_ref,0,sizeof(usage_ref));
usage_ref.report_type = HID_REPORT_TYPE_INPUT;
usage_ref.report_id = 0;
usage_ref.field_index = 0;
usage_ref.usage_index = 0;
ioctl(cd,HIDIOCGUCODE,&usage_ref);
ioctl(cd,HIDIOCGUSAGE,&usage_ref);
if(usage_ref.usage_code==0xf000f4)
printf("%d\n",usage_ref.value);
else
printf("%d\n",0);
close(cd);
exit(0);
}
Any comments or suggestions are greatly appreciated.
--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios, Inc.
http://www.obsidian-studios.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel