Skip to contentSkip to conversation

usb-storage: ignore ZTE MF 823 in mode 0x1225

PATCH In review Oliver Neukum 4 participants 11 messages Jul 1, 2015 – Jul 6, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb-storage: ignore ZTE MF 823 in mode 0x1225

This device automatically switches itself to another mode (0x1405) unless the specific access pattern of Windows is followed in its initial mode. That makes a dirty unmount of the internal storage devices inevitable if they are mounted. So the devices should be ignored.

---
 drivers/usb/storage/unusual_devs.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/usb/storage/unusual_devs.h +11 -0
index caf1888..5674115 100644
@@ -2065,6 +2065,17 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_NO_READ_DISC_INFO ),
 
+/* Reported by Oliver Neukum <[email protected]>
+ * This device morphes spontaneously into another device if the access
+ * pattern of Windows isn't followed. Thus all media would be dirty
+ * if the initial instance is used.
+ * And yes, the concept that BCD goes up to 9 is not heeded */
+UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff,
+		"ZTE,Incorporated",
+		"ZTE WCDMA Technologies MSM",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_IGNORE_DEVICE ),
+
 /* Reported by Sven Geggus <[email protected]>
  * This encrypted pen drive returns bogus data for the initial READ(10).
  */
Signature · 1 line
2.1.4
#1 lore raw
Quoted 6 lines · Oliver Neukum

This device automatically switches itself to another mode (0x1405) unless the specific access pattern of Windows is followed in its initial mode. That makes a dirty unmount of the internal storage devices inevitable if they are mounted. So the devices should be ignored.

The storage device is a virtual cd-rom drive in the dongles internal flash rom, why do you care if non-writable storage is unmounted dirty?

Prohibiting the usb-storage driver to bind makes it impossible for usb_modeswitch to switch the device to one of its other id's..

#2 lore raw
Quoted 8 lines · Lars Melin
Quoted 7 lines · Oliver Neukum

This device automatically switches itself to another mode (0x1405) unless the specific access pattern of Windows is followed in its initial mode. That makes a dirty unmount of the internal storage devices inevitable if they are mounted. So the devices should be ignored.

Quoted 5 lines

The storage device is a virtual cd-rom drive in the dongles internal flash rom, why do you care if non-writable storage is unmounted dirty?

Prohibiting the usb-storage driver to bind makes it impossible for usb_modeswitch to switch the device to one of its other id's..

Lars --

In a separate thread, it was discussed that this device has a SD reader in it. Thus, it's possible to mount the SD card and get it dirty and then have it yanked-out from underneath us by this unprompted mode switch that the device does.

Signature · 2 lines
Matthew Dharm
Maintainer, USB Mass Storage driver for Linux
#3 lore raw
Quoted 15 lines · Matthew Dharm
Quoted 8 lines · Lars Melin
Quoted 7 lines · Oliver Neukum

This device automatically switches itself to another mode (0x1405) unless the specific access pattern of Windows is followed in its initial mode. That makes a dirty unmount of the internal storage devices inevitable if they are mounted. So the devices should be ignored.

Quoted 5 lines

The storage device is a virtual cd-rom drive in the dongles internal flash rom, why do you care if non-writable storage is unmounted dirty?

Prohibiting the usb-storage driver to bind makes it impossible for usb_modeswitch to switch the device to one of its other id's..

Quoted 7 lines

Lars --

In a separate thread, it was discussed that this device has a SD reader in it. Thus, it's possible to mount the SD card and get it dirty and then have it yanked-out from underneath us by this unprompted mode switch that the device does.

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom. There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

/Lars

#4 lore raw

On Wed, 2015-07-01 at 22:50 +0700, Lars Melin wrote:

Hi,

Quoted 3 lines

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom.

My dongle indeed has only one interface. But one must not jump to conclusions from that. Remember that multiple SCSI devices can be connected to a single storage interface.

Quoted 2 lines

There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

Here is a log made with an unfixed kernel:

