User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 6:18 am

Edit: To view full solution to this issue view this post

This error does not happen when dosbox is run from X11.  I'm using dosbox to run some *really* old dos games, if I open it in x11 then everything works, it's just a little bogged down.

If I open it from console, however, all the keys are messed up.  The [ inputs an e, the down arrow key is the enter key, and hitting 1 freezes the entire system.

I've tried running the keyboard mapper, but that *really* messes things up.  I've also tried to set the keyboard layout in console to ensure it's using the right keyboard using sudo nano /etc/default/keyboard
Dear forum: Play nice ;-)

User avatar
alexandru.cucu
Posts: 75
Joined: Mon Sep 05, 2011 6:07 pm
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 8:30 am

I've had the same problem a while ago using the first Debian image for Raspberry Pi.

Couldn't figure it out.

Bug confirmed.
https://launchpad.net/~alexandru.cucu

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26436
Joined: Sat Jul 30, 2011 7:41 pm

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 9:09 am

By console, do you mean what you get when you boot up before starting X?

If so, does the keyboard work fine in the console, but only go wrong in DosBOX? Or is the console pants as well?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 1:11 pm

console is fine (thank goodness!), it only goes haywire when I load up DosBOX for some reason.

When I say console, I do mean what you get when you boot up before starting x (does Linux call it something else? I thought about saying terminal, but that's what I've always called the bash prompt you launch from within x)

I'm thinking about compiling it from source and seeing if it's just a bad set of instructions in the debian auto-builder

As far as keyboards go, the only edits to the /etc/default/console-setup or /ect/default/keyboard were I made the font TerminusBold 32x16 so I could actually read the text from my couch and I changed the layout to 'us'
Dear forum: Play nice ;-)

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 1:28 pm

FWIW, I had the same problem when I compiled DosBox/SDL on Linux and tried to run it from the console (not X) prompt in Linux (on a normal x86 box).  The keyboard just seemed totally f'd up.  Never did debug/fix it.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26436
Joined: Sat Jul 30, 2011 7:41 pm

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 1:38 pm

OK, I think we can park that as a DosBOX/SDL fault, not a Raspi one!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 1:44 pm

Awesome... er... kinda, I'll move this to the general discussions forum as its not an R-pi only issue (but I hope someone out there still knows how to fix it!  I really want to launch from the console without having X up all the time! )
Dear forum: Play nice ;-)

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4214
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 2:07 pm

Abishur said:


Awesome... er... kinda, I'll move this to the general discussions forum as its not an R-pi only issue (but I hope someone out there still knows how to fix it!  I really want to launch from the console without having X up all the time! )


yes the SDL keyboard stuff is kind of weird and flakey. On the ZipitZ2 we ended up doing lots of "hacks" using scripts and loadkeys to remap and twiddle with the keyboard for SDL based apps. i'll take a look to see if I can find my Zipit dev vm or one of my sd cards with the fixes on it or you can pop into the zipit irc channel and see if deeice, dronz or mozzwald are in as they will have such things at their finger tips

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4214
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Fri Apr 20, 2012 2:20 pm

oh and check out hunter's (no relation) posts on dosbox too

http://www.hunterdavis.com/200.....-zipit-z2/

the dosbox.conf usescancodes setting might fix it for you

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 2:12 am

Rather annoyingly, I had tried that usescan but I didn't know I had to explicitly call the conf file after dosbox had made it!  grrrr.

One last question (for this topic) can I create a symbolic link such that typing in dosbox actually executes dosbox -conf /path/to/conf ?
Dear forum: Play nice ;-)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 2:20 am

came up with my own solution

cd /usr/bin

mv /usr/bin/dosbox /usr/games/dosbox

nano dosbox

#! /bin/bash

/usr/games/dosbox -conf /usr/games/dosbox.conf "$@"

save

Now I can type in dosbox anywhere and it load my conf file which works amazingly well!  Time to add some games to that bad boy!
Dear forum: Play nice ;-)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 3:25 am

