Automatic Activation, Hotplug and UDEV, Configuration
Narasimha
Posts: 4
Joined: 25 Apr 2017, 18:29

Need help in supporting DWM 157 D1 donle.

Post by Narasimha » 26 Apr 2017, 06:16

Hi All,
I have DWM 157 D1 dongle. I have the PID,VID (PID : 7600, VID : 2001) for this dongle. But to convert it to modem. I need MessageContent for this. Could some one please help in finding the messagecontent for this dongle.


Thanks,
Narasimha

LOM
Posts: 1343
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Need help in supporting DWM 157 D1 donle.

Post by LOM » 26 Apr 2017, 07:40

No, you don't need a control message in order to convert it to modem, you only need to select the 2nd configuration for that.
Upgrade to latest usb_modeswitch, it has 2001:7600 support.

Narasimha
Posts: 4
Joined: 25 Apr 2017, 18:29

Re: Need help in supporting DWM 157 D1 donle.

Post by Narasimha » 26 Apr 2017, 07:45

Thanks for the info. I am new to this topic. I am able to see configuration=2 in that file. Can you please explain about configuration=2 ?


Thanks,
Narasimha

Narasimha
Posts: 4
Joined: 25 Apr 2017, 18:29

Re: Need help in supporting DWM 157 D1 donle.

Post by Narasimha » 26 Apr 2017, 08:25

After changing the configuration=2 we are seeing /de/sr0 is gettng created. Can you please share which driver needs to be enabled to use it as modem.

LOM
Posts: 1343
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Need help in supporting DWM 157 D1 donle.

Post by LOM » 26 Apr 2017, 11:05

You have these interfaces:

Cfg#1
MI_00 USB Mass Storage Device (virtual cd-rom)

Cfg#2
MI_00 Spreadtrum Extension Port
MI_01 Spreadtrum HSPA Modem
MI_02 Spreadtrum Control Port (AT-cmd)
MI_03 USB Mass Storage Device (tf/sd card ?)
MI_04 Spreadtrum Service Port

There is not yet direct support for 2001:7600 in linux serial modem driver but you can load the driver and make it work:

sudo modprobe option
echo "2001 7600" >/sys/bus/usb-serial/drivers/option1/new_id

which will create 4 ttyUSB devices where ttyUSB1 is the ppp dial-up port.

chedxb
Posts: 21
Joined: 14 Apr 2019, 14:51

Re: Need help in supporting DWM 157 D1 donle.

Post by chedxb » 14 Apr 2019, 14:56

hello,

I am trying to make a D-Link DWM-157 D1 unit work on pfSense 2.4.4 (FreeBSD:11:amd64) and I have the same problem, pfSense sees it as CD-ROM despite it is shown as a "Known Working 3G-4G Modem" (https://docs.netgate.com/pfsense/en/lat ... odems.html)

I followed the steps https://redmine.pfsense.org/issues/6226 and http://www.draisberghof.de/usb_modeswit ... f=4&t=2687 however it is insisting to be a CD-ROM instead of a modem.

Question: is it possible to use configuration=2 option instead of MessageContent in pfSense? I use usb_modeswitch-2.5.2

Best,

Savas

LOM
Posts: 1343
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Need help in supporting DWM 157 D1 donle.

Post by LOM » 14 Apr 2019, 17:21

chedxb wrote:
Question: is it possible to use configuration=2 option instead of MessageContent in pfSense? I use usb_modeswitch-2.5.2

Best,

Savas
It is a must to select configuration 2, this modem is not switched with a switch message.

chedxb
Posts: 21
Joined: 14 Apr 2019, 14:51

Re: Need help in supporting DWM 157 D1 donle.

Post by chedxb » 15 Apr 2019, 07:01

Thanks for the feedback,

I did the following.

1st I created /usr/local/sbin/lte.cfg file as follows;

###################################################
#DWM 157 D1
#Contributed by: http://www.draisberghof.de/usb_modeswit ... f=4&t=2687

DefaultVendor= 0x2001
DefaultProduct= 0x7d0e

Configuration=2
########################################################

Then I created /usr/local/etc/rc.d/lte.sh script as follows;

###################################################
#!/bin/sh
/usr/local/sbin/usb_modeswitch -c /usr/local/sbin/lte.cfg
sleep 5
###################################################

However, it is still showing as CD-ROM.

Any thoughts?

Best,

Savas

LOM
Posts: 1343
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Need help in supporting DWM 157 D1 donle.

Post by LOM » 15 Apr 2019, 07:36

If the USB Id of your dongle is 2001:7d0e then it has already switched to modem mode.
2001:7d0e is not a default Id, it is an Id after switching.

chedxb
Posts: 21
Joined: 14 Apr 2019, 14:51

Re: Need help in supporting DWM 157 D1 donle.

Post by chedxb » 15 Apr 2019, 09:16

Thanks, this is what I see

ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0200
bDeviceClass = 0x00ef <Miscellaneous device>
bDeviceSubClass = 0x0002
bDeviceProtocol = 0x0001
bMaxPacketSize0 = 0x0040
idVendor = 0x2001
idProduct = 0x7d0e
bcdDevice = 0x0300
iManufacturer = 0x0009 <D-Link,Inc >
iProduct = 0x000a <D-Link DWM-157>
iSerialNumber = 0x0000 <no string>
bNumConfigurations = 0x0001

but it is still CD-ROM, not modem mode.


Best,

Savas

chedxb
Posts: 21
Joined: 14 Apr 2019, 14:51

Re: Need help in supporting DWM 157 D1 donle.

Post by chedxb » 15 Apr 2019, 09:26

I unplugged/plugged the USB stick, this is what I see now

ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4, cfg=1 md=HOST spd=HIGH (480Mbps) pwr=ON (98mA)

bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0200
bDeviceClass = 0x0000 <Probed by interface class>
bDeviceSubClass = 0x0000
bDeviceProtocol = 0x0000
bMaxPacketSize0 = 0x0040
idVendor = 0x2001
idProduct = 0xa407
bcdDevice = 0x0300
iManufacturer = 0x0002 <D-Link,Inc >
iProduct = 0x0003 <D-Link DWM-157>
iSerialNumber = 0x0004 <531399703502680>
bNumConfigurations = 0x0003

chedxb
Posts: 21
Joined: 14 Apr 2019, 14:51

Re: Need help in supporting DWM 157 D1 donle.

Post by chedxb » 15 Apr 2019, 10:05

and when I enter the camcontrol eject cd0 command, it changes to

ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0200
bDeviceClass = 0x00ef <Miscellaneous device>
bDeviceSubClass = 0x0002
bDeviceProtocol = 0x0001
bMaxPacketSize0 = 0x0040
idVendor = 0x2001
idProduct = 0x7d0e
bcdDevice = 0x0300
iManufacturer = 0x0009 <D-Link,Inc >
iProduct = 0x000a <D-Link DWM-157>
iSerialNumber = 0x0000 <no string>
bNumConfigurations = 0x0001

but it turns cd0 to da0

Apr 15 12:01:00 kernel da0: Attempt to query device size failed: ILLEGAL REQUEST, Invalid field in CDB
Apr 15 12:01:00 kernel da0: 40.000MB/s transfers
Apr 15 12:01:00 kernel da0: <HSPA USB SCSI CD-ROM 6225> Removable Direct Access SCSI device
Apr 15 12:01:00 kernel da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
Apr 15 12:01:00 kernel umass0: <Mass Storage > on usbus4
Apr 15 12:01:00 kernel umass0 on uhub0
Apr 15 12:01:00 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4
Apr 15 12:00:59 kernel umass0: detached
Apr 15 12:00:59 kernel (cd0:umass-sim0:0:0:0): Periph destroyed

LOM
Posts: 1343
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Need help in supporting DWM 157 D1 donle.

Post by LOM » 15 Apr 2019, 11:52

chedxb wrote:
but it turns cd0 to da0

Apr 15 12:01:00 kernel da0: Attempt to query device size failed: ILLEGAL REQUEST, Invalid field in CDB
Apr 15 12:01:00 kernel da0: 40.000MB/s transfers
Apr 15 12:01:00 kernel da0: <HSPA USB SCSI CD-ROM 6225> Removable Direct Access SCSI device
Apr 15 12:01:00 kernel da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
Apr 15 12:01:00 kernel umass0: <Mass Storage > on usbus4
Apr 15 12:01:00 kernel umass0 on uhub0
Apr 15 12:01:00 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4
Apr 15 12:00:59 kernel umass0: detached
Apr 15 12:00:59 kernel (cd0:umass-sim0:0:0:0): Periph destroyed
Yes the mass storage device is no longer a cd-rom but tf/sd card device, there is a card reader inside the dongle usually just beside the sim card reader.

The USB Id's you have listed are for a DWM-157C1 so I guess that is the version you have and not the D1.
C1 is switched by a switchmessage which ejects the cd-rom, it does not have 2 configs to select between.

2001:7d0e has the following interface layout:

MI_00 D-Link Mobile Broadband Device (Network Adapter) (cdc_mbim)
MI_02 D-Link HSPA+DataCard Diagnostics Interface (also ppp dialup modem)
MI_03 D-Link HSPA+DataCard NMEA Device
MI_04 D-Link HSPA+DataCard Speech Port
MI_05 D-Link HSPA+DataCard Debug Port
MI_06 USB Mass Storage Device

Remains now to load the right pfsense/bsd driver but that is something you should look elsewhere for, I have not the slightest knowledge of bsd.

chedxb
Posts: 21
Joined: 14 Apr 2019, 14:51

Re: Need help in supporting DWM 157 D1 donle.

Post by chedxb » 15 Apr 2019, 15:14

Thanks,

btw, I found below config settings in the USB stick

# intallation config file

DefaultVendor= 0x2001
DefaultProduct= 0xa407

TargetVendor= 0x2001
TargetProduct= 0x7d0e

MagicId=2ds2dse5w885d5d5we5d2d2d5sd4dgg4fdfd5

AutoRun=1


I tried to use the MagicId as MessageContent, however it didn't work.

Is there a way to convert the MagicId to MessageContent?

Best,

Savas

LOM
Posts: 1343
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Need help in supporting DWM 157 D1 donle.

Post by LOM » 15 Apr 2019, 16:08

chedxb wrote:
Is there a way to convert the MagicId to MessageContent?
Not that I know of.
You created the lte.cfg file before, add StandardEject=1 to it and usb_modeswitch will send an eject message to the dongle. Also correct the faulty DefaultProduct from 0x7d0e to 0xa407 in the file if you not have done that already. Then you can call usb_modeswitch as before.

An alternative cmdline is:

usb_modeswitch -v 2001 -p a407 -K -W

-K is for StandardEject
-W is for usb_modeswitch verbose output

Post Reply