Hi all , I'm trying to read from a USB Barcode-Reader "LX-250" (on Unix) ,
I've written the following code ...
But the program always failes on : ioctl call
Please if anyone has any ideas on what causes it to fail ?
Or how should I try to access the Barcode Device ?
Your help is very much appreciated !
Thanks
#include <sys/stream.h>
#include <sys/kbio.h>
#include <sys/kbd.h>
#include <sys/types.h>
#include <sys/stropts.h>
#include <sys/vuid_event.h>
#include <time.h>
#include <stdio.h> /* Standard input/output definitions /
#include <string.h> / String function definitions /
#include <stdlib.h>
#include <unistd.h> / UNIX standard function definitions /
#include <fcntl.h> / File control definitions /
#include <errno.h> / Error number definitions /
#include <termios.h> / POSIX terminal control definitions */
main( int argc, char *argv[]){
int fd,rval;
char c;
Firm_event fe;
fd = open("/dev/usb/hid0" , O_RDWR);
if (fd < 0 ) {
exit (1);
}
printf\("open /dev/usb/hid0 O.K\\n"\);
if ((rval = ioctl(fd, I_PUSH,"usbkbm")) < 0 ) {
perror("ioctl failed");
exit (2);
}
while (read(fd, &fe, sizeof(fe))) {
printf("\n");
printf("%d", fe.id);
printf("%d", fe.value);
}
}
The output is :
open /dev/usb/hid0 O.K
ioctl failed: Invalid argument
Please If anyone has any suggestions.... or know any other way
to retrive a barcode scan
Thanks again
Yuval