Re: [Freedos-user] Reply to keyboard issue and debug

2022-06-11 Thread Bret Johnson
I'll chime in a little bit late now that you've got it figured out.  In 
troubleshooting it's good to know how things are supposed to work, at least 
enough to narrow down whether the problem is most likely hardware or software.  
Based on the symptoms and the fact that you are running on real hardware pretty 
much eliminates this being a software problem.

In PS2 (and earlier) keyboards, the Typematic rate is controlled by the 
keyboard hardware.  The communication between the keyboard and the computer 
(the keyboard controller in the computer) is a relatively simple serial 
communications link that sends small packets of data.  The computer (BIOS) 
sends a packet of data to the keyboard telling it what the Typematic rate 
should be and the keyboard hardware handles all the details as keys are pressed 
and released afterward.  Eric's DEBUG example talks to the BIOS, and the BIOS 
in turn talks to the keyboard over the serial communications link.  The fact 
that your keyboard is sending some data indicates that the communications link 
(including the cable between the keyboard and computer) is probably OK, and so 
is the keyboard controller in the computer.  The problem, as you discovered, is 
in the keyboard itself.  If you're feeling ambitious you can try to open up the 
keyboard and see if there's anything obvious (like a broken wire or something), 
but it's probably best just to toss it.

A couple of things to note, though.  In the packet protocol that is used, there 
is no way to ask the keyboard what the current Typematic rate is.  So, the BIOS 
needs to keep track of it internally.  There is a standard BIOS function to 
retrieve the current Typematic rate, but a lot of BIOS's don't implement it.  
When it is implemented, the BIOS needs to keep track of the Typematic rate 
internally since it can't query the keyboard about it.

Another thing to keep in mind is that the (CapsLock, NumLock, and ScrollLock) 
LEDs in the keyboard are NOT controlled by the keyboard itself but are instead 
controlled by the computer (BIOS).  When you press the CapsLock key, for 
example, it causes the BIOS to send a packet of data to the keyboard to change 
the state of the LED.  The keyboard just does whatever the computer tells it to 
do when it comes to lighting the LEDs.  Also, it is not possible to tell the 
keyboard to change the state of just one LED -- you need to send the state of 
all three LEDs as a single packet of data.  And, similar to the Typematic rate, 
there is no way to query the keyboard about which LEDs are currently turned on 
so the BIOS also needs to keep track of that internally (but unlike the 
Typematic rate, there are standard BIOS memory locations where the LED statuses 
can be found).

If you're running inside a Virtual Machine (VM), as Eric noted sometimes the 
Virtual BIOS doesn't respond to Typematic rate requests.  I've never seen that 
problem with real hardware, though I suppose it's possible.  Another thing that 
can happen inside VMs is that the state of the LEDs on the keyboard doesn't 
always stay synchronized.  For example, the CapsLock state can be On in the 
Host (usually Windows or Linux) and Off in the Guest (DOS), and the CapsLock 
LED on the keyboard should (at least theoretically) change to reflect the state 
of whichever application currently has the focus (the Host or the Guest).  I'm 
not sure that happens correctly all the time.  I know I have lots of keyboard 
problems in my VMs, including the fact that the state of the keyboard LEDs is 
not always synchronized properly.

Lastly, all the above stuff only applies to PS2 and older keyboards and does 
not apply to USB keyboards.  In a sense, USB keyboards are dumber than PS2 
keyboards in that all they do is provide information about which key(s) are 
currently pressed.  All the Typematic related stuff and keeping track of when 
keys are released must all be handled in software since the USB hardware 
doesn't handle any of that. 


___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


[Freedos-user] Reply to keyboard issue and debug

2022-06-10 Thread Daniel
I tried the Debug Eric and it works gret for the keyboards except that one
wired keyboard.  Quite odd one wired keyboard doesn’t allow repeats but
others do.

On Fri, Jun 10, 2022 at 14:53 
wrote:

