Page 1 of 1

What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 6:24 pm
by gerryg400
Piranha, how did you get arrow keys working ? Did you port libreadline ?

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 6:31 pm
by Nessphoro
gerryg400 wrote:Piranha, how did you get arrow keys working ? Did you port libreadline ?
Scancodes for Arrow Keys:
0x48 : Up
0x50 : Down
0x4D : Right
0x4B : Left

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 7:00 pm
by gerryg400
Nessphoro wrote:
gerryg400 wrote:Piranha, how did you get arrow keys working ? Did you port libreadline ?
Scancodes for Arrow Keys:
0x48 : Up
0x50 : Down
0x4D : Right
0x4B : Left
Thanks, but I was wondering how the keys get to the application. I compiled Dash on my OS and when I ran it the arrow key didn't work. Dash configure didn't detect libreadline (I didn't port it) and apparently disabled arrow key handling. Because Piranha has ported Bash (I think) I though he might know the easy way to get it going.

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 7:09 pm
by piranha
gerryg400 wrote:Piranha, how did you get arrow keys working ? Did you port libreadline ?
My keyboard handler detects if it's an arrow key, using appropriate scan codes. My tty read function returns the appropriate escape sequence: "\E[A" is the code for the up arrow. Took quite a while to actually get it to work, but tty_read returns that sequence in the buffer (ncurses requests 1 key at a time, so it returns 1 element of the sequence per call to ncurses since the count argument is 1).

The annoying part is that the way ncurses decides if you've pressed the escape key or if you're giving it an escape sequence is by calling select() to figure out if theres data to read still (I've stubbed this, it always says theres more data). select() has to deal with timeouts (and it wasn't until I properly implemented the timeout code that the arrow keys started to work).

Basically, a lot of trial and error, looking through the ncurses library code and researching select() and termios. I didn't port libreadline, but I did port termcap.

I don't actually have bash detecting the arrow keys, but I ported bash before I implemented all the termios and select() stuff. At some point in the near future, I'll report bash and see if it detects arrow keys.

-JL

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 7:25 pm
by gerryg400
piranha wrote:
gerryg400 wrote:Piranha, how did you get arrow keys working ? Did you port libreadline ?
My keyboard handler detects if it's an arrow key, using appropriate scan codes. My tty read function returns the appropriate escape sequence: "\E[A" is the code for the up arrow. Took quite a while to actually get it to work, but tty_read returns that sequence in the buffer (ncurses requests 1 key at a time, so it returns 1 element of the sequence per call to ncurses since the count argument is 1).

The annoying part is that the way ncurses decides if you've pressed the escape key or if you're giving it an escape sequence is by calling select() to figure out if theres data to read still (I've stubbed this, it always says theres more data). select() has to deal with timeouts (and it wasn't until I properly implemented the timeout code that the arrow keys started to work).

Basically, a lot of trial and error, looking through the ncurses library code and researching select() and termios. I didn't port libreadline, but I did port termcap.

I don't actually have bash detecting the arrow keys, but I ported bash before I implemented all the termios and select() stuff. At some point in the near future, I'll report bash and see if it detects arrow keys.

-JL
It's quite depressing just how convoluted some of this sh*t is. It's no great surprise then that it didn't 'just work' for me.

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 9:15 pm
by piranha
gerryg400 wrote:It's quite depressing just how convoluted some of this sh*t is. It's no great surprise then that it didn't 'just work' for me.
It's not too bad. There are just a lot of details that you need to work out...

As to your earlier question about bash and arrow keys, I just reported bash and enabled its libreadline at configure time and arrow keys seem to work properly. I can scroll through history now!

-JL

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 10:03 pm
by gerryg400
What level of debugging support do you have on your OS ?

Re: What does your OS look like? (Screen Shots..)

Posted: Tue Apr 24, 2012 10:29 pm
by piranha
gerryg400 wrote:What level of debugging support do you have on your OS ?
AHAHAHA. debugging? :shock:

Haha, uh, what do you mean? As in, can I debug applications? Like with gdb? Or in kernel? I don't currently have a kernel debugger, I mostly just do a lot of printks if I need to get information. Why do you ask?

-JL

Re: What does your OS look like? (Screen Shots..)

Posted: Wed Apr 25, 2012 12:22 pm
by gravaera
piranha wrote:
gerryg400 wrote:What level of debugging support do you have on your OS ?
AHAHAHA. debugging? :shock:

Haha, uh, what do you mean? As in, can I debug applications? Like with gdb? Or in kernel? I don't currently have a kernel debugger, I mostly just do a lot of printks if I need to get information. Why do you ask?

-JL
Dat old school zen