Here"s a video I did of dosbox running an old school edutainment program called Midnight Rescue.  I accidentally call it Outnumbered (which is another program by the same people) in the video, but it"s actually Midnight Rescue.

The sound is working through the HDMI using the beta alsa drivers.  I had to speed the CPU up a little (ctrl + f11 I think) to get the sound right, but once I did that it was *awesome*

meh, can't get the video to embed, here's a direct link
Dear forum: Play nice ;-)

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 4:22 am

Impressive!  How do these old programs do graphics? Not likely they would be calling accelerated OpenGL...

Looks very smooth for graphics done by the processor and not the GPU.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 4:26 am

I know SDL is involved somewhere in there on the dosbox end.  Beyond that I'm unsure.
Dear forum: Play nice ;-)

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 9:42 am

(shell nitpicks coming up)

Abishur said:

 

cd /usr/bin

mv /usr/bin/dosbox /usr/games/dosbox

Should be: mv doxbox /usr/games 

nano dosbox

Should be: vi dosbox

#! /bin/bash

/usr/games/dosbox -conf /usr/games/dosbox.conf

Should be:  /usr/games/dosbox -conf /usr/games/dosbox.conf  "$@"
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 9:44 am

Also, there is something about this thread (since your [Abishur's] last post) that causes it (on my browser, FWIW) to go directly into YouTube (and also to do some popups) whenever the thread is loaded.   I have to back out of YouTube to get back to the forum.  Very annoying.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 2:55 pm

Joe Schmoe said:


(shell nitpicks coming up)

Abishur said:

 

cd /usr/bin

mv /usr/bin/dosbox /usr/games/dosbox

Should be: mv doxbox /usr/games 


Yes, since I'm already in the directory, I don't have to include the initial full path and since I'm not changing the name I don't have to explicitly state its name, but I do both because I like full declarations





nano dosbox

Should be: vi dosbox


nano works just as fine as vi no need to make a fuss for not using vi





#! /bin/bash

/usr/games/dosbox -conf /usr/games/dosbox.conf

Should be:  /usr/games/dosbox -conf /usr/games/dosbox.conf  "$@"



Actually it works 100% without the "$@" as well
Dear forum: Play nice ;-)

User avatar
jojopi
Posts: 3230
Joined: Tue Oct 11, 2011 8:38 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 3:27 pm

Abishur said:

Actually it works 100% without the "$@" as well
The "$@" is necessary for "dosbox GAMEDIR/" and "dosbox -version" to work.  It is good practice when you write a wrapper script that it passes its own arguments on, correctly quoted.

Also, I would suggest that it is better to leave the original binary in /usr/bin, and put your wrapper in /usr/local/bin, which is checked first.  This avoids problems if the package manager attempts to update in the future, and makes it easier to keep track of your local changes.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 3:39 pm

Thanks, Jojo.  Actually the first two nitpicks were intended as tongue-in-cheek, leading up to the 3rd one - which was the only substantive one.

Regarding file placement, I think the underlying point here is that this is a version of DosBox that Abishur compiled himself - i.e., not one managed by "the outside world" (aka, the package manager).  I'm assuming (unless I've messed up in my reading) that it got into /usr/bin via "make install".  FWIW, I almost never do "make install" when I compile my own software, simply because I don't want to get into the package manager's airspace.  I always leave in it some "local" directory that I control - and make the appropriate adjustments so that it runs OK.

In any (and all) cases(s), I think it might be easier to accomplish this via an alias (or shell function - if you are, as many people are, dogmatically opposed to shell aliases).

Or, it should be possible to eliminate the need for the external "conf" file entirely - obviously, it is possible (somehow...) to "bake in" the keyboard configuration, so that all this external hackery isn't needed.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 4:05 pm

Ah, I wasn't worried about doing anything but having it run correctly.  I'll make the change.

It actually was the install I got from doing apt-get install dosbox.  I know that may cause issues on updates, but thems the breaks ya know?

