OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 11:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Initializing the PS/2 controller: yes or no?
PostPosted: Fri Apr 26, 2019 4:03 am 
Offline

Joined: Tue Aug 12, 2014 4:49 am
Posts: 9
Looking at some existing code and posts here on the forum, it seems that the BIOS or GRUB will initialize the PS/2 controller and keyboard, so there's not much left for you to do in order to use the keyboard, aside from setting up interrupts and writing a keyboard handler.

But the wiki page says the controller could be left in an unreliable state and it's thus better to (re)initialize it yourself.

I'm working on a simple kernel for a college assignment that requires the keyboard to work and boots with GRUB. Should I bother with the controller or not?


Top
 Profile  
 
 Post subject: Re: Initializing the PS/2 controller: yes or no?
PostPosted: Fri Apr 26, 2019 4:15 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1593
Yes, you should reinitialize the controller. By the time you gain control of the machine, you don't know what the thing has been initialized to do, or if it was initialized at all. You should probably initialize the USB controllers before that, though, due to USB legacy support (without initializing the USB controllers, you can never be sure if you actually are speaking to a PS/2 controller or to the BIOS via SMIs. You can't even tell the difference without asking the chipset itself, and even then, some chipsets won't even let themselves be asked about these things).

For instance, is the controller set up for translation or not? If you have a BIOS computer, chances are it is. With UEFI, who knows? And GRUB does something new each version.

Also, you need to initialize the controller to be able to tell which ports it has and which of these ports have devices attached to them. And which devices they have. Unless you're cool with just assuming the user will have done the right thing.

Typing this on a PS/2 keyboard, by the way, because I have discovered that's just how the keyboard of this laptop is wired up. So that's a thing as well: Statically attached peripherals.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: Initializing the PS/2 controller: yes or no?
PostPosted: Sat Apr 27, 2019 6:56 am 
Offline

Joined: Tue Aug 12, 2014 4:49 am
Posts: 9
Well, I got it working. Thanks. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 86 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group