port 60h wonder

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I would try Bios setup to see if you can get any info about keyboard there, i would also try some 32bit hobby OS, with idt setup to see if they work.
Also have you tyred a exterior keyboard ?.
Last edited by Dex on Wed Mar 19, 2008 7:52 am, edited 1 time in total.
User avatar
Philip
Member
Member
Posts: 59
Joined: Thu Mar 06, 2008 11:37 pm
Location: Singapore

Post by Philip »

yeah the tc1000 keyboard is removable, can unplug it out
maybe that's the reason why cant read it from port 60h?
(my keyboard is HID keyboard)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

If you're saying that you're using a USB keyboard, then accessing it via the keyboard (PS/2) controller is likely to cause trouble sooner or later, because it's not connected there.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Philip
Member
Member
Posts: 59
Joined: Thu Mar 06, 2008 11:37 pm
Location: Singapore

Post by Philip »

it is shown in windows xp as "HID Keyboard Device", i guess it is actually "USB HID Keyboard Device", the keyboard has mouse buttons combo and connected to the mainboard by a 12 pin port
anybody knows how to read from this device?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

See your other thread. ](*,)
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Try http://www.lvr.com/hidpage.htm
And check theres no legac support in the BIOS.
User avatar
Philip
Member
Member
Posts: 59
Joined: Thu Mar 06, 2008 11:37 pm
Location: Singapore

Post by Philip »

just want to share with you guys a link to usb programming in assembly:

http://www.frontiernet.net/~fys/usb.htm

other assembly codes of the same author (quite great):

http://www.frontiernet.net/~fys/index.htm
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

JamesM wrote:See your other thread. ](*,)
Correction: 2 other threads, there's that 5 year old one that got dug up as well. :roll:
User avatar
Philip
Member
Member
Posts: 59
Joined: Thu Mar 06, 2008 11:37 pm
Location: Singapore

Post by Philip »

Dex wrote:Try http://www.lvr.com/hidpage.htm
And check theres no legac support in the BIOS.
only contains windows code like delphi vc++ etc.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

only contains windows code like delphi vc++ etc.
Wrong.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

Philip wrote:i found out the problem,
it is because of my tablet pc compaq tc1000
port 60h is not the keyboard port as i tried
to write a small program in real mode and run under dos to check but
the value from port 60h is also always AAh
If you are serious about OS programming then stay away from real hardware as long as you can. Use Bochs, for example. As for port 60h, I'd be very surprised if it doesn't work on your system. If the port was absent, it should return 0xff, not 0xaa. 0xaa indicates to me the port is working just fine. See for example here and also here on how to communicate with the keyboard controller. Try e.g. the diagnostics echo (0xee) or setting the keyboard lights (0xed) and see if that works. If not, try resetting the controller (0xff). Or maybe you should simply first enable it (0xf4, 0xf6).


JAL
User avatar
Philip
Member
Member
Posts: 59
Joined: Thu Mar 06, 2008 11:37 pm
Location: Singapore

Post by Philip »

hi jal, thanks for the links
but my keyboard is USB HID, so just cant read from port 60h
if you know how to read from usb port, pls tell me
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post by JAAman »

you cant
simple as that. you cant
there is no way to simply 'read from the usb port' -- this is not a simple port read, like the keyboard port


1) you must first find the usb port, which means supporting PCI PnP and scanning the PCI bus to find the USB controller

2) once you have identified and located the USB controller, you must initialize it

3) once you have initialized it, you must learn to comunicate with it -- which is very complicated


i dont know more than that, as i havent done it myself (compatability with USB devices is one of the last things you do when writing an OS...)
this is what people have been trying to tell you, and have pointed you to the appropriate documentation



the much easier approach would be to forget about USB for now, and simply use the traditional interface, to do this you can either:

1) use a VM -- Bochs, VMware, VPC, and QEMU are the most commonly used ones, there are other advantages to using them besides just keyboard

2) go into your BIOS setup program, and enable legacy keyboard compatibility (to get into the BIOS, you may need to connect a PS/2 keyboard though... a lot of systems wont recognize a USB keyboard)
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

Philip wrote:hi jal, thanks for the links
but my keyboard is USB HID, so just cant read from port 60h
if you know how to read from usb port, pls tell me
It's relatively difficult, as JAAMan wrote (at least not as easy as PS/2, as you need a USB stack of drivers: PCI to detect it, USB controller, USB HID class driver, keyboard driver, etc.). However, if you can get into the BIOS setup with the keyboard, chances are large that it has legacy support enabled. That means that normal keyboard reading should work, although not all commands may be supported, depending on what is emulated. You could try booting into e.g. FreeDOS, and if that works without problems, you know for sure legacy support is enabled (as DOS lacks USB support).


JAL
User avatar
Philip
Member
Member
Posts: 59
Joined: Thu Mar 06, 2008 11:37 pm
Location: Singapore

Post by Philip »

could not read from port 60h of tc1000, i bought a different computer already, what a waste of money, damn the USB keyboard
Post Reply