> Send Freedos-user mailing list submissions to
> freedos-user@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/freedos-user
> or, via email, send a message with subject or body 'help' to
> freedos-user-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
> freedos-user-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Freedos-user digest..."
>
>
> Today's Topics:
>
>1. Re: Keyboard issue - wondering about typematic rate for
>   keyboard repeats in different VMs and emulators (Eric Auer)
>2. Keyboard issue (Fixed) (Daniel)
>
>
> --
>
> Message: 1
> Date: Fri, 10 Jun 2022 20:48:48 +0200
> From: Eric Auer 
> To: freedos-user@lists.sourceforge.net
> Subject: Re: [Freedos-user] Keyboard issue - wondering about typematic
> rate for keyboard repeats in different VMs and emulators
> Message-ID: <78d3dc5d-719f-0f6f-70ff-19cf63ca6...@jpberlin.de>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
>
> Tom,
>
> >> In DOS I was able to press and hold a key and the key would repeat.
> >> Great for arrow and page keys.? For some reason this stopped workin
> >
> > wow. one of these Asshole from Hell questions:
> >
> > no information what DOS we are talkink about.
> >
> > no information whatsoever about CONFIG.SYS/AUTOEXEC.BAT.
>
> I somehow liked Dennis' way of asking for more context and details
> better :-p However, I also have a technical question about Daniel's
> technical question :-)
>
> Daniel, you could do the following to test whether explicitly setting
> keyboard repeat (typematic rate, see RBIL = Ralf Browns Interrupt List)
> to maximum speed and the delay to minimum has any effect on your real or
> virtual hardware. For this, you start DEBUG, then type:
>
> acs:100
> mov ax,0305
> mov bx,
> int 16
> int 20
>
> g
> q
>
> Note that you have to press return twice between "int 20" and "g".
>
> For the lowest possible speed and the longest delay before repeating
> starts, you write "031f" instead of "" in the "mov bx,..." line.
>
> Interestingly, it seems to make no difference in DOSEMU2 which of the
> two values I use for BX. It probably just uses the keyboard repeat
> settings from Linux, without letting me a custom different rate just for
> the DOSEMU2 window.
>
> So I would be keen to know which of the other DOS systems people here
> are using do or do not support changing the typematic rate aka keyboard
> repeat rate. In particular, I guess that real hardware often supports
> this, while running DOS on a virtual computer in a window could be less
> likely to offer support for this setting?
>
> Thanks for testing! Regards, Eric
>
>
>
>
> --
>
> Message: 2
> Date: Fri, 10 Jun 2022 14:52:47 -0400
> From: Daniel 
> To: freedos-user@lists.sourceforge.net
> Subject: [Freedos-user] Keyboard issue (Fixed)
> Message-ID:
> <
> cafbn1xvlprozwsgzeymgbc1m5c06cu-3uruxunacl92vxr9...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Nice response Tom.  Next time don?t be so shy and really let the language
> fly, but ya did have a good point if not good language.
>
> 1) Real DOS on bare metal runnin msdos 7.1.  I have had this happen on
> FreeDOS as well.
>
> 2) Config.sys and autoexec bat are the same and nothin there has changed.
>
> Fix:  The fix was a simple one yet quite odd, in my opinion.  Apparently
> while one keyboard will allow me to hold down a key and it repeats, another
> keyboard wasn?t allowing me to do it.  Not sure why that is.  I found out
> this was the issue when it was suggested I try another keyboard.
>
> On Fri, Jun 10, 2022 at 14:37 
> wrote:
>
> > Send Freedos-user mailing list submissions to
> > freedos-user@lists.sourceforge.net
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://lists.sourceforge.net/lists/listinfo/freedos-user
> > or, via email, send a message with subject or body 'help' to
> > freedos-user-requ...@lists.sourceforge.net
> >
> > You can reach the person managing the list at
> > freedos-user-ow...@lists.sourceforge.net
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Freedos-user digest..."
> >
> >
> > Today's Topics:
> >
> >1. Keyboard issue (Daniel)
> >2. Re: Keyboard issue (dmccunney)
> >3. Re: Keyboard issue (tom ehlert)
> >
> >
> > --
> >
> > Message: 1
> > Date: Fri, 10 Jun 2022 13:45:13 -0400
> > From: Daniel 
> > To: