Skip to content

Commit 184f088

Browse files
andelfMarcel Kraft
andauthored
feat: include USB serial number in probe listing (#100)
Migrated from rusb to nusb API while preserving the original functionality proposed in PR #91 for multi-probe identification. Co-authored-by: Marcel Kraft <marcel@luke-roberts.com>
1 parent 143c7f7 commit 184f088

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/usb_device.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,17 @@ pub mod libusb {
6565

6666
for device in devices {
6767
if device.vendor_id() == vid && device.product_id() == pid {
68+
let serial = device
69+
.serial_number()
70+
.map(|s| s.to_string())
71+
.unwrap_or_else(|| "N/A".to_string());
72+
6873
result.push(format!(
69-
"<WCH-Link#{} nusb device> ID {:04x}:{:04x}({})",
74+
"<WCH-Link#{} nusb device> ID {:04x}:{:04x} Serial {} ({})",
7075
idx,
7176
device.vendor_id(),
7277
device.product_id(),
78+
serial,
7379
get_speed(device.speed())
7480
));
7581
idx += 1;

0 commit comments

Comments
 (0)