POV-Ray : Newsgroups : povray.unix : Reading from a USB Barcode-Reader on Solaris8 Server Time
1 Jul 2024 13:15:13 EDT (-0400)
  Reading from a USB Barcode-Reader on Solaris8 (Message 1 to 3 of 3)  
From: nomail
Subject: Reading from a USB Barcode-Reader on Solaris8
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

From: Nicolas Calimet
Subject: Re: Reading from a USB Barcode-Reader on Solaris8
Date: 12 Sep 2004 15:40:07
Message: <4144a617$1@news.povray.org>
> But the program always exits on : (rval = ioctl(fd, I_PUSH,"usbkbm"))

	Why not using  perror()  with the value stored in  errno  to get
an idea of what's wrong with your  ioctl()  call ?

	- NC


Post a reply to this message

From: Warp
Subject: Re: Reading from a USB Barcode-Reader on Solaris8
Date: 12 Sep 2004 15:40:19
Message: <4144a623@news.povray.org>
How is this related to POV-Ray?

  (If it's not, please post to off-topic.)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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