Implement TinyUSB host-mode BadUSB detection and add project documentation#1
Implement TinyUSB host-mode BadUSB detection and add project documentation#1NotoriousArnav merged 3 commits intomasterfrom
Conversation
Rewrite README.md with feature overview, hardware summary, quick start, and documentation index. Move BUILDING.md and IMPLEMENTATION_SUMMARY.md into docs/ and add five new reference documents: ARCHITECTURE.md, HARDWARE.md, API_REFERENCE.md, THREAT_DETECTION.md, and TROUBLESHOOTING.md covering system design, wiring, full API reference, detection pipeline, and common issues.
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR refactors PlugSafe from GPIO-based USB device detection to a complete TinyUSB host stack integration. It introduces dynamic device enumeration with HID protocol classification, windowed keystroke-rate threat monitoring, OLED display mode toggling via BOOTSEL button, comprehensive project documentation, and optimized build configuration with UART stdio. Changes
Sequence Diagram(s)sequenceDiagram
participant USB Device
participant TinyUSB Host Stack
participant USB Host Manager
participant HID Monitor
participant Threat Analyzer
participant Display
USB Device->>TinyUSB Host Stack: Device plugged in
TinyUSB Host Stack->>USB Host Manager: tuh_mount_cb(daddr)
USB Host Manager->>USB Host Manager: Fetch device descriptor
USB Host Manager->>Threat Analyzer: threat_add_device(dev_info)
Threat Analyzer->>Threat Analyzer: Classify initial threat level
Threat Analyzer->>Display: Update threat status
alt HID Device Detected
TinyUSB Host Stack->>USB Host Manager: tuh_hid_mount_cb(daddr, protocol)
USB Host Manager->>HID Monitor: Register for keystroke monitoring
USB Host Manager->>Threat Analyzer: threat_update_device_info(dev_info)
rect rgba(0, 100, 200, 0.5)
loop HID Activity
USB Device->>TinyUSB Host Stack: Send HID report (keystroke)
TinyUSB Host Stack->>USB Host Manager: tuh_hid_report_received_cb()
USB Host Manager->>HID Monitor: Update keystroke rate (1-sec window)
HID Monitor->>Threat Analyzer: threat_update_hid_activity()
Threat Analyzer->>Threat Analyzer: Check windowed rate vs. threshold
alt Rate Exceeds Threshold
Threat Analyzer->>Threat Analyzer: Escalate to MALICIOUS
Threat Analyzer->>Display: Update threat indicator
end
end
end
end
USB Device->>TinyUSB Host Stack: Device unplugged
TinyUSB Host Stack->>USB Host Manager: tuh_umount_cb(daddr)
USB Host Manager->>Threat Analyzer: threat_remove_device()
USB Host Manager->>HID Monitor: Unregister device
USB Host Manager->>Display: Update device list
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Summary by CodeRabbit
Release Notes
New Features
Documentation