Host drivers¶
Reusable host-side class drivers - each a Driver subclass
opened with Driver.open(vid, pid, transport=...) - plus filesystem helpers used by
the mass-storage host.
HID driver¶
hid
¶
HID (class 0x03) - generic host driver. Auto-binds to HID devices by class code.
Discovers the HID interface, its interrupt IN/OUT endpoints, and the Report descriptor length from the configuration descriptor, then exposes the full HID 1.11 request set: report-descriptor fetch, interrupt IN/OUT reports, GET/SET_REPORT over EP0, and GET/SET_IDLE + GET/SET_PROTOCOL.
HIDDriver
¶
Bases: Driver
report_descriptor
¶
report_map
¶
Parse the device's Report descriptor into {(report_type, report_id): HIDReport}. Fetched and cached on first use.
Source code in usbip/classes/host/hid.py
input_report_size
¶
Inferred wire size (bytes) of an Input report - its payload plus the leading report-ID byte when the device uses numbered reports. None if the report descriptor doesn't declare it.
Source code in usbip/classes/host/hid.py
read_report
¶
reports
¶
output_report
¶
get_report
¶
Source code in usbip/classes/host/hid.py
set_report
¶
get_idle
¶
set_idle
¶
get_protocol
¶
HIDReport
dataclass
¶
HIDField
dataclass
¶
HIDField(report_type, report_id, usage_page, usages, usage_min, usage_max, report_size, report_count, flags, logical_min, logical_max)
One Input/Output/Feature field group declared by a Report descriptor.
CDC-ACM driver¶
cdc_acm
¶
Mass-storage driver¶
msc
¶
Mass Storage - host driver: Bulk-Only Transport (CBW/CSW) over two bulk EPs.
Bulk endpoint addresses are discovered from the configuration descriptor (real devices don't all use 0x01/0x81), so this works against any MSC device.
MTP host¶
mtp
¶
MTP / PTP - host driver: the bulk container protocol (command -> data -> response) over two bulk endpoints, plus convenience operations.
Small but complete enough to drive the device-side classes/device/mtp.py in
tests and to script real MTP devices: open a session, enumerate objects, download
/upload files, read object properties. Endpoint addresses are discovered from the
configuration descriptor. Mirrors what libmtp does on the wire.
MtpHost
¶
Bases: Driver
Source code in usbip/classes/host/mtp.py
transaction
¶
Run command [-> data] -> response. Returns (resp_code, resp_params, data_in).
Source code in usbip/classes/host/mtp.py
open_session
¶
close_session
¶
device_info
¶
storage_ids
¶
storage_info
¶
num_objects
¶
object_handles
¶
object_info
¶
get_object
¶
get_partial_object
¶
send_object_info
¶
Source code in usbip/classes/host/mtp.py
send_object
¶
create_file
¶
make_dir
¶
delete_object
¶
set_object_prop_value
¶
rename
¶
move_object
¶
copy_object
¶
get_partial_object_64
¶
begin_edit
¶
end_edit
¶
truncate_object
¶
send_partial_object
¶
object_prop_value
¶
device_prop_value
¶
Bluetooth driver¶
bluetooth
¶
Bluetooth (class 0xE0) - generic host driver for the USBIP BT dongle.
Discovers the HCI/ACL endpoints from the configuration descriptor and exposes
the USB Bluetooth transport: send HCI commands on EP0, read HCI events from the
interrupt IN, and exchange ACL over the bulk pair. This is what the loopback and
cross-language tests drive; a real Bluetooth host stack (BlueZ via the kernel
btusb driver) talks to the dongle the same way over the wire.
Filesystem helpers (extras)¶
Utilities the mass-storage / MTP hosts build on: a block-device view, a FAT filesystem reader, and an ISO-9660 reader.
Block device¶
blockdev
¶
Byte-addressable read view over a block device (e.g. an MSC host driver).
The filesystem readers (fatfs, isofs) work in byte offsets; this adapts that to
the LBA/block reads exposed by MSCDriver. view(base) returns a sub-view shifted
by a byte offset (used for an MBR partition start).
FAT filesystem¶
fatfs
¶
Read-only FAT12/16/32 reader over a BlockDevice (MBR-aware, VFAT LFN-aware).
Parses the boot sector / BPB, follows cluster chains through the FAT, and reads directory entries including long file names. Lookups are case-insensitive. On an MBR-partitioned disk it locates the first FAT partition automatically.
FatFs
¶
Source code in usbip/classes/host/extras/fatfs.py
ISO-9660 filesystem¶
isofs
¶
Read-only ISO 9660 reader over a BlockDevice (2048-byte logical sectors).
Parses the Primary Volume Descriptor (sector 16), then walks directory records.
Strips the ;1 version suffix and matches names case-insensitively. Joliet
(the supplementary UCS-2 descriptor) is not parsed - primary names only.