From: Lonnie C. <lo...@ou...> - 2022-02-24 20:16:07
|
Thanks everyone for the information and guidance on this and I will dig into writing a USB driver stack that will work with the kernel as a first step. Best Regards, Lonnie Email: Lon...@Ou... On Thu, Feb 24, 2022 at 3:13 PM David Grayson <dav...@gm...> wrote: > Actually, it sounds like your immediate goal is to get a USB mouse and > keyboard working with your computer, and libusb has nothing to do with > that. To do that, you need to write a stack of USB drivers, including a > driver that talks to your USB controller and a driver that understands the > USB HID class specification. Later, when you want to provide user-space > applications a flexible interface for talking to USB drivers, then you > might want to look into libusb and the stuff I wrote above. > > --David > > On Thu, Feb 24, 2022 at 12:10 PM David Grayson <dav...@gm...> > wrote: > >> libusb is meant to be run in user space, not the kernel. It uses system >> calls to talk to the kernel and tell the kernel what kind of I/O it wants >> to perform on the USB devices connected to the system. The kernel needs to >> have its own sophisticated USB drivers in order to handle those requests >> from libusb. It would take those requests and figure out how to pass them >> on to the USB controller devices in your computer. I don't know much about >> the lower-level interfaces used by USB controllers, but I've heard keywords >> like UHCI and XHCI. >> >> If you want to make things easy for users, you could design your kernel >> so that the userspace interface for its USB drivers is identical to the >> Linux interface, so that libusb, libusbp, and similar libraries do not need >> to be rewritten/ported for your OS. >> >> --David Grayson >> >> On Thu, Feb 24, 2022 at 10:26 AM Lonnie Cumberland <lo...@ou...> >> wrote: >> >>> Hi All, >>> >>> Hope that everyone is doing well. >>> >>> I am working on an x86_64 OS development (actually an upgrade from an >>> older development) in which it basically has the kernel and I am just now >>> getting the Newlib clib ported over to it. >>> >>> The system has some basic drivers and simple functionality already and >>> boots up well. >>> >>> The problem is that the I/O coding for the keyboard and mouse were based >>> upon PS2 and most newer systems now have USB keyboards and mouse interfaces. >>> >>> In my research, I have come across LibUSB as a viable cross platform >>> library that may be what I need. >>> >>> The other catch is that I am also learning about modern OS development >>> along the way and am wondering if someone might be able to give me some >>> information or some simple example on how libusb could be used to determine >>> if a PS2 or USB keyboard was attached and then use that code. >>> >>> My development system has a USB keyboard (real hardware) but in testing >>> in QEMU it can emulate PS2 and run fine in there, but not on the real >>> hardware. >>> >>> Any thoughts or suggestions would be greatly appreciated. >>> >>> Best Regards, >>> Lonnie >>> Email: Lon...@Ou... >>> _______________________________________________ >>> libusb-devel mailing list >>> lib...@li... >>> https://lists.sourceforge.net/lists/listinfo/libusb-devel >>> >> |