public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: linux-usb@vger.kernel.org
Subject: MT7601U with on-board storage reports incorrect capacity
Date: Thu, 9 Jan 2025 16:02:58 +0200	[thread overview]
Message-ID: <060301fe-17e2-4061-bb01-f5660b5d10a3@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

Hi,

I have this wifi device with on-board storage for the Windows driver:

New USB device found, idVendor=148f, idProduct=2878, bcdDevice= 0.01

After switching to wifi mode, we can see it's a MT7601U:

New USB device found, idVendor=148f, idProduct=7601, bcdDevice= 0.00

The problem with this one is that it can't be mounted, nothing happens
for a long time. I'm testing with kernel 6.12.8-arch1-1 but it's been
like this for at least two years. 

The problem seems to be that reading from the "end" of the device
takes 17 seconds. I assume the reason for that is the fake capacity:

SCSI Payload (Read Capacity(10) Response Data)
    [LUN: 0x0000]
    [Command Set:CD-ROM (0x05) ]
    [MMC Opcode: Read Capacity(10) (0x25)]
    [Request in: 212]
    [Response in: 217]
    LBA: 65280 
    Block size in bytes: 2048
    Read capacity: 133693440 bytes (127.50 MiB)

The real capacity is probably just 8 MiB. The driver files stored in
it are ~7 MiB total.

This takes 17 seconds and returns 4096 bytes filled with 0xff:

SCSI CDB Read(10)
    [LUN: 0x0000]
    [Command Set:CD-ROM (0x05) ]
    [Response in: 565]
    Opcode: Read(10) (0x28)
    Flags: 0x00
    Logical Block Address (LBA): 0x0000fefc (65276)
    ...0 0000 = Group: 0x00
    Transfer Length: 2
    Control: 0x00

Windows never tries to read that far. (The device works in Windows.)

How can this be fixed?

usb_modeswitch can switch it to wifi mode, so it's not a huge problem.
I'm just curious.

[-- Attachment #2: mt7601u-linux.pcapng --]
[-- Type: application/x-pcapng, Size: 67624 bytes --]

[-- Attachment #3: mt7601u-windows.pcapng --]
[-- Type: application/x-pcapng, Size: 155392 bytes --]

             reply	other threads:[~2025-01-09 14:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 14:02 Bitterblue Smith [this message]
2025-01-09 15:34 ` MT7601U with on-board storage reports incorrect capacity Alan Stern
2025-01-09 18:57   ` Bitterblue Smith
2025-01-09 19:38     ` Alan Stern
2025-01-09 22:44       ` Bitterblue Smith

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=060301fe-17e2-4061-bb01-f5660b5d10a3@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=linux-usb@vger.kernel.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