VMIN/VTIME termios; any possibility of less than 0.1 s resol

I’m trying to program a barcode reader (that interfaces to the keyboard
via a splitter) and was wondering if there’s a way of specifying an
intercharacter delay in a resolution greater than 0.1 seconds?

The reason I’m asking is because ideally I’d like to get all of the
barcode data as one read(), and get keyboard data one character at a
time. In my causual playing around, I was able to “mostly” get this,
but being a fast typist, I was able to enter complete N character strings
without missing the 0.1s intercharacter window…

I think something like 0.01s would fix it right up – a typist might be
able to sneak two or three characters in a burst, but not a whole “long”
string…

One possible solution and addition problem is that the barcode scanner
does prefix its data with an 0x1b (ESC) character. I could assume that
all keyboard escapes (PGUP, PGDN, etc) are 3 or 4 characters, but I’m
then unable to distinguish (based on length alone) a short barcode scan
from a keyboard press. And the multi-byte keypresses will be very close
together (intercharacter more like zero seconds)…

Suggestions? It can be Neutrino specific, this code doesn’t need to be
portable.

Cheers,
-RK


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/

Hi Rob,

Couldn’t you interrupt yourself with your own timer/signal?

I don’t know if that let’s you receive the character(s) that WERE
received before the signal.


Robert Krten <rk@parse.com> wrote:
RK > I’m trying to program a barcode reader (that interfaces to the keyboard
RK > via a splitter) and was wondering if there’s a way of specifying an
RK > intercharacter delay in a resolution greater than 0.1 seconds?

RK > The reason I’m asking is because ideally I’d like to get all of the
RK > barcode data as one read(), and get keyboard data one character at a
RK > time. In my causual playing around, I was able to “mostly” get this,
RK > but being a fast typist, I was able to enter complete N character strings
RK > without missing the 0.1s intercharacter window…

RK > I think something like 0.01s would fix it right up – a typist might be
RK > able to sneak two or three characters in a burst, but not a whole “long”
RK > string…

RK > One possible solution and addition problem is that the barcode scanner
RK > does prefix its data with an 0x1b (ESC) character. I could assume that
RK > all keyboard escapes (PGUP, PGDN, etc) are 3 or 4 characters, but I’m
RK > then unable to distinguish (based on length alone) a short barcode scan
RK > from a keyboard press. And the multi-byte keypresses will be very close
RK > together (intercharacter more like zero seconds)…

RK > Suggestions? It can be Neutrino specific, this code doesn’t need to be
RK > portable.

RK > Cheers,
RK > -RK

Bill Caroselli <qtps@earthlink.net> wrote:

Hi Rob,

Couldn’t you interrupt yourself with your own timer/signal?

Signals? SIGNALS? SIGNALS??? YUCK!!! :slight_smile:

I don’t know if that let’s you receive the character(s) that WERE
received before the signal.

I actually “solved” this with a thread just this morning. The “input” thread uses
select() to wait for a character, and when one arrives, delays for 50ms
and polls stdin with a non-blocking read(). If there are more characters there
after the 50ms, it reads them, and that allows sufficient time to detect
a) regular keyboard characters entered by a human, b) multi-byte characters
(like PgUp etc) entered by a humand and c) barcode characters entered by the
barcode scanner… Seems to work quite reliably now, even when one is hammering
on the keyboard and scanning barcodes…

Cheers,
-RK

Robert Krten <> rk@parse.com> > wrote:
RK > I’m trying to program a barcode reader (that interfaces to the keyboard
RK > via a splitter) and was wondering if there’s a way of specifying an
RK > intercharacter delay in a resolution greater than 0.1 seconds?

RK > The reason I’m asking is because ideally I’d like to get all of the
RK > barcode data as one read(), and get keyboard data one character at a
RK > time. In my causual playing around, I was able to “mostly” get this,
RK > but being a fast typist, I was able to enter complete N character strings
RK > without missing the 0.1s intercharacter window…

RK > I think something like 0.01s would fix it right up – a typist might be
RK > able to sneak two or three characters in a burst, but not a whole “long”
RK > string…

RK > One possible solution and addition problem is that the barcode scanner
RK > does prefix its data with an 0x1b (ESC) character. I could assume that
RK > all keyboard escapes (PGUP, PGDN, etc) are 3 or 4 characters, but I’m
RK > then unable to distinguish (based on length alone) a short barcode scan
RK > from a keyboard press. And the multi-byte keypresses will be very close
RK > together (intercharacter more like zero seconds)…

RK > Suggestions? It can be Neutrino specific, this code doesn’t need to be
RK > portable.

RK > Cheers,
RK > -RK


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/

In article <cananc$ftv$1@inn.qnx.com>, rk@parse.com says…

I’m trying to program a barcode reader (that interfaces to the keyboard
via a splitter) and was wondering if there’s a way of specifying an
intercharacter delay in a resolution greater than 0.1 seconds?

