Sponsored Content
Top Forums UNIX for Advanced & Expert Users read from a USB Barcode-Reader Post 55794 by yuval on Monday 20th of September 2004 07:26:48 AM
Old 09-20-2004
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
This User Gave Thanks to yuval For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Barcode Printing

How can you pull up a list of print drivers loaded at the Unix level? I am trying to get an HP LaserJet 2300 using the PCL5e driver to print barcode labels. I believe the PCL5e driver needs to be loaded somewhere at the Unix level but am at a loss as to where. Thanks (2 Replies)
Discussion started by: llepley
2 Replies

2. Linux

How to read keys from USB keyboard on AT91SAM9260

Hi Everyone, I am using 2.6.26.3-olimex kernel(Embedded system) running on AT91SAM9260. I am using a Logitech USB keyboard. It is detected as "/dev/input/event0". I don't know how to detect key press events and read the keys? Why can't I read the keys using scanf() like funtions? ... (7 Replies)
Discussion started by: siva4ever
7 Replies

3. Solaris

Serial Barcode Reader

I have a serial barcode reader which I attached to my Solaris 10 workstation. I can see the barcode scanned data appearing when I do a tip hardwire. Question is how can I enable the data to appear in command prompt or any text editor programs? Thanks for the help (3 Replies)
Discussion started by: timtan169
3 Replies

4. UNIX for Dummies Questions & Answers

USB-USB cable between linux and windows computers

Is there an easy way to setup a cross-over cable (USB-USB) between a linux box and a windows PC? My 2 machines are next to each other but I really do not want to keep transfering my files using my USB drive. Thanks! (4 Replies)
Discussion started by: Xterra
4 Replies

5. What is on Your Mind?

Barcode Generator

QR Code Generator (0 Replies)
Discussion started by: Neo
0 Replies

6. What is on Your Mind?

Do you read books with an ebook reader?

I bought a Sony PRS-650 Reader to read books and I'm loving it. For one thing, there are zillions of free books in epub format available for download for free. Many of them are out of print, so you would have to pay a high price to get a printed copy. Most current releases have to be paid for,... (15 Replies)
Discussion started by: KenJackson
15 Replies

7. Ubuntu

how to make others have read/write permission when the aotu mounted usb flash disk pluge in ?

hi all: as we know , when usb flash disk plug in and aotu mounted , the default permission of the usb flash disk is 700. that means others have no permission . the question: how to make others have read/write permission when the aotu mounted usb flash disk pluge in ? thanks !! (0 Replies)
Discussion started by: arnold.king
0 Replies

8. Ubuntu

Barcode scanner buffer read manipulation

Hello, I'm facing some problems with a barcode scanner from Cygnal Inc, model Sweda SL-20. Info from lsusb -v: Bus 003 Device 003: ID 10c4:ff11 Cygnal Integrated Products, Inc. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 ... (4 Replies)
Discussion started by: minharojr
4 Replies

9. HP-UX

Configure X windows with both keyboard and USB barcode reader

Greetings. Seeking guidance on adding a USB barcode reader (BCR) to an HP c3750 workstation with HP-UX 11.11 which is essentially configuring X windows to accept input from both a primary keyboard and a secondary keyboard that happens to be the BCR. Historically, I have successfully added a BCR... (2 Replies)
Discussion started by: mnkaltenbach
2 Replies
Barcode::IATA2of5(3pm)					User Contributed Perl Documentation				    Barcode::IATA2of5(3pm)

NAME
GD::Barcode::IATA2of5 - Create IATA2of5 barcode image with GD SYNOPSIS
ex. CGI use GD::Barcode::IATA2of5; binmode(STDOUT); print "Content-Type: image/png "; print GD::Barcode::IATA2of5->new('1234567890')->plot->png; with Error Check my $oGdBar = GD::Barcode::IATA2of5->new('A12345678'); die $GD::Barcode::IATA2of5::errStr unless($oGdBar); #Invalid Characters $oGdBar->plot->png; DESCRIPTION
GD::Barcode::IATA2of5 is a subclass of GD::Barcode and allows you to create IATA2of5 barcode image with GD. new $oGdBar = GD::Barcode::IATA2of5->new($sTxt); Constructor. Creates a GD::Barcode::IATA2of5 object for $sTxt. $sTxt has numeric characters([0-9]). plot() $oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]); creates GD object with barcode image for the $sTxt specified at new method. $iHeight is height of the image. If NoText is 1, the image has no text image of $sTxt. ex. my $oGdB = GD::Barcode::IATA2of5->new('12345678'); my $oGD = $oGdB->plot(NoText=>1, Height => 20); # $sGD is a GD image with Height=>20 pixels, with no text. barcode() $sPtn = $oGdBar->barcode(); returns a barcode pattern in string with '1' and '0'. '1' means black, '0' means white. ex. my $oGdB = GD::Barcode::IATA2of5->new('12345678'); my $sPtn = $oGdB->barcode(); $errStr $GD::Barcode::IATA2of5::errStr has error message. $text $oGdBar->{$text} has barcode text based on $sTxt specified in new method. AUTHOR
Kawai Takanori GCD00051@nifty.ne.jp COPYRIGHT
The GD::Barocde::IATA2of5 module is Copyright (c) 2000 Kawai Takanori. Japan. All rights reserved. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. SEE ALSO
GD::Barcode perl v5.12.3 2003-05-29 Barcode::IATA2of5(3pm)
All times are GMT -4. The time now is 06:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy