Activation Codes and Methods, Hardware Details, Sniffing
Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by Josh » 02 Jun 2015, 08:26

MindBender wrote:And a USB serial port ending up as ttyUSB0 or ttyUSB4...
Hmm, you lost me there ...

Are you connecting more than one USB device with serial-type ports? Otherwise the port count should be identical every time.

MindBender
Posts: 10
Joined: 23 May 2015, 12:10

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by MindBender » 02 Jun 2015, 08:50

Josh wrote:Hmm, you lost me there ...

Are you connecting more than one USB device with serial-type ports? Otherwise the port count should be identical every time.
Yeah, that was a bit confusing indeed. What I meant to say was 'And a USB serial port converter ending up as ttyUSB0 or ttyUSB4...'.
So yes, besides the modem, I'm using another USB serial device. That's why the symlink feature is so hany to me.

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

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by Josh » 02 Jun 2015, 14:17

OK, I got it.

I have provided a fixed script file which is supposed to perform better with regard to the symbolic link business. You can try it as a drop-in replacement in the source package you have downloaded.

Here is the post:

http://www.draisberghof.de/usb_modeswit ... 919#p14919

MindBender
Posts: 10
Joined: 23 May 2015, 12:10

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by MindBender » 13 Jun 2015, 16:16

Josh wrote:By the way, you can scrap the "init2" line alltogether from your configuration. These are old setup commands for analogue fax modems. Entirely obsolete now. I would recommend to use just one init line like this:

Init1=ATE1 +CFUN=1,0
I have now changed it into this:

Code: Select all

[Dialer truphone]
Modem = /dev/ttyUSB1
Baud = 21000000
Init1 = ATE1 +CFUN=1,0
Init2 = AT+CGDCONT=1,"IP","truphone.com"
Phone = *99***1#
Stupid Mode = 1
Username = ''
Password = ''
I'm still not sure about omitting ATZ; It seems like a logical thing to start with, but it works fine without.

I have just moved everything from a Pi2 to a Pi B+ and now I've got the strangest thing going on: The modem just isn't switched at startup. I'm sure it's a udev thing, but even kicking udev doesn't help:

Code: Select all

$ sudo udevadm trigger
$ sudo udevadm control --reload-rules
The only thing that helps is unplugging and replugging the modem after the Pi has booted. Hardly usable. Any tips please?

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

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by Josh » 14 Jun 2015, 00:12

Quirks like this with Raspberry were reported before. There seems to be a problem with the USB host driver, depending on the choice of kernel module. I'm not familiar with this system though.

MindBender
Posts: 10
Joined: 23 May 2015, 12:10

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by MindBender » 14 Jun 2015, 16:17

Josh wrote:Quirks like this with Raspberry were reported before. There seems to be a problem with the USB host driver, depending on the choice of kernel module. I'm not familiar with this system though.
Probably. Weird though that it works perfectly on a Pi 2, but that it fails with the exact same SD-card with the exact same contents on a Pi B+.

Anyway, adding this to my startup script fixed the problem:

Code: Select all

sudo usb_modeswitch -K -v 2001 -p a707
Unfortunately this doesn't work:

Code: Select all

sudo ./usb-modeswitch.tcl -K -v 2001 -p a707 --symlink-name /dev/gsmmodem
I'm probably using it wrong...

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

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by Josh » 14 Jun 2015, 18:48

MindBender wrote:Weird though that it works perfectly on a Pi 2, but that it fails with the exact same SD-card with the exact same contents on a Pi B+.
Applying logic here would point to a hardware issue with the B+.
MindBender wrote:Unfortunately this doesn't work:

Code: Select all

sudo ./usb-modeswitch.tcl -K -v 2001 -p a707 --symlink-name /dev/gsmmodem
Note that this feature is intended to be run from the "udev" system program once for every new ttyUSB interface, with a parameter giving a USB interface path in the "sys" filesystem. It doesn't directly create a link, it just returns a name if called with the right interface. Else it returns an empty string and no symlink is created.

All this should be working automatically with the corrected script I posted before, plus the respective line in /lib/udev/rules.d/40-usb_modeswitch.rules ...

Can you enable usb_modeswitch's logging in /etc/usb_modeswitch.conf and see if you get some output in /var/log after plugging the modem?

MindBender
Posts: 10
Joined: 23 May 2015, 12:10

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by MindBender » 15 Jun 2015, 23:16

Josh wrote:Note that this feature is intended to be run from the "udev" system program once for every new ttyUSB interface, with a parameter giving a USB interface path in the "sys" filesystem. It doesn't directly create a link, it just returns a name if called with the right interface. Else it returns an empty string and no symlink is created.
Yeah, I figured that; It's usually udev that creates the symlink. I tried it because I hoped the script would also be able to do that.
Josh wrote:All this should be working automatically with the corrected script I posted before, plus the respective line in /lib/udev/rules.d/40-usb_modeswitch.rules ...
I will try that soon, because it's working again...
Josh wrote:Can you enable usb_modeswitch's logging in /etc/usb_modeswitch.conf and see if you get some output in /var/log after plugging the modem?
Today I replace the Kernel that came with the image, with a freshly built image, like I have done with the Pi2. And like the Pi2, the B+ now has udev calling usb_modeswitch properly.