The reason I’m asking is because ideally I’d like to get all of the
barcode data as one read(), and get keyboard data one character at a
time. In my causual playing around, I was able to “mostly” get this,
but being a fast typist, I was able to enter complete N character strings
without missing the 0.1s intercharacter window…

I believe you can screw up the keyboard by using -r option for devc-con,
so no one will be able to enter complete string without missing the
intercharacter interval of 0.1s :slight_smile:

Cheers,
Eduard.

I think something like 0.01s would fix it right up – a typist might be
able to sneak two or three characters in a burst, but not a whole “long”
string…

One possible solution and addition problem is that the barcode scanner
does prefix its data with an 0x1b (ESC) character. I could assume that
all keyboard escapes (PGUP, PGDN, etc) are 3 or 4 characters, but I’m
then unable to distinguish (based on length alone) a short barcode scan
from a keyboard press. And the multi-byte keypresses will be very close
together (intercharacter more like zero seconds)…

Suggestions? It can be Neutrino specific, this code doesn’t need to be
portable.

Cheers,
-RK

Robert Krten <rk@parse.com> wrote:
RK > Bill Caroselli <qtps@earthlink.net> wrote:

Hi Rob,

Couldn’t you interrupt yourself with your own timer/signal?

RK > Signals? SIGNALS? SIGNALS??? YUCK!!! :slight_smile:

Signals are our friends !

OK, So they’re a pain in the a** to set up. But once they’ve been
initialized, they work great.

I find myself using them more and more as the years go by. Of course by
now I can just cut and paste the initializationm code from one program to
another.

Bill Caroselli <qtps@earthlink.net> wrote:

Robert Krten <> rk@parse.com> > wrote:
RK > Bill Caroselli <> qtps@earthlink.net> > wrote:
Hi Rob,

Couldn’t you interrupt yourself with your own timer/signal?

RK > Signals? SIGNALS? SIGNALS??? YUCK!!! > :slight_smile:

Signals are our friends !

OK, So they’re a pain in the a** to set up. But once they’ve been
initialized, they work great.

I find myself using them more and more as the years go by. Of course by
now I can just cut and paste the initializationm code from one program to
another.

It’s the “we can interrupt any function at any time so good luck” part that
I disagree with :slight_smile:

Cheers,
-RK


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/

“Robert Krten” <rk@parse.com> wrote in message
news:casjrr$mj4$1@inn.qnx.com

Bill Caroselli <> qtps@earthlink.net> > wrote:
Robert Krten <> rk@parse.com> > wrote:
RK > Bill Caroselli <> qtps@earthlink.net> > wrote:

RK > Signals? SIGNALS? SIGNALS??? YUCK!!! > :slight_smile:

Couldn’t you interrupt yourself with your own timer/signal?

Signals are our friends !

OK, So they’re a pain in the a** to set up. But once they’ve been
initialized, they work great.

I find myself using them more and more as the years go by. Of course by
now I can just cut and paste the initializationm code from one program
to
another.

It’s the “we can interrupt any function at any time so good luck” part
that
I disagree with > :slight_smile:

This is a good point. In QNX 4 I would often have to mask signals for the

duration of certain functions.

But in QNX 6 I can force the signal to be processed by a thread that is
harmless to interrupt.

Bill Caroselli <QTPS@earthlink.net> wrote:

“Robert Krten” <> rk@parse.com> > wrote in message
news:casjrr$mj4$> 1@inn.qnx.com> …
Bill Caroselli <> qtps@earthlink.net> > wrote:
Robert Krten <> rk@parse.com> > wrote:
RK > Bill Caroselli <> qtps@earthlink.net> > wrote:

RK > Signals? SIGNALS? SIGNALS??? YUCK!!! > :slight_smile:

Couldn’t you interrupt yourself with your own timer/signal?

Signals are our friends !

OK, So they’re a pain in the a** to set up. But once they’ve been
initialized, they work great.

I find myself using them more and more as the years go by. Of course by
now I can just cut and paste the initializationm code from one program
to
another.

It’s the “we can interrupt any function at any time so good luck” part
that
I disagree with > :slight_smile:

This is a good point. In QNX 4 I would often have to mask signals for the
duration of certain functions.

But in QNX 6 I can force the signal to be processed by a thread that is
harmless to interrupt.

In that case, why use signals? If I create another thread, then I usually
use something like:

for (;:wink: {
delay (MY_DELAY);
do something
}

for skewable timing loops (which is what I implemented in the barcode reader
that began this thread), or

set up timer
for (;:wink: {
MsgReceive (chid,
do something
}

for non-skewable ones…

In every application that I have ever written, I have never used signals.
The closest I came to “using” signals was to block out all signals, and
periodically poll for ^C.

[Ok, one exception – for doing TCP/IP stuff, I used “alarm()” to break
out of the read… I shuddered when I did it, and I still shudder when
I think about it. But it was well bounded. But since the TCP/IP
stack has its roots in ancient unix, right there with signals, I “guess”
there is no nice way around it. Protocols. Feh! :slight_smile:]

Cheers,
-RK


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/