# PrismOS — Goal: Real Hardware

## Objective
PrismOS on real hardware — keyboard, mouse, HTTPS to prismsoftware.ru

## Machines

### Laptop (Main target)
- **Keyboard**: PS/2 (встроенная) + USB
- **WiFi**: Intel Corporation Cannon Point-LP CNVi [Wireless-AC] (rev 30)
- **Boot**: UEFI, x86_64
- **Status**: boots, shell works, WiFi init fails (need correct PCI ID)

### Main Desktop (this is where I am at right now)
- **Keyboard**: Только внешняя USB
- **WiFi**: MediaTek MT7922 802.11ax
- **Boot**: UEFI, x86_64
- **Status**: boots, USB keyboard + mouse should work

### Old (like HELLA old) PC (legacy)
- **Boot**: Legacy BIOS — PrismOS только UEFI, не загрузится
- **Status**: skip

## Plan

### Phase 1: Laptop (Intel CNVi)
1. `lspci` — найти правильный Device ID для Intel CNVi
2. Добавить ID в wifi.c
3. WiFi init должен пройти
4. WiFi firmware loading
5. WiFi scan + connect

### Phase 2: Keyboard + Mouse
1. PS/2 клавиатура уже работает на laptop
2. USB keyboard — xHCI driver with multi-device support
3. USB mouse driver (HID Boot Protocol) — 4-byte reports
4. Mouse cursor на экране (software cursor with save/restore background)
5. Alt+Shift toggle работает для обеих раскладок

### Phase 3: HTTPS POST
1. DNS + TCP + TLS работают (проверено в QEMU)
2. Browse to prismsoftware.ru
3. POST data — `post <url> <data> [content-type]`

## Completed
- [x] UEFI boot
- [x] Shell + keyboard input
- [x] Ethernet (e1000) in QEMU
- [x] TCP/IP stack
- [x] TLS 1.2 + ECC
- [x] HTTPS GET (example.com, prismsoftware.ru)
- [x] HTTP/HTTPS POST support
- [x] WiFi driver framework (Intel + MT7922)
- [x] DMA allocator
- [x] FH DMA + Context Info v2 (Intel)
- [x] Firmware loading from filesystem
- [x] Interrupt handlers
- [x] `lspci` command
- [x] USB keyboard (xHCI)
- [x] USB mouse (HID Boot Protocol, multi-slot xHCI)
- [x] Software cursor with save/restore background
- [x] HTML parser with Cyrillic UTF-8 → CP1251
- [x] `post` command for HTTP/HTTPS POST
- [x] Debug panel toggle (F1 / `debug`)
- [x] Top status bar + bottom hint bar
- [x] PrismOS logo in `fetch` command
- [x] Mouse wheel scroll in less viewer
- [x] Fixed getchar() USB/PS/2 priority (USB checked first, shared ps2_decode)
- [x] **xHCI driver bugfixes**:
  - Split kbd/mouse slot IDs (`kbd_device_slot_id` separate from global)
  - Event ring: check slot ID before consuming (keyboard only processes kbd events, mouse only mouse)
  - Doorbell uses per-device slot IDs (`dbreg[kbd_device_slot_id]` / `dbreg[mouse_slot_id]`)
  - TSC-based microsecond delays (`delay_us`) instead of empty volatile loops
  - QEMU command line: explicit `bus=xhci.0` binding
  - Proper rearm functions (`rearm_kbd`, `rearm_mouse`)
- [x] Serial input (COM1) for `-nographic` mode

## Remaining
- [ ] WiFi firmware loading from FAT (need `iwlwifi-*-iml` files)
- [ ] WiFi scan + connect commands
- [ ] WiFi on real hardware (Intel CNVi 9560)
- [ ] Verify readline on real hardware (PS/2 fix applied: USB keyboard checked first, shared ps2_decode)
