Work on an xHCI driver implementation

One of the most essential devices in a modern computer is the USB controller. While Lemon OS has gotten by using PS/2 emulation on input devices and relying on the OS to be on an internal storage devices, these both have various problems from dodgy PS/2 emulation to it being an absolute pain to have to copy the files to disk when testing on real hardware. Support for USB human input devices and mass storage would be a major improvement.

Through supporting xHCI (eXtended Host Controller Interface) Lemon will be able to access both USB 3 and USB 2 devices on any computer with a compatible controller.

Implementing xHCI has been a bumpy ride so far with the implementation varying across various VMs and chipsets. So far the Lemon OS xHCI driver is very limited and cannot do more than check for connected devices and check for which ports are USB 2 and USB 3.

[INFO]    [XHCI] Initializing protocol "USB ", Version: 02.00, Port Range: 1-9
[INFO]    [XHCI] Initializing protocol "USB ", Version: 03.00, Port Range: 9-15
[INFO]    [XHCI] Interface version: 0x100, Page size: 1, Operational registers offset: 0x80, Runtime registers offset: 0x2000, Doorbell registers offset: 0x3000
[INFO]    [XHCI] MaxSlots: 0x20, Max Scratchpad Buffers: 0x0
[INFO]    Port 1 is enabled!

Python 3.8.2 On Lemon OS!

Python 3.8.2 is finally running on Lemon OS!

Python is finally up and running on Lemon OS! This is definitely the biggest port to Lemon OS yet, and it is nice to see that Lemon is much more capable than it was just a few months ago.

Thanks to large developments with mlibc, there was little tweaking required, besides build system changes. In porting python there was only one additional POSIX function to be implemented – fcntl. I added three new system calls:

  • SysDup – Duplicate a file descriptor
  • SysGetFileStatusFlags – Get file descriptor status flags (access mode, etc.)
  • SysSetFileStatusFlags – Set file descriptor status flags (will only set O_APPEND or O_NONBLOCK) as per fcntl F_SETFL

SysDup is also used by the dup function, and fcntl acts as a wrapper for all of these.

With a few build system tweaks (adding lemon to config.sub, etc.) a patch and buildport script has been added to the Lemon OS repository.