GetUsbDeviceInfoTool

Reports detailed descriptor info for one connected USB device, looked up by device_name in UsbManager.getDeviceList. Enumerates interfaces and their endpoints.

No permissions required (descriptor metadata only; actual data transfer would need user-granted device permission). Returns an error if USB host mode is unsupported or the device is absent. Read-only.

serial_number needs device-specific permission on API 29+ (UsbManager.hasPermission); when missing, UsbDevice.getSerialNumber() throws SecurityException rather than returning null — caught here so serial_number is simply null instead of failing the whole call. Check has_permission to distinguish "denied" from "device has no serial."

Output keys: name, vendor_id, product_id, device_class, device_subclass, device_protocol, manufacturer, product, serial_number, version, interface_count, interfaces (each with id, class, subclass, protocol, endpoint_count, endpoints), has_permission.

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
open override val annotations: ToolAnnotations
Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val parameters: List<ToolParameter>

Functions

Link copied to clipboard
open suspend override fun execute(params: Map<String, Any>): ToolResult