* [Qemu-devel] How to enable the writable function in usb-mtp
@ 2016-03-30 5:29 soccercheng Cheng
0 siblings, 0 replies; only message in thread
From: soccercheng Cheng @ 2016-03-30 5:29 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]
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;
}
[-- Attachment #2: Type: text/html, Size: 3908 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-30 5:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 5:29 [Qemu-devel] How to enable the writable function in usb-mtp soccercheng Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).