Author Message

<  Setup Discussion  ~  False operation on some Mediatek devices

PostPosted: Mon Sep 03, 2012 10:01 am Reply with quote
Posts: 3 Joined: Mon Sep 03, 2012 9:49 am
Good day.

Such problem:
Philips Xenium X331 plugged as USB storage detected as

Quote:
$ lsusb
Bus 001 Device 026: ID 0e8d:0002 MediaTek Inc.


And what we see?

Quote:
# fgrep 0e8d /lib/udev/rules.d/40-usb_modeswitch.rules
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="0002", RUN+="usb_modeswitch '%b/%k'"


We plug phone as masstorage, usb_modeswitch run and switch phone. So no usb storage device seen. Sad.

Workaround: disable usb_modeswitch.

But I think need more flexible mask in rules. Some criteria to keep difference between 0e8d:0002 usb storage on MTK-based phones and MTK-based dongles.


Offline
PostPosted: Mon Sep 03, 2012 11:01 am Reply with quote
Site Admin Posts: 6496 Joined: Sat Nov 03, 2007 12:30 am
That's exactly what the USB attribute matching feature of usb_modeswitch is for.

With mode switching disabled in /etc/usb_modeswitch.conf, plug your phone in and run
"lsusb -v -d 0e8d:0002".

Post the result here and we may find some attribute that we can use to "filter" out phones.



Offline
PostPosted: Mon Sep 03, 2012 12:34 pm Reply with quote
Posts: 3 Joined: Mon Sep 03, 2012 9:49 am
Josh wrote:
With mode switching disabled in /etc/usb_modeswitch.conf, plug your phone in and run
"lsusb -v -d 0e8d:0002".

Post the result here and we may find some attribute that we can use to "filter" out phones.


Code:
# lsusb -v -d 0e8d:0002

Bus 001 Device 028: ID 0e8d:0002 MediaTek Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0e8d MediaTek Inc.
  idProduct          0x0002
  bcdDevice            1.00
  iManufacturer           2 MediaTek Inc
  iProduct                3 X331
  iSerial                 4 68536410008837f
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              1 6236--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)



http://pastebin.calculate-linux.ru/en/show/4216


Offline
PostPosted: Mon Sep 03, 2012 5:37 pm Reply with quote
Site Admin Posts: 6496 Joined: Sat Nov 03, 2007 12:30 am
Thanks.

It looks like we can use the "iProduct" attribute. Your phone says "X331", the modems show something like "MT6235".

If you copy the file "0e8d:0002" to the folder "/etc/usb_modeswitch.d" (you should find it in
"/usr/share/usb_modeswitch") and rename it to "0e8d:0002:uPr=MT", you will have no more problems even if usb_modeswitch is activated again.

Your phone will be ignored from now on.



Offline
PostPosted: Tue Sep 04, 2012 8:40 am Reply with quote
Posts: 3 Joined: Mon Sep 03, 2012 9:49 am
Josh wrote:
If you copy the file "0e8d:0002" to the folder "/etc/usb_modeswitch.d" (you should find it in
"/usr/share/usb_modeswitch") and rename it to "0e8d:0002:uPr=MT", you will have no more problems even if usb_modeswitch is activated again.


ok. but move, not copy.

Great! Thank you for fast and clear answers. Do you plan make this changes permanent in usb_modeswith? I think many people use Philips MTK-based phones.


Offline
PostPosted: Tue Sep 04, 2012 9:04 am Reply with quote
Site Admin Posts: 6496 Joined: Sat Nov 03, 2007 12:30 am
coyote wrote:
ok. but move, not copy.

Yes, you are right.

coyote wrote:
Do you plan make this changes permanent in usb_modeswith? I think many people use Philips MTK-based phones.

Absolutely. I will include this change in the next data package release.


Offline
PostPosted: Thu Feb 06, 2014 5:01 pm Reply with quote
Posts: 1 Joined: Wed Feb 05, 2014 10:56 pm Location: Prague, Czech Republic
My MT6250 based phone Aiek M3 is still covered by the rule, and the rule as it is invalidates mass storage support.

I found two work-arounds:

1) Disable the rule

2) Add Configuration=0x01 to /usr/share/usb_modeswitch/0e8d:0002:uPr=MT

Both result in working mass storage. I am not sure, whether this tiny phone supports modem at all, but I seems that no.

lsusb output:

Code:
Bus 001 Device 004: ID 0e8d:0002 MediaTek Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0e8d MediaTek Inc.
  idProduct          0x0002
  bcdDevice            1.00
  iManufacturer           2 MediaTek Inc
  iProduct                3 MT6250
  iSerial                 4 53290802318158f
  bNumConfigurations      6
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              1 6250--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     2
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              400mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              1 6250--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     3
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              300mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              1 6250--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     4
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              1 6250--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     5
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               98mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              1 6250--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     6
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              1 6250--Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)


