name: driver-engineering
description: Linux device driver engineering skill for hardware interface development, device models, bus architectures (PCI, USB, I2C, SPI, Platform), DMA, interrupts, and power management. Covers driver registration, probe and remove semantics, devm managed resources, deferred probing, firmware loading, lspci and udevadm hardware diagnostics, and QEMU hardware emulation. Use when investigating unsupported PCI/USB devices, diagnosing driver probe failures, writing kernel drivers, or analyzing driver resource management.
license: Apache-2.0
compatibility: Requires Linux environment, Python 3, make, GCC or Clang toolchains.
metadata:
author: Eshan Roy
version: "0.1.0"
claude_context: "fork"
claude_agent: "general"
Linux Device Driver Engineering
The driver-engineering skill provides specialist capabilities for analyzing hardware devices, implementing Linux kernel drivers across standard buses (PCI, USB, I2C, SPI, Platform), managing DMA and hardware interrupts, diagnosing probe failures, and verifying drivers safely.
1. Operating Principles & Invariants
- Reuse Before Writing: Never recommend authoring a new kernel driver when an existing subsystem driver or generic framework (e.g.
uio, vfio, industrialio) supports the hardware via ID addition or quirk handling.
- Differentiate Missing Firmware from Driver Bugs: An initialization failure reporting
-2 (-ENOENT) frequently indicates a missing binary microcode file in /usr/lib/firmware/, not broken C code.
- No Unverified Silicon Claims: Clearly distinguish between QEMU virtual device emulation and physical hardware validation. Never claim hardware compatibility based on compilation alone.
- Safety Tier Gating: Never load unverified kernel modules (
insmod/modprobe) on the host system without explicit human authorization. Use isolated VMs for device testing.
2. Intent Classification & Workflow Routing
flowchart TD
REQ["Driver Engineering Request"] --> CLASS{"Classify Driver Task"}
CLASS -->|Hardware Identification| ID["1. Hardware Reconnaissance\n(lspci -nn, lsusb -v, udevadm, vendor:device IDs)"]
CLASS -->|Probe / Initialization Failure| PROBE["2. Probe Diagnosis\n(dmesg, dyndbg, deferred probe, missing firmware)"]
CLASS -->|Driver Development / Fix| DEV["3. Driver Implementation\n(bus_type, probe/remove, devm_* resources, DMA)"]
CLASS -->|Power Management / IRQ| PM["4. Subsystem Integration\n(MSI-X, threaded IRQ, runtime PM dev_pm_ops)"]
CLASS -->|Verification & Emulation| TEST["5. Driver Testing\n(QEMU emulation, KUnit device mocks, report limits)"]
ID --> EXEC["Execute Driver Workflow"]
PROBE --> EXEC
DEV --> EXEC
PM --> EXEC
TEST --> EXEC
3. The 6-Step Driver Development Workflow
- Hardware Reconnaissance: Extract exact numeric PCI Vendor:Device IDs (
lspci -nn) or USB Vendor:Product IDs (lsusb -v).
- Subsystem Search: Query kernel source for existing support in
drivers/<subsystem>/. Check if adding an entry to pci_device_id or usb_device_id table suffices.
- Firmware Verification: Check if the hardware controller requires binary firmware images from
/usr/lib/firmware/.
- Driver Implementation: Use managed allocations (
devm_kzalloc, devm_request_threaded_irq) to guarantee leak-free cleanup upon removal.
- Bus & Power Integration: Implement
dev_pm_ops for runtime power management and system sleep.
- Isolated Testing: Test driver registration, probe, and transfer operations in QEMU before considering physical hardware.
4. Cross-Specialist Coordination
| Task |
Coordinating Specialists |
Interaction |
| Out-of-tree DKMS package |
driver-engineering + arch-packaging |
driver-engineering authors the driver; arch-packaging produces DKMS PKGBUILD. |
| Network interface driver failure |
driver-engineering + linux-networking |
driver-engineering debugs PCI/DMA; linux-networking verifies carrier state and ethtool. |
| NVMe controller failure |
driver-engineering + linux-storage |
driver-engineering diagnoses PCIe link/BARs; linux-storage diagnoses blk-mq queue state. |
5. Authoritative References Directory
- Device Model & Driver Lifecycle
- PCI/PCIe & USB Subsystems
- I2C, SPI & Platform Buses
- DMA & Hardware Interrupts
- Driver Power Management
- Driver Debugging & Diagnostics
- Driver Testing & Validation
- Safety Policy
1---2name: driver-engineering3description: Linux device driver engineering skill for hardware interface development, device models, bus architectures (PCI, USB, I2C, SPI, Platform), DMA, interrupts, and4---5---6name: driver-engineering7description: Linux device driver engineering skill for hardware interface development, device models, bus architectures (PCI, USB, I2C, SPI, Platform), DMA, interrupts, and power management. Covers driver registration, probe and remove semantics, devm managed resources, deferred probing, firmware loading, lspci and udevadm hardware diagnostics, and QEMU hardware emulation. Use when investigating unsupported PCI/USB devices, diagnosing driver probe failures, writing kernel drivers, or analyzing driver resource management.8license: Apache-2.09compatibility: Requires Linux environment, Python 3, make, GCC or Clang toolchains.10metadata:11 author: Eshan Roy12 version: "0.1.0"13 claude_context: "fork"14 claude_agent: "general"15---1617# Linux Device Driver Engineering1819The `driver-engineering` skill provides specialist capabilities for analyzing hardware devices, implementing Linux kernel drivers across standard buses (PCI, USB, I2C, SPI, Platform), managing DMA and hardware interrupts, diagnosing probe failures, and verifying drivers safely.2021---2223## 1. Operating Principles & Invariants24251. **Reuse Before Writing**: Never recommend authoring a new kernel driver when an existing subsystem driver or generic framework (e.g. `uio`, `vfio`, `industrialio`) supports the hardware via ID addition or quirk handling.262. **Differentiate Missing Firmware from Driver Bugs**: An initialization failure reporting `-2` (`-ENOENT`) frequently indicates a missing binary microcode file in `/usr/lib/firmware/`, not broken C code.273. **No Unverified Silicon Claims**: Clearly distinguish between QEMU virtual device emulation and physical hardware validation. Never claim hardware compatibility based on compilation alone.284. **Safety Tier Gating**: Never load unverified kernel modules (`insmod`/`modprobe`) on the host system without explicit human authorization. Use isolated VMs for device testing.2930---3132## 2. Intent Classification & Workflow Routing3334```mermaid35flowchart TD36 REQ["Driver Engineering Request"] --> CLASS{"Classify Driver Task"}3738 CLASS -->|Hardware Identification| ID["1. Hardware Reconnaissance\n(lspci -nn, lsusb -v, udevadm, vendor:device IDs)"]39 CLASS -->|Probe / Initialization Failure| PROBE["2. Probe Diagnosis\n(dmesg, dyndbg, deferred probe, missing firmware)"]40 CLASS -->|Driver Development / Fix| DEV["3. Driver Implementation\n(bus_type, probe/remove, devm_* resources, DMA)"]41 CLASS -->|Power Management / IRQ| PM["4. Subsystem Integration\n(MSI-X, threaded IRQ, runtime PM dev_pm_ops)"]42 CLASS -->|Verification & Emulation| TEST["5. Driver Testing\n(QEMU emulation, KUnit device mocks, report limits)"]4344 ID --> EXEC["Execute Driver Workflow"]45 PROBE --> EXEC46 DEV --> EXEC47 PM --> EXEC48 TEST --> EXEC49```5051---5253## 3. The 6-Step Driver Development Workflow54551. **Hardware Reconnaissance**: Extract exact numeric PCI Vendor:Device IDs (`lspci -nn`) or USB Vendor:Product IDs (`lsusb -v`).562. **Subsystem Search**: Query kernel source for existing support in `drivers/<subsystem>/`. Check if adding an entry to `pci_device_id` or `usb_device_id` table suffices.573. **Firmware Verification**: Check if the hardware controller requires binary firmware images from `/usr/lib/firmware/`.584. **Driver Implementation**: Use managed allocations (`devm_kzalloc`, `devm_request_threaded_irq`) to guarantee leak-free cleanup upon removal.595. **Bus & Power Integration**: Implement `dev_pm_ops` for runtime power management and system sleep.606. **Isolated Testing**: Test driver registration, probe, and transfer operations in QEMU before considering physical hardware.6162---6364## 4. Cross-Specialist Coordination6566| Task | Coordinating Specialists | Interaction |67|:---|:---|:---|68| Out-of-tree DKMS package | `driver-engineering` + `arch-packaging` | `driver-engineering` authors the driver; `arch-packaging` produces DKMS PKGBUILD. |69| Network interface driver failure | `driver-engineering` + `linux-networking` | `driver-engineering` debugs PCI/DMA; `linux-networking` verifies carrier state and ethtool. |70| NVMe controller failure | `driver-engineering` + `linux-storage` | `driver-engineering` diagnoses PCIe link/BARs; `linux-storage` diagnoses blk-mq queue state. |7172---7374## 5. Authoritative References Directory7576- [Device Model & Driver Lifecycle](references/device-model.md)77- [PCI/PCIe & USB Subsystems](references/pci-usb.md)78- [I2C, SPI & Platform Buses](references/i2c-spi.md)79- [DMA & Hardware Interrupts](references/dma-interrupts.md)80- [Driver Power Management](references/power-management.md)81- [Driver Debugging & Diagnostics](references/driver-debugging.md)82- [Driver Testing & Validation](references/driver-testing.md)83- [Safety Policy](../../references/safety-policy.md)