android-uvc-microscope-scaffold

Integrates USB UVC cameras into Android apps with evidence-based access path selection.

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/nolte/claude-android-engineering --skill android-uvc-microscope-scaffold-nolte
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-uvc-microscope-scaffold
Source: https://github.com/nolte/claude-android-engineering/tree/main/skills/android-uvc-microscope-scaffold
Command: npx skills add https://github.com/nolte/claude-android-engineering --skill android-uvc-microscope-scaffold-nolte

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Connecting an external USB microscope or endoscope to an Android app fails in non-obvious ways: the platform camera framework may not expose the device, the community libuvc engine crashes on targetSdk 34 during permission registration, and the peripheral occupies the phone's only USB port, breaking cabled ADB. This Skill operationalizes a spec-driven integration that decides the correct access path on measured device evidence instead of assumptions. ## Core Features & Use Cases - Evidence-based access path decision: Captures USB descriptors, runs a Camera2 LENS_FACING_EXTERNAL probe on the target device, and only falls back to the pinned libuvc:3.2.7 engine (or a recorded libausbc wrapper fallback) when the platform does not expose the camera. - TargetSdk-correct USB permission flow: Builds the grant request with an explicit, mutable PendingIntent and an explicitly exported receiver, never calling USBMonitor.register(), and hands the CAMERA permission decision to android-permissions-derive. - In-memory still capture and hardware controls: Captures JPEGs via a one-shot frame callback with YuvImage (no storage permission), wires body shutter buttons through UVC status callbacks, and provides labelled digital zoom. - Read-only audit operation: Checks an existing UVC integration against a 28-item conformance checklist with severities and fix steps. - Use Case: A user reports their USB microscope shows a black screen in their Kotlin app; the Skill diagnoses stream vs rendering faults via the libUVCCamera log tag over network ADB and fixes the guarded open sequence. ## Quick Start Ask the assistant to integrate a USB microscope into the existing Android app, confirming a physical OTG-capable device is reachable over ADB first.

Frequently Asked Questions about android-uvc-microscope-scaffold

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate a USB microscope camera into an Android app?

First capture the device descriptors with dumpsys usb and lsusb, then run a Camera2 LENS_FACING_EXTERNAL probe on the target device. If the platform exposes the camera with live preview frames, build on CameraX/Camera2; otherwise integrate the libuvc engine at the USBMonitor+UVCCamera layer with libuvc:3.2.7 pinned.

Why does my Android app crash when requesting USB permission on targetSdk 34?

The crash comes from the engine's USBMonitor.register() using an implicit intent with FLAG_MUTABLE. The fix is to never call register() and instead request the grant through UsbManager with an explicit intent (setPackage) inside a mutable PendingIntent, plus a receiver registered with an explicit export flag.

Does Android Camera2 support external USB UVC cameras?

Support is OEM-dependent and must be measured per device. Recent Pixel generations document native UVC support via LENS_FACING_EXTERNAL, but the probe must confirm enumeration, usable stream sizes, and that a live preview actually delivers frames before building on it.

Why does my UVC camera show a black screen in my Android app?

Check the libUVCCamera log tag: frame-allocation lines with a black surface indicate a rendering fault, while no lines indicate a stream fault in permission, open, or negotiation. Also verify the device is awake, since a dozing phone drops both preview and network ADB like a peripheral failure.

Can I test a USB microscope integration on an Android emulator?

No. Emulators provide no USB host, so this capability cannot be covered by emulator runs or gated in CI. Device-bound tests belong in the instrumented lane, while crop rounding and JPEG encoding can be unit-tested without hardware.

When should I use the libausbc wrapper instead of the libuvc layer?

Only in two recorded cases: when the runtime proof of the libuvc-layer decision is still outstanding, or when the codebase is already committed to libausbc. The fallback requires a vendored third_party repository with provenance, libuvc as an explicit compile dependency, and the two package lines must never be mixed.