[syslinux] keystrokes

Ferenc Wagner wferi at niif.hu
Sat Sep 6 15:29:00 PDT 2014


Ady <ady-sf at hotmail.com> writes:

>> Ady <ady-sf at hotmail.com> writes:
>> 
>>>> On Sat, Sep 6, 2014 at 8:18 AM, Ady <ady-sf at hotmail.com> wrote:
>>>>
>>>>> What actions are _supposed_ to be triggered by each of:
>>>>>
>>>>>   [Ctrl-J]
>>>>>   [Ctrl-M]
>>>>>
>>>>> in the Syslinux command line in version 6.03-pre20?
>>>> 
>>>> They should do nothing special but either might be interpreted like
>>>> an <enter>.
>>>  
>>> Well, for a common user, "nothing special" doesn't seem exactly the 
>>> same as "<enter>".
>>>
>>> I had already seen [Ctrl+J] being the same as [Enter] in "cli.c", but 
>>> I couldn't find the meaning (or intention of) [Ctrl+M].
>> 
>> get_key() returns 13 (ASCII CR, \r) for Enter, just like for Ctrl-M.
>> Ctrl-J is LF (\n).  Either or both is used to terminate lines under
>> different operating systems, so it makes sense to handle them the same.
>> 
>> > [Ctrl+M] _seems_ to be behaving as [Enter], but since it is not in 
>> > "cli.c", I decided to post here in the mailing list.
>> 
>> See above> Ctrl-M _is_ Enter, in some sense.
>  
>  
> Please forgive my ignorance (I am not a developer). Where in the 
> Syslinux code we can find that [Ctrl-M] is "CR"?

Read http://en.wikipedia.org/wiki/ASCII: the CR ASCII control character
is typed in as Ctrl-M.

> For example, in "./com32/elflink/ldlinux/cli.c", line 219, we can 
> see:
> 	case KEY_ENTER:
> 	case KEY_CTRL('J'):
> 	    ret = cmdline;
> 	    done = true;
> 	    break;
>
> So I can see that [Ctrl-J] has the same effect as [Enter] in the 
> Syslinux CLI.
>
> But I can't find [Ctrl-M], or rather, I don't know how to find it.
>
> As with other keystroke combinations that are not listed or 
> mentioned, I would had expected for [Ctrl-M] to do "nothing".
>
> So, where in the Syslinux source code the effect of [Ctrl-M] is 
> defined as to be "CR" (or [Enter], or whatever)?

com32/libutil/include/getkey.h:#define KEY_ENTER        0x000d

that is, CR.  While in some cases (eg. with directly connected keyboard)
it would be possible to tell apart the Enter key from Ctrl-M, sometimes
(eg. over a serial line) this would be impossible.  To ensure uniformity, 
it's not worth making this distinction.
-- 
Regards,
Feri.


More information about the Syslinux mailing list