[comp.windows.x] XTerminals and bar-code readers

rob@corona.med.utah.edu (Rob Sargent) (03/15/91)

Can anyone verify whether or not a bar code wand can be stuck on an
XTerminal (NCD. DEC). They are typically inserted inline on char.
based terminals and pcs.
Thanks

rob@corona.med.utah.edu
--
Rob Sargent                      s-mail: Dept. of Human Genetics    
e-mail: rob@linkers.med.utah.edu         U. of Utah Medical School     
				         501 -  Wintrobe Building   
				         Salt Lake City, Utah  84132

lmm@occrsh.ATT.COM (03/29/91)

> "XTerminals and bar-code readers"

Rob Sargent Writes:

> Can anyone verify whether or not a bar code wand can be stuck on an
> XTerminal (NCD. DEC). They are typically inserted inline on char.
> based terminals and pcs.
> Thanks

Rob, I'd be very much interested if you find out anything.  I have
a feeling that this can't really be done very easilly in X.  Since
the X protocall (as I understand it, which isn't much) only provides
for input from the keyboard and the mouse.

However If you find out anything, please let me know.  I'd be
very much interested in your solution.   I am working on a project
where it would be very handy if we could read bar code scanner connected
to an X-terminal as well.   I don't think it can be done in a 'standard'
way however.  (it would probably be a kludge).

Larry McWilliams
occrsh!lmm
lmm@occrsh.att.com

thp@westhawk.UUCP ("Timothy H Panton.") (03/31/91)

I spoke to an NCD guy the other day about keyboards, and he said that
any PS2 compatible keyboard should work (I have _not_ verified this) on
their X terminals. So if you can find a barcode reader that is designed
to go inbetween a PS2 and its keyboard, you should be able to use it on
an NCD. I guess the codes would appear as fast key press/release sequences.
Tim.
+----------------------------------------------------------------------------+
|Tim Panton, Westhawk Ltd.    "Do not meddle in the affairs of Wizards, for  |
|Phone: +44 928722574         	   they are subtle and quick to anger."      |
|Email: thp%westhawk.uucp@ukc.ac.uk       The Lord of the Rings.             |
|Paper: Westhawk Ltd. 26 Rydal Grove, Helsby, Cheshire, WA6 OET. UK.         |
+----------------------------------------------------------------------------+

gms@hpcvlx.cv.hp.com (George Sachs) (04/02/91)

Lack of support for barcode readers is not a limitation of X but rather
an implementation choice made by X server developers.  Barcode readers
can be supported either by the standard X protocol, or through the
X input device extension.  In either case, there has to be device-dependent
code in the X server that can receive input from the device and generate
X events.

Hewlett-Packard X servers running on our workstations do support a barcode
reader.  The HP92916A Barcode reader has two modes, one that causes it to
generate ASCII data, and the other that causes it to emulate a keyboard.  It 
can be used in addition to, or instead of, a keyboard.  It can also be 
accessed though the X input extension.

I don't believe that any X terminals available from HP support barcode readers.

dave@exloghou.portal.com (Dave St.Clair) (04/03/91)

> Can anyone verify whether or not a bar code wand can be stuck on an
> XTerminal (NCD. DEC). They are typically inserted inline on char.
> based terminals and pcs.

We use NCD 17/14c Xterminals in our application and hook
the serial port to a variety of devices.
The port is easily accessed via a socket from a host machine
(I think its number is 87).  Once you've connected to the socket
you can do whatever you like.

Here's a portion of the code which opens the socket (On a Sun
Sparc 2 running SunOS 4.1.1, NCD 17c software version 2.2.2D)
...

#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>


#define NCDPORTNUM 87
....

fd = xserial(NCDPORTNUM, ncdname);
......

int xserial(int portnum, char *hostname)
{
struct  sockaddr_in sin; = { AF_INET };
struct hostent *host;

sin.sin_port = htons((u_short)(portnum));

sin.sin_family = AF_INET;
if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0)
	return(FAILURE);

if((host = gethostbyname(hostname)) == (struct hostent *)0)
	return(FAILURE);

sin.sin_family = host->h_addrtype;
bcopy(host->h_addr, (caddr_t)&sin.sin_addr, host->h_length);

if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) 
	{
	close(s);
	return(FAILURE);
	}

(void)fcntl(s, F_SETFL,O_NDELAY);	/* set to non-blocking */

return(s);
}



Dave St.Clair
dave@exloghou.portal.com

glenn@bryant.NCD.COM (Glenn Shapland) (04/05/91)

In article <1991Apr3.144425.12207@exloghou.portal.com>,
dave@exloghou.portal.com (Dave St.Clair) writes:
|> > Can anyone verify whether or not a bar code wand can be stuck on an
|> > XTerminal (NCD. DEC). They are typically inserted inline on char.
|> > based terminals and pcs.
|> 
|> We use NCD 17/14c Xterminals in our application and hook
|> the serial port to a variety of devices.
|> The port is easily accessed via a socket from a host machine
|> (I think its number is 87).  Once you've connected to the socket
|> you can do whatever you like.
|> 
|> Here's a portion of the code which opens the socket (On a Sun
|> Sparc 2 running SunOS 4.1.1, NCD 17c software version 2.2.2D)
|> ...
|> 
|> #include <fcntl.h>
|> #include <sys/types.h>
|> #include <sys/socket.h>
|> #include <netinet/in.h>
|> #include <netdb.h>
|> 
|> 
|> #define NCDPORTNUM 87
|> ....
|> 
|> fd = xserial(NCDPORTNUM, ncdname);
|> ......
|> 
|> int xserial(int portnum, char *hostname)
|> {
|> struct  sockaddr_in sin; = { AF_INET };
|> struct hostent *host;
|> 
|> sin.sin_port = htons((u_short)(portnum));
|> 
|> sin.sin_family = AF_INET;
|> if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|> 	return(FAILURE);
|> 
|> if((host = gethostbyname(hostname)) == (struct hostent *)0)
|> 	return(FAILURE);
|> 
|> sin.sin_family = host->h_addrtype;
|> bcopy(host->h_addr, (caddr_t)&sin.sin_addr, host->h_length);
|> 
|> if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) 
|> 	{
|> 	close(s);
|> 	return(FAILURE);
|> 	}
|> 
|> (void)fcntl(s, F_SETFL,O_NDELAY);	/* set to non-blocking */
|> 
|> return(s);
|> }
|> 
|> 
|> 
|> Dave St.Clair
|> dave@exloghou.portal.com


Here at NCD we use a bar code reader wedge that is connected
between the keyboard and the base. In this case the bar code
reader looks just like keyboard input. The bar code reader
we use is from BTC and was made for IBM PC/PS2 compatibles.
The nice thing about this setup is that it leaves the serial
port free for other uses. In our application we use the serial
port to run a printer for printing bar code labels.

Glenn Shapland
glenn@ncd.com