function keys and embedded ascii extension characters 
Author Message
 function keys and embedded ascii extension characters

Gentlemen:

    I have a user that has provided a serial program that demands function
keys such as "F4" & "F2" for some of its commands. Can someone tell me the
appropriate way to generate an "F4" across a serial channel opened with
[open /dev/ttyS0]. Thats question one.

    The second question is a "lawyerly" question. The company patent
attorney wants me to put the copyright symbol (the little c in a circle) and
not "(c)". Can someone tell me *any* way to embed a copyright symbol in the
source code as a comment without fubaring the plain text ascii?

Charles



Fri, 13 Jul 2007 02:05:05 GMT  
 function keys and embedded ascii extension characters


:    I have a user that has provided a serial program that demands function
:keys such as "F4" & "F2" for some of its commands. Can someone tell me the
:appropriate way to generate an "F4" across a serial channel opened with
:[open /dev/ttyS0]. Thats question one.

Function keys on keyboards just generate a series of ASCII characters.
Unfortunately, the specifics of the characters differs between various
systems and keyboards, etc.

So you need to figure out more details on what sequences the application
is expecting, then just do some code like

set serial [open "/dev/ttyS0" "w"]
puts $serial "\033[22z"
or whatever sequence your application is expecting.

:    The second question is a "lawyerly" question. The company patent
:attorney wants me to put the copyright symbol (the little c in a circle) and
:not "(c)". Can someone tell me *any* way to embed a copyright symbol in the
:source code as a comment without fubaring the plain text ascii?

Plain text 7 bit ASCII doesn't have a copyright symbol in the source code.
If you move to using Unicode, then you could figure out some way to
embed the character.  Unfortunately, someone viewing your code in a
standard editor won't _see_ the symbol there...

--
<URL: http://wiki.tcl.tk/> MP3 ID tag repair < http://www.fixtunes.com/?C=17038 >
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.



Fri, 13 Jul 2007 22:16:26 GMT  
 function keys and embedded ascii extension characters

Quote:

> :    I have a user that has provided a serial program that demands
function
> :keys such as "F4" & "F2" for some of its commands. Can someone tell me
the
> :appropriate way to generate an "F4" across a serial channel opened with
> :[open /dev/ttyS0]. Thats question one.

> Function keys on keyboards just generate a series of ASCII characters.
> Unfortunately, the specifics of the characters differs between various
> systems and keyboards, etc.

> So you need to figure out more details on what sequences the application
> is expecting, then just do some code like

> set serial [open "/dev/ttyS0" "w"]
> puts $serial "\033[22z"
> or whatever sequence your application is expecting.

Well, this looks a little like an old ansi escape sequence. If I look in one
of the books behind me, I can see that an IBM PC function key *should*
produce something like two bytes where the first one is 0x00 and the second
one comes from a list like:

F1: 00d 59d
F2: 00d 60d
F3: 00d 61d
F4: 00d 62d

I also vaguely remember the Esc-LeftBracket beginnings of an ansi cursor
control sequence.

Am I correct in thinking that there is something along that line and if so,
could someone point me at a little more information so send a function key
or two on a serial port, please?

Charles



Sat, 14 Jul 2007 11:00:11 GMT  
 function keys and embedded ascii extension characters
So, I've done a little more research and I can see some references to the F1
key as "\033[=a" which I believe is the ANSI sequence and others for the F1
key as "\0330P" (both zeros, no ohhs, I think) which I believe is a VT style
escape sequence.

Would one or the other of these be appropriate for sending down an open
serial port connection like:

set $chan [open "/dev/ttyS0" "RDWR"]
puts $chan "\033[=a"

to send an F1??

Charles



Sat, 14 Jul 2007 12:18:16 GMT  
 function keys and embedded ascii extension characters

Quote:

>So, I've done a little more research and I can see some references to the F1
>key as "\033[=a" which I believe is the ANSI sequence and others for the F1
>key as "\0330P" (both zeros, no ohhs, I think) which I believe is a VT style
>escape sequence.

>Would one or the other of these be appropriate for sending down an open
>serial port connection like:

>set $chan [open "/dev/ttyS0" "RDWR"]
>puts $chan "\033[=a"

>to send an F1??

>Charles

Me, I like to use autoexpect <URL: http://wiki.tcl.tk/autoexpect >
and save my thinking for other occasions.


Sun, 15 Jul 2007 00:08:03 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. ASCII key mapping

2. Need ascii codes for RETURN-KEY & BACKSPACE

3. ASCII code of DEL key

4. Keyboard: Get scancode + ascii + key-up?

5. ASCII Value of Key - How To

6. how to send ascii key combinations (newbie)

7. Demise of the non-ASCII character set

8. how to find extended ascii characters?

9. accessing ASCII value of character

10. ASCII value of character

11. Getting the ascii of a character?

12. Summary: convert character to ASCII code?

 

 
Powered by phpBB® Forum Software