Skip to contentSkip to conversation

usb-mtp: fix usb_mtp_get_device_info so that libmtp on the guest doesn't complain

PATCH In review Isaac Lozano 4 participants 4 messages Apr 17, 2016 – May 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb-mtp: fix usb_mtp_get_device_info so that libmtp on the guest doesn't complain

If an application uses libmtp on the guest system,
it will complain with the warning message:
LIBMTP WARNING: VendorExtensionID: ffffffff
LIBMTP WARNING: VendorExtensionDesc: (null)
LIBMTP WARNING: this typically means the device is PTP (i.e. a camera) but not a MTP device at all. Trying to continue anyway.

This is because libmtp expects a MTP Vendor Extension ID of 0x00000006 and a MTP Version of 0x0064. These numbers are taken from Microsoft's MTP Vendor Extension Identification Message page and are what most physical devices show.

---
 hw/usb/dev-mtp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/dev-mtp.c +2 -2
index bda84a6..1be85ae 100644
@@ -788,8 +788,8 @@ static MTPData *usb_mtp_get_device_info(MTPState *s, MTPControl *c)
     trace_usb_mtp_op_get_device_info(s->dev.addr);
 
     usb_mtp_add_u16(d, 100);
-    usb_mtp_add_u32(d, 0xffffffff);
-    usb_mtp_add_u16(d, 0x0101);
+    usb_mtp_add_u32(d, 0x00000006);
+    usb_mtp_add_u16(d, 0x0064);
     usb_mtp_add_wstr(d, L"");
     usb_mtp_add_u16(d, 0x0000);
 
Signature · 1 line
2.8.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Isaac Lozano

If an application uses libmtp on the guest system,
it will complain with the warning message:
LIBMTP WARNING: VendorExtensionID: ffffffff
LIBMTP WARNING: VendorExtensionDesc: (null)
LIBMTP WARNING: this typically means the device is PTP (i.e. a camera) but not a MTP device at all. Trying to continue anyway.

This is because libmtp expects a MTP Vendor Extension ID of 0x00000006 and a MTP Version of 0x0064. These numbers are taken from Microsoft's MTP Vendor Extension Identification Message page and are what most physical devices show.

Quoted 4 lines
---
 hw/usb/dev-mtp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Welcome to QEMU!

Link to MTP Vendor Extension Identification Message page for other reviewers:
https://msdn.microsoft.com/en-us/library/ff632482.aspx

#2 lore raw
Quoted 18 lines · Stefan Hajnoczi
Quoted 12 lines · Isaac Lozano

If an application uses libmtp on the guest system,
it will complain with the warning message:
LIBMTP WARNING: VendorExtensionID: ffffffff
LIBMTP WARNING: VendorExtensionDesc: (null)
LIBMTP WARNING: this typically means the device is PTP (i.e. a camera) but not a MTP device at all. Trying to continue anyway.

This is because libmtp expects a MTP Vendor Extension ID of 0x00000006 and a MTP Version of 0x0064. These numbers are taken from Microsoft's MTP Vendor Extension Identification Message page and are what most physical devices show.

Quoted 4 lines
---
 hw/usb/dev-mtp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines

Welcome to QEMU!

Link to MTP Vendor Extension Identification Message page for other reviewers:
https://msdn.microsoft.com/en-us/library/ff632482.aspx

I am confused why the MTP spec on usb.org specifies in 5.1.1.2 that this value should be 0xffffffff for MTP devices. Is it just not updated or there are similar MS specific differences to watch out for ? Either way, it seems libmtp will always be a good reference when we are stuck with such discrepencies.

Quoted 1 line
#3 lore raw
In reply to Isaac Lozano
Quoted 16 lines · Isaac Lozano

If an application uses libmtp on the guest system,
it will complain with the warning message:
LIBMTP WARNING: VendorExtensionID: ffffffff
LIBMTP WARNING: VendorExtensionDesc: (null)
LIBMTP WARNING: this typically means the device is PTP (i.e. a camera) but
not a MTP device at all. Trying to continue anyway.

This is because libmtp expects a MTP Vendor Extension ID of 0x00000006 and a
MTP Version of 0x0064. These numbers are taken from Microsoft's MTP Vendor
Extension Identification Message page and are what most physical devices
show.

Quoted 1 line

added to usb patch queue.

thanks,
Gerd