Jul 02 11:11:02 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 6 using xhci_hcd
Jul 02 11:11:02 linux-dtbq.site kernel: usb 3-10: New USB device found, idVendor=19d2, idProduct=1225
Jul 02 11:11:02 linux-dtbq.site kernel: usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 02 11:11:02 linux-dtbq.site kernel: usb 3-10: Product: ZTE WCDMA Technologies MSM
Jul 02 11:11:02 linux-dtbq.site kernel: usb 3-10: Manufacturer: ZTE,Incorporated
Jul 02 11:11:02 linux-dtbq.site kernel: usb 3-10: SerialNumber: MF8230ZTED010000CP261718U46EM0SHF3BW707_8C65&&&&&&&&&&&&&&&&&&&0
Jul 02 11:11:02 linux-dtbq.site kernel: usb-storage 3-10:1.0: USB Mass Storage device detected
Jul 02 11:11:02 linux-dtbq.site kernel: scsi6 : usb-storage 3-10:1.0
Jul 02 11:11:02 linux-dtbq.site kernel: usbcore: registered new interface driver usb-storage
Jul 02 11:11:02 linux-dtbq.site kernel: usbcore: registered new interface driver uas
Jul 02 11:11:02 linux-dtbq.site mtp-probe[2234]: checking bus 3, device 6: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10"
Jul 02 11:11:02 linux-dtbq.site mtp-probe[2234]: bus: 3, device: 6 was not an MTP device
Jul 02 11:11:03 linux-dtbq.site kernel: scsi 6:0:0:0: CD-ROM            CWID     USB SCSI CD-ROM  2.31 PQ: 0 ANSI: 2
Jul 02 11:11:03 linux-dtbq.site kernel: sr2: scsi-1 drive
Jul 02 11:11:03 linux-dtbq.site kernel: sr 6:0:0:0: Attached scsi CD-ROM sr2
Jul 02 11:11:03 linux-dtbq.site kernel: sr 6:0:0:0: Attached scsi generic sg5 type 5
Jul 02 11:11:03 linux-dtbq.site kernel: scsi 6:0:0:1: Direct-Access     ZTE      MMC Storage      2.31 PQ: 0 ANSI: 2
Jul 02 11:11:03 linux-dtbq.site kernel: sd 6:0:0:1: Attached scsi generic sg6 type 0
Jul 02 11:11:03 linux-dtbq.site kernel: sd 6:0:0:1: [sdd] Attached SCSI removable disk

As you can see, it has a CD and a card reader on different LUNs.

Regards
Oliver

#5 lore raw
In reply to Lars Melin
Quoted 5 lines · Lars Melin

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom.
There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

Though I see your point. Is the switching desirable at all for this device or do I need to block the device on the SCSI level?

Regards
Oliver

#6 lore raw
Quoted 8 lines · Oliver Neukum
Quoted 5 lines · Lars Melin

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom.
There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

Quoted 5 lines

Though I see your point. Is the switching desirable at all for this device or do I need to block the device on the SCSI level?

Regards
Oliver

However, when I reinstall usb_modeswitch I see that the storage functionality is unnecessary to switch this device.

Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 8 using xhci_hcd
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device found, idVendor=19d2, idProduct=1225
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Product: ZTE WCDMA Technologies MSM
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Manufacturer: ZTE,Incorporated
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: SerialNumber: MF8230ZTED010000CP261718U46EM0SHF3BW707_8C65&&&&&&&&&&&&&&&&&&&0
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: USB Mass Storage device detected
Jul 02 14:56:10 linux-dtbq.site kernel: Vendor: 0x19d2, Product: 0x1225, Revision: 0xf0f1
Jul 02 14:56:10 linux-dtbq.site kernel: Interface Subclass: 0x06, Protocol: 0x50
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: device ignored
Jul 02 14:56:10 linux-dtbq.site kernel: storage_probe() failed
Jul 02 14:56:10 linux-dtbq.site kernel: -- sending exit command to thread
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: checking bus 3, device 8: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10"
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: bus: 3, device: 8 was not an MTP device
Jul 02 14:56:10 linux-dtbq.site usb_modeswitch[2740]: switch device 19d2:1225 on 003/008
Jul 02 14:56:15 linux-dtbq.site kernel: usb 3-10: USB disconnect, device number 8
Jul 02 14:56:16 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 9 using xhci_hcd

Regards
Oliver

#7 lore raw
Quoted 36 lines · Oliver Neukum
Quoted 8 lines · Oliver Neukum
Quoted 5 lines · Lars Melin

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom.
There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

Quoted 5 lines

Though I see your point. Is the switching desirable at all for this device or do I need to block the device on the SCSI level?

Regards
Oliver

However, when I reinstall usb_modeswitch I see that the storage functionality is unnecessary to switch this device.

Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 8 using xhci_hcd
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device found, idVendor=19d2, idProduct=1225
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Product: ZTE WCDMA Technologies MSM
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Manufacturer: ZTE,Incorporated
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: SerialNumber: MF8230ZTED010000CP261718U46EM0SHF3BW707_8C65&&&&&&&&&&&&&&&&&&&0
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: USB Mass Storage device detected
Jul 02 14:56:10 linux-dtbq.site kernel: Vendor: 0x19d2, Product: 0x1225, Revision: 0xf0f1
Jul 02 14:56:10 linux-dtbq.site kernel: Interface Subclass: 0x06, Protocol: 0x50
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: device ignored
Jul 02 14:56:10 linux-dtbq.site kernel: storage_probe() failed
Jul 02 14:56:10 linux-dtbq.site kernel: -- sending exit command to thread
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: checking bus 3, device 8: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10"
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: bus: 3, device: 8 was not an MTP device
Jul 02 14:56:10 linux-dtbq.site usb_modeswitch[2740]: switch device 19d2:1225 on 003/008
Jul 02 14:56:15 linux-dtbq.site kernel: usb 3-10: USB disconnect, device number 8
Jul 02 14:56:16 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 9 using xhci_hcd
Quoted 3 lines

Regards
Oliver

Yes but there are other 19d2:1225 devices which don't have dual-mode (19d2:1403 RNDIS or 19d2:1405 ECM) they do only have one of the modes and they don't auto-flip so they need usb_modeswitch.

This is the first 3G dongle I have seen with multiple LUN on the same USB interface, there has always been one interface for each storage function in the past. So yes I jumped to conclusion..

Anyway, it would be good if you could block the MMC interface on LUN level while still having the virtual cd-rom working.

cheers
/Lars

#8 lore raw
Quoted 37 lines · Lars Melin
Quoted 36 lines · Oliver Neukum
Quoted 8 lines · Oliver Neukum
Quoted 5 lines · Lars Melin

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom.
There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

Quoted 5 lines

Though I see your point. Is the switching desirable at all for this device or do I need to block the device on the SCSI level?

Regards
Oliver

However, when I reinstall usb_modeswitch I see that the storage functionality is unnecessary to switch this device.

Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 8 using xhci_hcd
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device found, idVendor=19d2, idProduct=1225
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Product: ZTE WCDMA Technologies MSM
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Manufacturer: ZTE,Incorporated
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: SerialNumber: MF8230ZTED010000CP261718U46EM0SHF3BW707_8C65&&&&&&&&&&&&&&&&&&&0
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: USB Mass Storage device detected
Jul 02 14:56:10 linux-dtbq.site kernel: Vendor: 0x19d2, Product: 0x1225, Revision: 0xf0f1
Jul 02 14:56:10 linux-dtbq.site kernel: Interface Subclass: 0x06, Protocol: 0x50
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: device ignored
Jul 02 14:56:10 linux-dtbq.site kernel: storage_probe() failed
Jul 02 14:56:10 linux-dtbq.site kernel: -- sending exit command to thread
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: checking bus 3, device 8: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10"
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: bus: 3, device: 8 was not an MTP device
Jul 02 14:56:10 linux-dtbq.site usb_modeswitch[2740]: switch device 19d2:1225 on 003/008
Jul 02 14:56:15 linux-dtbq.site kernel: usb 3-10: USB disconnect, device number 8
Jul 02 14:56:16 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 9 using xhci_hcd
Quoted 5 lines
Quoted 3 lines

Regards
Oliver

Yes but there are other 19d2:1225 devices which don't have dual-mode

So they reused the ID. Oh just great.

Quoted 2 lines

(19d2:1403 RNDIS or 19d2:1405 ECM) they do only have one of the modes and they don't auto-flip so they need usb_modeswitch.

Understood. And I just found out that the auto flip is unreliable without storage. But do they need storage interfaces to switch to the other modes? As the virtual CD does not go away I don't really see much value in retaining the original (storage only) mode, as all it offers is an opportunity to lose data.

Quoted 6 lines

This is the first 3G dongle I have seen with multiple LUN on the same USB interface, there has always been one interface for each storage function in the past. So yes I jumped to conclusion..

Anyway, it would be good if you could block the MMC interface on LUN level while still having the virtual cd-rom working.

This device is total crap. Do you know about alternative commands that allow selecting the mode the device switches to?

Regards
Oliver

#9 lore raw
Quoted 38 lines · Oliver Neukum
Quoted 37 lines · Lars Melin
Quoted 36 lines · Oliver Neukum
Quoted 8 lines · Oliver Neukum
Quoted 5 lines · Lars Melin

Then I would like to see an lsusb listing for 19d2:1225 with an SD-card interface, I have only seen 19d2:1225 with a single storage interface which is for the windows install cd-rom.
There are almost no 3G dongles having the SD-card interface active in default (non-switched) mode.

Quoted 5 lines

Though I see your point. Is the switching desirable at all for this device or do I need to block the device on the SCSI level?

Regards
Oliver

However, when I reinstall usb_modeswitch I see that the storage functionality is unnecessary to switch this device.

Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 8 using xhci_hcd
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device found, idVendor=19d2, idProduct=1225
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Product: ZTE WCDMA Technologies MSM
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: Manufacturer: ZTE,Incorporated
Jul 02 14:56:10 linux-dtbq.site kernel: usb 3-10: SerialNumber: MF8230ZTED010000CP261718U46EM0SHF3BW707_8C65&&&&&&&&&&&&&&&&&&&0
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: USB Mass Storage device detected
Jul 02 14:56:10 linux-dtbq.site kernel: Vendor: 0x19d2, Product: 0x1225, Revision: 0xf0f1
Jul 02 14:56:10 linux-dtbq.site kernel: Interface Subclass: 0x06, Protocol: 0x50
Jul 02 14:56:10 linux-dtbq.site kernel: usb-storage 3-10:1.0: device ignored
Jul 02 14:56:10 linux-dtbq.site kernel: storage_probe() failed
Jul 02 14:56:10 linux-dtbq.site kernel: -- sending exit command to thread
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: checking bus 3, device 8: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10"
Jul 02 14:56:10 linux-dtbq.site mtp-probe[2730]: bus: 3, device: 8 was not an MTP device
Jul 02 14:56:10 linux-dtbq.site usb_modeswitch[2740]: switch device 19d2:1225 on 003/008
Jul 02 14:56:15 linux-dtbq.site kernel: usb 3-10: USB disconnect, device number 8
Jul 02 14:56:16 linux-dtbq.site kernel: usb 3-10: new high-speed USB device number 9 using xhci_hcd
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Regards
Oliver

Yes but there are other 19d2:1225 devices which don't have dual-mode

So they reused the ID. Oh just great.

Welcome to the world of USB WWAN dongles. This happens *all* the time... The worst offenders I know of are Huawei and ZTE, probably because they make so many. For example 12d1:1001 is used by like 50 devices before modeswitch (I jest, but not by much).

Dan

Quoted 26 lines
Quoted 2 lines

(19d2:1403 RNDIS or 19d2:1405 ECM) they do only have one of the modes and they don't auto-flip so they need usb_modeswitch.

Understood. And I just found out that the auto flip is unreliable without storage. But do they need storage interfaces to switch to the other modes? As the virtual CD does not go away I don't really see much value in retaining the original (storage only) mode, as all it offers is an opportunity to lose data.

Quoted 6 lines

This is the first 3G dongle I have seen with multiple LUN on the same USB interface, there has always been one interface for each storage function in the past. So yes I jumped to conclusion..

Anyway, it would be good if you could block the MMC interface on LUN level while still having the virtual cd-rom working.

This device is total crap. Do you know about alternative commands that allow selecting the mode the device switches to?

Regards
Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to Lars Melin
Quoted 7 lines · Lars Melin

Yes but there are other 19d2:1225 devices which don't have dual-mode (19d2:1403 RNDIS or 19d2:1405 ECM) they do only have one of the modes and they don't auto-flip so they need usb_modeswitch.

This is the first 3G dongle I have seen with multiple LUN on the same USB interface, there has always been one interface for each storage function in the past. So yes I jumped to conclusion.

Hi,

as you've never seen a device with multiple LUNs, restricting the ID to a single LUN should do the job, shouldn't it? I just sent a patch doing so to the list. Could you review?

Regards
Oliver