send key event from monitor
Hello guys again,
Basicaly I have a running arm cortex m4 with FPU enabled, all good an' well.I wrote a small echo server, whatever I type I get back, simple, right?it works in the same console(I type 's', I get 's' back). Using the UART of the device.
When connecting the monitor( I just added this: -monitor telnet:127.0.0.1:55555,server,nowait)using telnet, I use the sendkey command(It says in the monitor it emulates sending keyboard events)The problem, when I send the command, the echo server does not get it(not present in the UART register)I checked it with gdb, the command never reaches the running bare-metal program. Must I append something else to get the thing to work?
Br, Mircea Cociuba"To be or not to be, that is not a question, it's FF".
Quoted 7 lines · Mircea Cociuba
Basicaly I have a running arm cortex m4 with FPU enabled, all good an' well. I wrote a small echo server, whatever I type I get back, simple, right? it works in the same
console(I type 's', I get 's' back). Using the UART of the device.When connecting the
monitor( I just added this: -monitor telnet:127.0.0.1:55555,server,nowait)using telnet, I use the sendkey command(It says in the monitor it emulates sending keyboard events) The problem, when I send the command, the echo server does not get it(not present in the UART register)
That's expected. The 'sendkey' command simulates sending a *keyboard* event, ie it goes to an emulated keyboard. That's different from a serial port/UART. Your setup has no emulated keyboard in it, so the sendkey event will just go nowhere, I think.
thanks
-- PMM
I get that, I also think that is the problem.How come the current console works then? I mean, thinking about it makes sense that qemu "sees" something to send to the bare-metal program, how to do it from the monitor? Mircea Cociuba"To be or not to be, that is not a question, it's FF".
On Monday, August 24, 2020, 12:56:11 PM GMT+3, Peter Maydell <[email protected]> wrote:
Quoted 7 lines · Mircea Cociuba
Basicaly I have a running arm cortex m4 with FPU enabled, all good an' well. I wrote a small echo server, whatever I type I get back, simple, right? it works in the same
console(I type 's', I get 's' back). Using the UART of the device.When connecting the
monitor( I just added this: -monitor telnet:127.0.0.1:55555,server,nowait)using telnet, I use the sendkey command(It says in the monitor it emulates sending keyboard events) The problem, when I send the command, the echo server does not get it(not present in the UART register)
That's expected. The 'sendkey' command simulates sending a *keyboard* event, ie it goes to an emulated keyboard. That's different from a serial port/UART. Your setup has no emulated keyboard in it, so the sendkey event will just go nowhere, I think.
thanks
-- PMM
Quoted 2 lines · Mircea Cociuba
I get that, I also think that is the problem.
How come the current console works then?
That's because your command line will (presumably; you don't say what it is) be configuring QEMU to say "connect the current stdin/stdout to this UART". You can alternatively configure it to connect the UART to a TCP port, or to display in the GUI window, or various other options (see the docs about configuring 'chardev' backends, which is what the UART emulation connects to:
https://www.qemu.org/docs/master/system/invocation.html#hxtool-6 )
Quoted 1 line
I mean, thinking about it makes sense that qemu "sees" something to send to the bare-metal program, how to do it from the monitor?
There isn't any support in the monitor for sending characters to a chardev, I'm afraid (except for the special case of sending a 'break' event with "chardev-send-break"). Usually people who want to automate sending things to a UART just set it up so the chardev backend is a TCP socket or a file descriptor or similar which the automation can then read/write. (Obviously this then means you don't have the human-can-interact-with-it-too behaviour, unless you put something on the other end of the socket/fd that will multiplex human and automated input.) If you really need to have something you can interact with from the monitor prompt in particular then maybe the 'ringbuf' chardev backend and the ringbuf_read/ringbuf_write monitor commands will be useful, but I've never used them myself.
thanks
-- PMM
Hello again,
Reading the CharDev docus is teadious, and I am having trouble keeping up with it.I am not asking for spoon feeding, but if my question is considered as such please ignore it(I will keep reading the docs)What command must I specify to qemu to link the devices UART to a TCP chardev?(windows user here, I have to use windows) Current command for starting qemu: qemu-system-arm -M lm3s6965evb-m 8K -nographic -kernel notmain.bin
if you can tell me this, I can use netcat to comunicate with it easly.
BrMircea Cociuba"To be or not to be, that is not a question, it's FF".
On Monday, August 24, 2020, 01:26:00 PM GMT+3, Peter Maydell <[email protected]> wrote:
Quoted 2 lines · Mircea Cociuba
I get that, I also think that is the problem.
How come the current console works then?
That's because your command line will (presumably; you don't say what it is) be configuring QEMU to say "connect the current stdin/stdout to this UART". You can alternatively configure it to connect the UART to a TCP port, or to display in the GUI window, or various other options (see the docs about configuring 'chardev' backends, which is what the UART emulation connects to:
https://www.qemu.org/docs/master/system/invocation.html#hxtool-6 )
Quoted 1 line
I mean, thinking about it makes sense that qemu "sees" something to send to the bare-metal program, how to do it from the monitor?
There isn't any support in the monitor for sending characters to a chardev, I'm afraid (except for the special case of sending a 'break' event with "chardev-send-break"). Usually people who want to automate sending things to a UART just set it up so the chardev backend is a TCP socket or a file descriptor or similar which the automation can then read/write. (Obviously this then means you don't have the human-can-interact-with-it-too behaviour, unless you put something on the other end of the socket/fd that will multiplex human and automated input.) If you really need to have something you can interact with from the monitor prompt in particular then maybe the 'ringbuf' chardev backend and the ringbuf_read/ringbuf_write monitor commands will be useful, but I've never used them myself.
thanks
-- PMM
Quoted 4 lines · Mircea Cociuba
What command must I specify to qemu to link the devices UART to a TCP chardev?(windows user here, I have to use windows)
Current command for starting qemu:
qemu-system-arm -M lm3s6965evb -m 8K -nographic -kernel notmain.bin
Add
-serial tcp::4444,server
and QEMU should wait for you to connect to TCP port 4444 before it starts. (Add ",nowait" if you'd rather it started without waiting.)
thanks
-- PMM