If you run dosbox -startmapper it will create a keymap file that will auto load (I don't know why they didn't also setup the .conf file to do that >:-(  ), but that will still crash when you hit the 1 or esc key.  I really wish they'd just turn usescan to false from the get go since it seems to create so much trouble, but at least this is a quasi elegant solution and dosbox updates very infrequently.
Dear forum: Play nice ;-)

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 4:43 pm

Ah, interesting.   Somehow, I had gotten the impression that this was a self-compile.  I'm surprised that something you get from apt-get would fail in this way.  Aren't those things supposed to be pre-certified - by people a lot smarter than us?

I only ran into problems when I did a self-compile.  And, TBH, I don't remember now why I did a self-compile rather than an apt-get.  I must have had a reason...

Actually, now I remember.  I was running under Knoppix ("live CD") - and you can't apt-get stuff on a live CD boot.  So, I had to compile it myself.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

zippity
Posts: 21
Joined: Sun Mar 04, 2012 4:02 pm

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 5:18 pm

Dosbox on the Pi, that's awesome. Daggerfall anyone?

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sat Apr 21, 2012 5:37 pm

Joe Schmoe said:


Ah, interesting.   Somehow, I had gotten the impression that this was a self-compile.  I'm surprised that something you get from apt-get would fail in this way.  Aren't those things supposed to be pre-certified - by people a lot smarter than us?

I only ran into problems when I did a self-compile.  And, TBH, I don't remember now why I did a self-compile rather than an apt-get.  I must have had a reason...

Actually, now I remember.  I was running under Knoppix ("live CD") - and you can't apt-get stuff on a live CD boot.  So, I had to compile it myself.



Apparently this is a known bug since 2003 from some of the threads I ran across.  I think it only happens on some PCs so it's never really been a big issue.
Dear forum: Play nice ;-)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Dosbox keyboard messed up in terminal only

Sun Apr 22, 2012 3:33 am

I realized I hadn't actually written a full explanation of how I solved this problem so here it is.

First get dosbox.  I used "apt-get install dosbox" (no quotes)

next run startx to get into the GUI

open dosbox from within the gui (for whatever reason the keyboard will work with in the x server)

once dosbox is open type "config –writeconf /usr/games/dosbox.conf" without the quotes

exit dosbox and the x server

type in (without quotes) "nano /usr/games/dosbox.conf" I like nano, but you can use vi if you like too

find the line that says "usescancodes=true" and change it to false save and exit

You can now run dosbox with the -config attribute and pass it the config file without the keyboard being all screwed up, but lets take it one further

go to /usr/bin

type in (no quotes) "mv /usr/bin/dosbox /usr/games/dosbox"

then "nano dosbox"

In the empty text file write in the following two lines including the quotes

#! /bin/bash

/usr/games/dosbox -conf /usr/games/dosbox.conf "$@"

Save and exit

chmod the file you just created to 0777 so you can actually run the dang thing (if you're a stickler for security use a lower setting)

you can now type in dosbox and it will run with the conf file!
Dear forum: Play nice ;-)

User avatar
jojopi
Posts: 3230
Joined: Tue Oct 11, 2011 8:38 pm

Re: Dosbox keyboard messed up in terminal only

Sun Apr 22, 2012 12:14 pm

Abishur said:

chmod the file you just created to 0777 so you can actually run the dang thing (if you're a stickler for security use a lower setting)
Of course you are free to use whatever settings you like on your own Pi.  But when publishing your procedures, please spend the extra time to work out what the best permissions would be.  In this case 0755, or just "+x" to leave the exact decision to umask.

Having world write permissions on any executable opens a privilege escalation attack where another user or program can change the file and then compromise the account of every user who runs it.  Your system may only have one user, but you cannot assume that is true elsewhere.

A tip for others: 0777 is literally never the right setting for any file or directory on a correctly-configured system.  So every time you see "chmod 0777" you know that the author turned all the permissions on without bothering which ones were needed.  You might be suspicious of everything else they say as well.

Return to “General discussion”