Hi All, I've found that in the current dev-mtp.c, if I set the storage access capability to 0x0000 (Access Capability, 0x0000 is for read-write ), it still wont' work, the guest Windows treats the exposed MTP as read-only.
Does any know how I can make MTP writable? The following is my change for your reference. BTW, I also find a bug when reporting available free space in byte to guest, the patches is also in the code segment below in RED. Regards Sting static MTPData *usb_mtp_get_storage_info(MTPState *s, MTPControl *c) { MTPData *d = usb_mtp_data_alloc(c); struct statvfs buf; int rc; trace_usb_mtp_op_get_storage_info(s->dev.addr); // if (FLAG_SET(s, MTP_FLAG_WRITABLE)) { if(1) { usb_mtp_add_u16(d, 0x0003); usb_mtp_add_u16(d, 0x0002); /* Filesystem Type: 0x0002 is Generic hierarchical */ usb_mtp_add_u16(d, 0x0000); /* Access Capability, 0x0000 is for read-write */ } else { usb_mtp_add_u16(d, 0x0001); usb_mtp_add_u16(d, 0x0002); usb_mtp_add_u16(d, 0x0001); } rc = statvfs(s->root, &buf); if (rc == 0) { usb_mtp_add_u64(d, (uint64_t)buf.f_frsize * buf.f_blocks); //usb_mtp_add_u64(d, (uint64_t)buf.f_bavail * buf.f_blocks); usb_mtp_add_u64(d, (uint64_t)buf.f_frsize * buf.f_bavail); usb_mtp_add_u32(d, buf.f_ffree); /* total # of free file nodes as free object count */ } else { usb_mtp_add_u64(d, 0xffffffff); usb_mtp_add_u64(d, 0xffffffff); usb_mtp_add_u32(d, 0xffffffff); } usb_mtp_add_str(d, s->desc); usb_mtp_add_wstr(d, L"123456789abcdef"); return d; }