The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
MAC Universal Barcode Font 8.0 (Default branch) iBot Software Releases - RSS News 0 05-16-2008 08:40 PM
Oracle Reports Barcode PLL 1.2 (Default branch) iBot Software Releases - RSS News 0 02-28-2008 04:10 AM
Where do barcode fonts go (Oracle reports) Chantho UNIX for Dummies Questions & Answers 0 01-09-2008 07:53 AM
Barcode Printing llepley UNIX for Advanced & Expert Users 2 01-13-2004 06:18 PM
Barcode printing problem khe_li UNIX for Advanced & Expert Users 6 10-15-2002 09:07 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 3.00 average. Display Modes
  #1 (permalink)  
Old 09-20-2004
yuval yuval is offline
Registered User
  
 

Join Date: Sep 2004
Posts: 1
read from a USB Barcode-Reader

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
  #2 (permalink)  
Old 09-20-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,124
It would help if you would tell us which unix you are using. The only usbkvm manpage I find is here, and when I read the man page, I see:

open("/dev/kbd", O_RDWR)

and I would expect this module to be autopushed anyway. Be sure that you're open the right device. And run autopush on that device to be sure that the module really needs an explicit push.

I sorta doubt that a keyboard module will handle a bar code reader anyway. But I've never worked with this stuff, so who knows...
  #3 (permalink)  
Old 09-22-2004
beilstwh beilstwh is offline
Registered User
  
 

Join Date: Jul 2004
Location: New York State
Posts: 65
Quote:
Originally posted by Perderabo
I sorta doubt that a keyboard module will handle a bar code reader anyway. But I've never worked with this stuff, so who knows...
Typically the bar code reader will do all the interperation of the barcode and will return the value string. To a keyboard module it would look like someone typed "1234567890"
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0