From: soccercheng Cheng <sting.cheng@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] How to enable the writable function in usb-mtp
Date: Wed, 30 Mar 2016 13:29:51 +0800 [thread overview]
Message-ID: <CANt_kEuEUOtt5SVhNeMSTEzd11xXZdOA+RyVaQ33==0he-myFw@mail.gmail.com> (raw)
[-- 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 --]
reply other threads:[~2016-03-30 5:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANt_kEuEUOtt5SVhNeMSTEzd11xXZdOA+RyVaQ33==0he-myFw@mail.gmail.com' \
--to=sting.cheng@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).