POV-Ray : Newsgroups : povray.unix : Reading from a USB Barcode-Reader on Solaris8 : Reading from a USB Barcode-Reader on Solaris8 Server Time
3 Jul 2024 05:37:24 EDT (-0400)
  Reading from a USB Barcode-Reader on Solaris8  
From: nomail
Date: 12 Sep 2004 15:10:00
Message: <web.41449efa48abd8fdbac2ca430@news.povray.org>
Hi all , I'm trying to read from a USB Barcode-Reader (on Solaris 8) ,
I've written the following code ...
But the program always exits on : (rval = ioctl(fd, I_PUSH,"usbkbm"))

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> /*streamio -- STREAMS ioctl commands (for I_PUSH) */
#include <sys/stropts.h>   /*streamio -- STREAMS ioctl commands (for I_PUSH)
*/

#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/hid3",O_RDWR);
 if (fd < 0 ) {
  exit (1);
 }
 if ((rval = ioctl(fd, I_PUSH,"usbkbm")) < 0 ) {
 exit (1); //  The program exits here all the time **********
 }
 while (read(fd, &fe, sizeof(fe))) {
  printf("n");
  printf("%d", fe.id);
  printf("%d", fe.value);
 }
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.