<CR/LF> or <CR> or <LF>?

Aug 28, 2007 7 Replies

I need to insert a numeric text string into an opened text document, from the equivalent of a numeric keypad, via a USB port, (just been reading about HID.)



The user just presses the Big Red Button on my box, when needed.



Should I send cr/lf etc at the end of my data to create a new line? Probably need it to be M$/Mac/Lunix compatable.


Sorry about my ignorance about personal computers, but they are just so boring, fast, but boring.



I'll probably be using stuff like this

formatting link


Martin


You need to read some more about HID. Keypads send keypresses, not text. You probably need do nothing more than send the code for the Enter key to have the text come out correctly on all systems.

Wow, never thought "they" would have a code for the Enter key.

Thanks, a bit more reading to do!

Martin

We keep on learning :-) :-).

Although strictly, the "Enter" key on keyboards (the popular ones; not many alternative nowadays, I imagine) does have its own code: $5A press, $F0 $5a release... (practically 0% relevant to your query, that is :-).

That depends on what software on the wintel/linux whatever side will take your data. If it is a terminal emulation - just prints out what you send in a window, as you seem to want - then CRLF is probably the most universal. But there are terminals which do autoLF on CR etc., generally a thing one can switch on or off as wanted.

Dimiter

------------------------------------------------------ Dimiter Popoff Transgalactic Instruments

formatting link

------------------------------------------------------

Unless it's the keypad enter key. Then it's E0 5A for press and E0 F0

5A for release.

And if we're talking about USB HID, the enter key is 0x28, and the keypad enter key is 0x58. USB HID doesn't have release (break) codes the way the PS/2 keyboard does: It's down, or it's not.

Regards,

-=Dave

Dave, would you please post some info (link etc.) on that USB keyboard thing? I have yet to look into it and do it so I have not done any searches, but I may have to before I know so having the right file or bookmark would be helpful.

Thanks,

Dimiter

------------------------------------------------------ Dimiter Popoff Transgalactic Instruments

formatting link

------------------------------------------------------ >

It's in the USB HID Usage Tables.

See:

formatting link

-a

Many thanks for the pointer,

Dimiter

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required