System messages with this rule disabled:
Code:
2014-02-06T15:52:28.030150+01:00 oct kernel: [49761.541016] usb 1-1.4: new full-speed USB device number 4 using ehci-pci
2014-02-06T15:52:28.121147+01:00 oct kernel: [49761.631889] usb 1-1.4: New USB device found, idVendor=0e8d, idProduct=0002
2014-02-06T15:52:28.121160+01:00 oct kernel: [49761.631896] usb 1-1.4: New USB device strings: Mfr=2, Product=3, SerialNumber=4
2014-02-06T15:52:28.121162+01:00 oct kernel: [49761.631900] usb 1-1.4: Product: MT6250
2014-02-06T15:52:28.121163+01:00 oct kernel: [49761.631903] usb 1-1.4: Manufacturer: MediaTek Inc
2014-02-06T15:52:28.121165+01:00 oct kernel: [49761.631906] usb 1-1.4: SerialNumber: 53290802318158f
2014-02-06T15:52:28.121170+01:00 oct kernel: [49761.632893] usb-storage 1-1.4:1.0: USB Mass Storage device detected
2014-02-06T15:52:28.123092+01:00 oct kernel: [49761.634235] scsi35 : usb-storage 1-1.4:1.0
2014-02-06T15:52:28.399635+01:00 oct logger: usb_modeswitch: switching disabled, no action for 0e8d:0002
2014-02-06T15:52:29.125108+01:00 oct kernel: [49762.636216] scsi 35:0:0:0: Direct-Access     MEDIATEK  FLASH DISK      6250 PQ: 0 ANSI: 0 CCS
2014-02-06T15:52:29.125128+01:00 oct kernel: [49762.636684] sd 35:0:0:0: Attached scsi generic sg5 type 0
2014-02-06T15:52:29.126153+01:00 oct kernel: [49762.637559] sd 35:0:0:0: [sdd] 3854336 512-byte logical blocks: (1.97 GB/1.83 GiB)
2014-02-06T15:52:29.127070+01:00 oct kernel: [49762.638353] sd 35:0:0:0: [sdd] Write Protect is off
2014-02-06T15:52:29.127083+01:00 oct kernel: [49762.638361] sd 35:0:0:0: [sdd] Mode Sense: 03 00 00 00
2014-02-06T15:52:29.129113+01:00 oct kernel: [49762.640496] sd 35:0:0:0: [sdd] No Caching mode page found
2014-02-06T15:52:29.129123+01:00 oct kernel: [49762.640502] sd 35:0:0:0: [sdd] Assuming drive cache: write through
2014-02-06T15:52:29.133146+01:00 oct kernel: [49762.644046] sd 35:0:0:0: [sdd] No Caching mode page found
2014-02-06T15:52:29.133158+01:00 oct kernel: [49762.644052] sd 35:0:0:0: [sdd] Assuming drive cache: write through
2014-02-06T15:52:29.141124+01:00 oct kernel: [49762.651920]  sdd: sdd1
2014-02-06T15:52:29.145185+01:00 oct kernel: [49762.656423] sd 35:0:0:0: [sdd] No Caching mode page found
2014-02-06T15:52:29.145197+01:00 oct kernel: [49762.656428] sd 35:0:0:0: [sdd] Assuming drive cache: write through
2014-02-06T15:52:29.145200+01:00 oct kernel: [49762.656433] sd 35:0:0:0: [sdd] Attached SCSI removable disk


System messages with this rule enabled:
Code:
2014-02-06T15:56:50.303240+01:00 oct kernel: [50023.199364] usb 1-1.4: new full-speed USB device number 5 using ehci-pci
2014-02-06T15:56:50.394305+01:00 oct kernel: [50023.290188] usb 1-1.4: New USB device found, idVendor=0e8d, idProduct=0002
2014-02-06T15:56:50.394325+01:00 oct kernel: [50023.290195] usb 1-1.4: New USB device strings: Mfr=2, Product=3, SerialNumber=4
2014-02-06T15:56:50.394328+01:00 oct kernel: [50023.290199] usb 1-1.4: Product: MT6250
2014-02-06T15:56:50.394330+01:00 oct kernel: [50023.290202] usb 1-1.4: Manufacturer: MediaTek Inc
2014-02-06T15:56:50.394332+01:00 oct kernel: [50023.290206] usb 1-1.4: SerialNumber: 53290802318158f
2014-02-06T15:56:50.395178+01:00 oct kernel: [50023.291217] usb-storage 1-1.4:1.0: USB Mass Storage device detected
2014-02-06T15:56:50.395197+01:00 oct kernel: [50023.291364] scsi36 : usb-storage 1-1.4:1.0
2014-02-06T15:56:51.039622+01:00 oct usb_modeswitch: switching device 0e8d:0002 on 001/005


Offline
PostPosted: Sat Feb 08, 2014 3:35 pm Reply with quote
Site Admin Posts: 6496 Joined: Sat Nov 03, 2007 12:30 am
Hmm, the problem is that if people want to actually use the modem feature, they have to switch the mode ... (Or do you know about a different way to change the USB mode? Sometimes there is a phone setting for that.)

Setting the "Configuration" parameter to 1 will effectively disable the whole config file, so I can't do it in the official distribution.

The problem here is that usb_modeswitch has no way of knowing which mode the user desires. In these cases I suggest changing the "DisableSwitching" parameter in "/etc/usb_modeswitch.conf". That's what it's there for anyway.


Offline
PostPosted: Sat Feb 08, 2014 3:41 pm Reply with quote
Site Admin Posts: 6496 Joined: Sat Nov 03, 2007 12:30 am
BTW, what is the lsusb output after the mode switch (if it's not disabled)? Any changes?


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
9 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum