The C Source, Patches and (shudder!) Bugs
Post Reply
Vampik
Posts: 5
Joined: 11 May 2013, 01:06

[patch] Quanta 1K3 support

Post by Vampik » 11 May 2013, 01:18

Hello! I've made a patch to support new LTE modem Quanta 1K3.

Configuration file:
usb_modeswitch.d/0408:ea25 wrote:

Code: Select all

# Quanta 1K3

TargetVendor=   0x0408
TargetProduct=  0xea26

QuantaMode=1
Patch for usb_modeswitch:
quanta-1k3.patch
(4.38 KiB) Downloaded 953 times

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: [patch] Quanta 1K3 support

Post by Josh » 11 May 2013, 08:04

Wow, thank you!

I suppose you have tried the switching method for the known Quanta device before (see config for 0408:f000) ?

Vampik
Posts: 5
Joined: 11 May 2013, 01:06

Re: [patch] Quanta 1K3 support

Post by Vampik » 11 May 2013, 09:06

Josh wrote: I suppose you have tried the switching method for the known Quanta device before (see config for 0408:f000) ?
Yes, it was the first thing I tried. It didn't work, I had to use USB sniffer.

Just FYI:
Before switching wrote:

Code: Select all

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0408 ProdID=ea25 Rev= 0.00
S:  Manufacturer=Qualcomm, Incorporated
S:  Product=Qualcomm CDMA Technologies MSM
S:  SerialNumber=<IMEI was here>
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
After switching wrote:

Code: Select all

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0408 ProdID=ea26 Rev= 0.00
S:  Manufacturer=Qualcomm, Incorporated
S:  Product=Qualcomm CDMA Technologies MSM
S:  SerialNumber=<IMEI was here>
C:* #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
ATI wrote:

Code: Select all

Manufacturer: QUANTA COMPUTER INCORPORATED

Model: 0

Revision: 20121214_1K3QCI_4036_M0.06 1 [Dec 05 2012 06:00:00]

IMEI: <IMEI was here>

+GCAP: +CGSM

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: [patch] Quanta 1K3 support

Post by Josh » 11 May 2013, 13:26

Vampik wrote:
Josh wrote: I suppose you have tried the switching method for the known Quanta device before (see config for 0408:f000) ?
Yes, it was the first thing I tried. It didn't work, I had to use USB sniffer.
Fine, so the new "special procedure" is needed. I will apply the patch, probably adding a little error handling for the "ret" value.

Thank you again!

If you want you can give me your name (or any nickname of your choice) via PM or mail, and I'll include you as code contributor in the source.

Vampik
Posts: 5
Joined: 11 May 2013, 01:06

Re: [patch] Quanta 1K3 support

Post by Vampik » 11 May 2013, 15:31

Josh wrote:I will apply the patch, probably adding a little error handling for the "ret" value.
The first version of the patch had error checking. I had to remove it later, because for some reason usb_control_msg() returns LIBUSB_ERROR_TIMEOUT for this specific request.

The modem is connected to the router with the modified custom firmware (http://code.google.com/p/wl500g/ - custom kernel with tons of patches + libusb-1.0.8 + usb_modeswitch-1.2.5 patched for libusb1). I can't test the modem with a regular Linux PC (the modem is not mine, I'm just maintaining the modded firmware), so I thought it's better to remove the return code check.

The device doesn't disappear after request, it actually sends the reply, then switches after a couple of seconds. I don't know why usb_control_msg() returns LIBUSB_ERROR_TIMEOUT. May be libusb doesn't like the request to read 0 bytes from device? In Windows, the status is STATUS_SUCCESS.

Code: Select all

[90 ms]  >>>  URB 5 going down  >>> 
-- URB_FUNCTION_VENDOR_DEVICE:
  TransferFlags          = 00000001 (USBD_TRANSFER_DIRECTION_IN, ~USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000000
  TransferBuffer       = 00000000
  TransferBufferMDL    = 00000000
  UrbLink                 = 00000000
  RequestTypeReservedBits = 00000000
  Request                 = 000000ff
  Value                   = 00000000
  Index                   = 00000000
[95 ms] UsbSnoop - MyInternalIOCTLCompletion(a8c7f126) : fido=00000000, Irp=88b80a90, Context=89441008, IRQL=2
[95 ms]  <<<  URB 5 coming back  <<< 
-- URB_FUNCTION_CONTROL_TRANSFER:
  PipeHandle           = 88b8a480
  TransferFlags        = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
  TransferBufferLength = 00000000
  TransferBuffer       = 00000000
  TransferBufferMDL    = 00000000

    no data supplied
  UrbLink              = 00000000
  SetupPacket          =
    00000000: c0 ff 00 00 00 00 00 00

[3482 ms] UsbSnoop - FilterDispatchPnp(a8c8345c) : IRP_MJ_PNP (IRP_MN_SURPRISE_REMOVAL)
[3482 ms] UsbSnoop - FdoHookDispatchPnp(a8c8345c) : IRP_MJ_PNP (IRP_MN_SURPRISE_REMOVAL)
[3504 ms] UsbSnoop - FilterDispatchPnp(a8c8345c) : IRP_MJ_PNP (IRP_MN_REMOVE_DEVICE)

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: [patch] Quanta 1K3 support

Post by Josh » 12 May 2013, 18:54

O.K., good to know - I'll just report errors then, without interrupting the process.

Thanks again!

Vampik
Posts: 5
Joined: 11 May 2013, 01:06

Re: [patch] Quanta 1K3 support

Post by Vampik » 13 Jun 2013, 23:04

I see the Quanta support added in usb-modeswitch 1.2.6, but there is no config file in the latest usb-modeswitch-data.

Post Reply