I have overlooked that difference when I stated that the Pi2 worked and the B+ didn't. There's probably a difference in Kernel version and/or defconfig, but the version I wanted to work works, so I think I'll keep it at that. Unless you are terribly curious on what's making the difference....

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

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by Josh » 15 Jun 2015, 23:43

O.K., so the differences in the kernel may explain your trouble. No pressing need to dig deeper then.

ubernoob
Posts: 2
Joined: 04 Feb 2016, 23:50

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by ubernoob » 05 Feb 2016, 00:09

Hi

Not sure if you can help me, but I have been trying to get the device to work for months now, but I don't understand how to dial up. Same device, DWM-157 B1 FW 2.0.1EU. What am I doing wrong?

AFAIK the modeswitch is working as it should?

Code: Select all

udooer@udoo:~$ lsusb
...
Bus 001 Device 005: ID 2001:7d02 D-Link Corp.
...
I have tried with different settings, but how do you figure out what is the correct one?

Code: Select all

udooer@udoo:~$ cat /etc/wvdial.conf

[Dialer telenor]
Auto DNS = 1
Init1 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init2 = AT+CGDCONT=1,"IP","internet"
Phone = *99#
New PPPD = yes
Modem = /dev/ttyUSB1
Username = 'telenor'
Password = 'telenor'
Baud = 9600

[Dialer t2]
Init1 = ATE1 +CFUN=1,0
Init2 = AT+CGDCONT=1,"IP","internet"
Stupid Mode = 1
Phone = *99#
Modem = /dev/ttyUSB1
Username = ''
Password = ''
Baud = 21000000

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
;Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Password = ''
New PPPD = yes
Username = ''
Modem = /dev/ttyUSB0
Baud = 21000000

Trying to dial up with default:

Code: Select all

udooer@udoo:~$ sudo wvdial
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 21000000
--> Carrier detected.  Waiting for prompt.
~[7f]}#@!}!}!} }2}"}&} }*} } }#}$@#}'}"}(}"U[03]~
--> PPP negotiation detected.
--> Starting pppd at Thu Feb  4 22:01:11 2016
--> Pid of pppd: 1847
--> pppd: (▒u[01](▒u[01]▒u[01]
--> Disconnecting at Thu Feb  4 22:01:16 2016
--> The PPP daemon has died: No ppp module error (exit code = 4)
--> man pppd explains pppd error codes in more detail.
--> I guess that's it for now, exiting
--> The PPP daemon has died. (exit code = 4)
Then with telenor:

Code: Select all

udooer@udoo:~$ sudo wvdial telenor
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","internet"
AT+CGDCONT=1,"IP","internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
NO CARRIER
--> No Carrier!  Trying again.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
NO CARRIER
--> No Carrier!  Trying again.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
NO CARRIER
--> No Carrier!  Trying again.
then with t2:

Code: Select all

udooer@udoo:~$ sudo wvdial t2
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATE1 +CFUN=1,0
ATE1 +CFUN=1,0
OK
--> Sending: AT+CGDCONT=1,"IP","internet"
AT+CGDCONT=1,"IP","internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
NO CARRIER
--> No Carrier!  Trying again.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
NO CARRIER
--> No Carrier!  Trying again.

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

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by Josh » 05 Feb 2016, 20:19

I think it is safe to assume that your main problem is here:

Code: Select all

...
--> The PPP daemon has died: No ppp module error (exit code = 4)
--> man pppd explains pppd error codes in more detail.
...
Did you check if you have a PPP kernel module?

ubernoob
Posts: 2
Joined: 04 Feb 2016, 23:50

Re: D-Link DWM-157 B1 (2001:a707) FW 2.0.1EU

Post by ubernoob » 07 Feb 2016, 21:51

Thanks! That was the issue. I moved the modem to a Raspberry pi and got it to work.

I don't understand why or how it works or if I have optimal settings?
Josh, feel free to verify it if you want.

For anyone else coming across this article and have Telenor (Norway) this might get you started:

Code: Select all

$ sudo apt-get install wvdial usb-modeswitch
$ lsusb
   Bus 001 Device 004: ID 2001:a707 D-Link Corp.
$ sudo usb_modeswitch -K -v 2001 -p a707
$ lsusb
   Bus 001 Device 005: ID 2001:7d02 D-Link Corp.
$ sudo vi /etc/wvdial.conf

[Dialer test3]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
;Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Password = ''
New PPPD = yes
Username = ''
Modem = /dev/ttyUSB0
Baud = 21000000

$ sudo wvdial test3
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 21000000
--> Carrier detected.  Waiting for prompt.
~[7f]}#@!}!}!} }2}"}&} }*} } }#}$@#}'}"}(}"U[03]~
--> PPP negotiation detected.
--> Starting pppd at Sun Feb  7 20:36:53 2016
--> Pid of pppd: 1096
--> Using interface ppp0
--> local  IP address 46.156.73.40
--> remote IP address 10.64.64.64
--> primary   DNS address 193.213.112.4
--> secondary DNS address 130.67.15.198

Post Reply