OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:02 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: [SOLVED] How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 10:33 am 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
I do not want to deal with in or out because I do not on Windows, I setup data structure and call a bunch of functions to initialize HID protocol and thus being able to talk to my keyboard or any USB devices.

https://www.codeproject.com/Articles/12 ... -using-HID


Last edited by Rukog on Sun Aug 08, 2021 4:54 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 10:46 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
HID specification is here https://www.usb.org/sites/default/files/hid1_11.pdf

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 11:01 am 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
Klakap wrote:


I know everything about this already, it doesn't say how can I do that in a non Windows environment.

Update:
My current research is at
https://en.wikipedia.org/wiki/Ioctl
https://docs.microsoft.com/en-us/window ... eiocontrol
https://elixir.bootlin.com/linux/latest ... octl.c#L24

Maybe it's all about that, the IOCTL thing


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 11:46 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
I apologize, but I do not understand how is this connected with OS development. Shouldn’t this be in General Programming? If you want to parse HID, you need to have written USB driver as first. HID parsing comes when you receive HID protocol from USB device.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 11:51 am 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
Klakap wrote:
I apologize, but I do not understand how is this connected with OS development. Shouldn’t this be in General Programming? If you want to parse HID, you need to have written USB driver as first. HID parsing comes when you receive HID protocol from USB device.


It is, same as viewtopic.php?f=1&t=49913
Both of those requests are aiming to handle device communication for further implementation inside an OS.

The USB driver handle HID protocol, it's its nature, a driver is written to offer a gate of communication between PC and device, thus HID protocol for USBD.

What I've wrote is a driver, a user land driver but still a driver, but for windows: https://www.codeproject.com/Articles/12 ... -using-HID

Now I want to write an equivalent driver as the one above for my own OS.


Last edited by Rukog on Sat Aug 07, 2021 12:15 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 12:00 pm 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
HID protocol is not about communicating with USB devices. Communication with USB devices is doing through USB controllers OHCI/UHCI/EHCI/xHCI. When you can communicate with USB device, you can found that it is Human Interface Device, and parse HID protocol to found how you can use data which is device sending to you.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 12:08 pm 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
Klakap wrote:
... through USB controllers OHCI/UHCI/EHCI/xHCI ...


All of these are related to the PCI thing ?


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 12:10 pm 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Yes, from PCI you read base address of ports of these controllers. But do not be worry about PCI, writing driver for it is not hard thing.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 12:13 pm 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
Klakap wrote:
Yes, from PCI you read base address of ports of these controllers. But do not be worry about PCI, writing driver for it is not hard thing.


Ok thanks, I will take a look on that thing lol


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 07, 2021 12:20 pm 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
In fact, if you want to have from your operation system something more than simply showing something to screen, you have to write PCI driver. In PCI is connected everything, hard disk, CDROM, sound card, USB controllers, network cards...

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: How can I implement HID protocol ?
PostPosted: Sat Aug 14, 2021 5:15 am 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
Why is it so hard to get the PCI Firmware Specification PDF :shock:

https://pcisig.com/firmware-wg-pci-firm ... change-bar

Have to be an org or smth to be able to dl that stuff, it's not the same song for USB spec https://usb.org/hid

I have to search for that like I would do for a torrent lol

(I found it btw, not sure I can share the link here)


Top
 Profile  
 
 Post subject: Re: [SOLVED] How can I implement HID protocol ?
PostPosted: Sat Aug 14, 2021 6:39 am 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
No, don't share it :D . There is book on the internet called PCI systems architecture that the publishers made as a free PDF. You could try using that

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Google [Bot], SanderR and 61 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