Activation Codes and Methods, Hardware Details, Sniffing
Post Reply
varkey
Posts: 4
Joined: Wed Aug 01, 2018 2:40 pm

Add support for JioFi JMR1040 / 815

Post by varkey » Wed Aug 01, 2018 3:22 pm

I am an OpenWRT / LEDE user and was trying to use the JioFi JMR1040 device, but it failed to switch to the required mode on LEDE. However when I tried it on another CentOS x86 machine, it switched automatically although there wasn't any specific rules defined.

Anyway this automatic switch didn't happen with the usbmode tool in LEDE and I had to add the specific rule to the usb-mode.json file.

Source vendor id and product id is 1c9e:f030 and target is 1c9e:f134, and message "55534243123456780000000000000606f50402527000000000000000000000"

The below is after the mode switch on the LEDE router

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1c9e ProdID=f101 Rev= 2.32
S:  Manufacturer=JMR1040
S:  Product=JMR1040
S:  SerialNumber=1234567890
C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA
A:  FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=82(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=84(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Code: Select all

root@LEDE:~# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 16, If 0, Class=Vendor Specific Class, Driver=, 480M
        |__ Port 1: Dev 16, If 1, Class=Communications, Driver=cdc_ether, 480M
        |__ Port 1: Dev 16, If 2, Class=CDC Data, Driver=cdc_ether, 480M

Code: Select all

[ 1109.426419] usb 1-1.1: new high-speed USB device number 5 using ehci-platform
[ 1109.572894] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[ 1109.586980] scsi host2: usb-storage 1-1.1:1.0
[ 1110.595195] scsi 2:0:0:0: CD-ROM            LTE      Hotspot          2.31 PQ: 0 ANSI: 2
[ 1611.979187] usb 1-1.1: USB disconnect, device number 5
[ 1614.259480] usb 1-1.1: new high-speed USB device number 6 using ehci-platform
[ 1614.409514] cdc_ether 1-1.1:1.1 usb0: register 'cdc_ether' at usb-ehci-platform-1.1, CDC Ethernet Device, 82:fe:08:f3:9c:50
The below is from the CentOS machine which auto switched without any specific rules

Code: Select all

[66695.190405] usb 1-5.1: new high-speed USB device number 5 using xhci_hcd
[66695.280785] usb 1-5.1: New USB device found, idVendor=1c9e, idProduct=f030
[66695.280811] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[66695.280829] usb 1-5.1: Product: JMR1040
[66695.280845] usb 1-5.1: Manufacturer: JMR1040
[66695.280859] usb 1-5.1: SerialNumber: 1234567890
[66695.314398] usb-storage 1-5.1:1.0: USB Mass Storage device detected
[66695.316823] scsi host4: usb-storage 1-5.1:1.0
[66696.327066] scsi 4:0:0:0: CD-ROM            LTE      Hotspot          2.31 PQ: 0 ANSI: 2
[66696.331366] scsi 4:0:0:0: Attached scsi generic sg4 type 5
[66696.388122] sr 4:0:0:0: [sr0] scsi3-mmc drive: 0x/0x caddy
[66696.388141] cdrom: Uniform CD-ROM driver Revision: 3.20
[66696.390278] sr 4:0:0:0: Attached scsi CD-ROM sr0
[66697.061806] usb 1-5.1: USB disconnect, device number 5
[66699.190470] usb 1-5.1: new high-speed USB device number 6 using xhci_hcd
[66699.281046] usb 1-5.1: New USB device found, idVendor=1c9e, idProduct=f134
[66699.281073] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[66699.281090] usb 1-5.1: Product: JMR1040
[66699.281108] usb 1-5.1: Manufacturer: JMR1040
[66699.281122] usb 1-5.1: SerialNumber: 1234567890
[66699.508602] usbcore: registered new interface driver cdc_ether
[66699.546260] rndis_host 1-5.1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-5.1, RNDIS device, b2:57:d9:82:4b:df
[66699.551468] usbcore: registered new interface driver rndis_host
Also, although the device works on both the LEDE router and CentOS x86 machine, I wonder why the MAC address is different ie "82:fe:08:f3:9c:50" on the LEDE device and "b2:57:d9:82:4b:df" on the CentOS machine? Perhaps its just auto generated I guess.

LOM
Posts: 1286
Joined: Wed Jul 11, 2012 3:14 pm
Location: Koh Samui, TH

Re: Add support for JioFi JMR1040 / 815

Post by LOM » Thu Aug 02, 2018 2:43 am

The device is auto switching under Windows, it detects Windows initial probing and morph into a new device depending on the probing being old MS Windows or new MS Windows.

There is a difference in usb id after switching in your two examples and there is a difference in interface composition (cdc_ether vs rndis_host).
Are you running Centos under Windows + VMWare?

varkey
Posts: 4
Joined: Wed Aug 01, 2018 2:40 pm

Re: Add support for JioFi JMR1040 / 815

Post by varkey » Thu Aug 02, 2018 4:58 am

Interesting. No, this is not on Windows / Vmware, the CentOS PC is a standalone physical box.

Also, the device works on Mac OSX as well without any special drivers, just plug and play. I don't have a windows machine to test.

Would you be able to add the rules to the usb-modeswitch-data project so that future OpenWRT users would be able to get it to work easily? If you need any other additional details, let me know and I can provide it.

varkey
Posts: 4
Joined: Wed Aug 01, 2018 2:40 pm

Re: Add support for JioFi JMR1040 / 815

Post by varkey » Thu Aug 02, 2018 5:33 am

So did bit of testing and it looks like even if I give the target product id to f101 or f134, switching happens on the OpenWRT device.

And in both cases it switches as below

Code: Select all

root@LEDE:/etc# lsusb
Bus 001 Device 007: ID 1c9e:f101 OMEGA TECHNOLOGY
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
However on the CentOs machine its

Code: Select all

[root@varkey-minipc ~]# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 1c9e:f134 OMEGA TECHNOLOGY
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 003: ID 13d3:3314 IMC Networks
Bus 001 Device 002: ID 0bc2:ab44 Seagate RSS LLC
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
For completeness this is the block I added to the usb-mode.json file in OpenWRT

Code: Select all

"1c9e:f030": {
        "*": {
                "t_vendor": 7326,
                "t_product": [ 61697 ],
                "msg": [ 40 ]
        }
}

LOM
Posts: 1286
Joined: Wed Jul 11, 2012 3:14 pm
Location: Koh Samui, TH

Re: Add support for JioFi JMR1040 / 815

Post by LOM » Thu Aug 02, 2018 6:38 am

varkey wrote:Interesting. No, this is not on Windows / Vmware, the CentOS PC is a standalone physical box.

Also, the device works on Mac OSX as well without any special drivers, just plug and play. I don't have a windows machine to test.

Would you be able to add the rules to the usb-modeswitch-data project so that future OpenWRT users would be able to get it to work easily? If you need any other additional details, let me know and I can provide it.
Windows native ethernet protocol is rndis, Linux can talk both eth or rndis but eth is preferred
since the linux rndis driver is a hack of the undocumented Windows protocol.
Mac OSX does only talk eth afaik.

So it seems Centos is probing the device in such a way that the device believes it is being probed by a Windows OS.
I have no idea what probing pattern the device get triggered by and this happens long before usb_modeswitch gets a chance to send the switch message, there is not much we can do if some linux distro makes the device think that it is Windows probed and should switch to 1c9e:f134

We should add the device for usb_modeswitch switching from 1c9e:f030 to 1c9e:f101 with the usual Longcheer switch message, same as you used.

I would appreciate if you could provide a lsusb -vd listing for 1c9e:f030 ie before you switch it in LEDE.

Josh
Site Admin
Posts: 6534
Joined: Sat Nov 03, 2007 12:30 am

Re: Add support for JioFi JMR1040 / 815

Post by Josh » Thu Aug 02, 2018 7:06 am

LOM wrote:We should add the device for usb_modeswitch switching from 1c9e:f030 to 1c9e:f101 with the usual Longcheer switch message
Noted.

varkey
Posts: 4
Joined: Wed Aug 01, 2018 2:40 pm

Re: Add support for JioFi JMR1040 / 815

Post by varkey » Thu Aug 02, 2018 7:12 am

Thanks LOM, that makes sense! :)
LOM wrote:
I would appreciate if you could provide a lsusb -vd listing for 1c9e:f030 ie before you switch it in LEDE.
Before switching

Code: Select all

root@LEDE:~# lsusb -v -d 1c9e:f030

Bus 001 Device 010: ID 1c9e:f030 OMEGA TECHNOLOGY
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x1c9e OMEGA TECHNOLOGY
  idProduct          0xf030
  bcdDevice            2.32
  iManufacturer           1 JMR1040
  iProduct                2 JMR1040
  iSerial                 3 1234567890
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    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              4 Mass 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               1
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)

After switching

Code: Select all

root@LEDE:~# lsusb -v -d 1c9e:f101

Bus 001 Device 009: ID 1c9e:f101 OMEGA TECHNOLOGY
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x1c9e OMEGA TECHNOLOGY
  idProduct          0xf101
  bcdDevice            2.32
  iManufacturer           1 JMR1040
  iProduct                2 JMR1040
  iSerial                 3 1234567890
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          137
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  05 24 01 00 00
      ** UNRECOGNIZED:  04 24 02 02
      ** UNRECOGNIZED:  05 24 06 00 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x000a  1x 10 bytes
        bInterval               9
      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
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         1
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       6 Ethernet Networking
      bFunctionProtocol       0
      iFunction               9 CDC ECM
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      6 Ethernet Networking
      bInterfaceProtocol      0
      iInterface              6 CDC Ethernet Control Model (ECM)
      CDC Header:
        bcdCDC               1.10
      CDC Union:
        bMasterInterface        1
        bSlaveInterface         2
      CDC Ethernet:
        iMacAddress                      7 82fe08f39c50
        bmEthernetStatistics    0x00000000
        wMaxSegmentSize               1514
        wNumberMCFilters            0x0000
        bNumberPowerFilters              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               9
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              8 CDC Ethernet Data
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 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     0x02  EP 2 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)

Post Reply