Re: Modem D-Link DWM-221
Hi Luiz,
It is really a wow!!!
Amazing fortigate config you have done.
I will try it with a Fortigate.
Raspberry pi and Fortigate are the devices i need.
I solved one and you offered me a bonus.
Thanks everyone again.
I wil do more investigate for LOM's input.
I think it probably can be simpler.
It is really a wow!!!
Amazing fortigate config you have done.
I will try it with a Fortigate.
Raspberry pi and Fortigate are the devices i need.
I solved one and you offered me a bonus.
Thanks everyone again.
I wil do more investigate for LOM's input.
I think it probably can be simpler.
-
- Posts: 8
- Joined: 19 Jan 2015, 18:27
- Location: Brazil
Re: Modem D-Link DWM-221
Hi Chyiwen
I'm very glad my information was useful for you, if you need some help about this just ask!
I'm also staying here to provide more tests for you guys to make the dongle work at its best.
Best regards,
Luiz
I'm very glad my information was useful for you, if you need some help about this just ask!
I'm also staying here to provide more tests for you guys to make the dongle work at its best.
Best regards,
Luiz
Re: Modem D-Link DWM-221
Hi LOM ,LOM wrote:chyiwen wrote: - switch modeCode: Select all
sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000
The switch sequence above doesn't make sense to me from logical point of view and I wonder what it is that makes the dongle switch now.
The cmds are:
1. Allow media change (unlock media in case it was locked)
2. Start unit
3. Stop unit (also known as eject since stopping a cd-rom automagically makes it eject the caddy)
My questions here are:
Is the allow media change cmd really needed? If it should be included then it should logically come after the Start Unit cmd.
Where does the 01 flag (before length byte 06) in all the msgs come from? This is for selecting the LUN on players with
multi-LUN and should not be needed here. Substitute with 00 and check if it makes any diference!
Here is ther further research as per your input.
##1.-- OK -- The final msg is the combo working with raspberry below:
sudo usb_modeswitch -v 2001 -p a401 -W -n -K
sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435d000000000000000001061b000000020000000000000000000000
So the msg translation from you would be :
1. Allow media change (unlock media in case it was locked)
2. Stop unit (also known as eject since stopping a cd-rom automagically makes it eject the caddy)
##2-- NG
I tried msg
555342435b000000000000000000061e000000000000000000000000000000
555342435d000000000000000000061b000000020000000000000000000000
it does not work. So without LUN info, the mode switch does not work.
##3-- NG
This also not work -
sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435c000000000000000001061b000000010000000000000000000000 -2 555342435d000000000000000001061b000000020000000000000000000000
1. Start unit
2. Stop unit (also known as eject since stopping a cd-rom automagically makes it eject the caddy)
Hope this help.
Re: Modem D-Link DWM-221
Thanks for further testing but I can not draw any conclusions from the result.chyiwen wrote:
Hi LOM ,
Here is ther further research as per your input.
You do need extra cmds which the other 2 users didn't need and I strongly suspect that the reason
for that is Raspberry Pi, I mentioned before that it behaves unreliable.
The linux kernel maintainer for the usb subsystem had the following to say about Raspberry Pi a few days ago:
Can you please re-test on known good hardware, on your CentOS6.5 system or on the Fortigate.Greg Kroah-Hartman wrote:
The RPI's USB controller is horrid, it's amazing it works at all...
Re: Modem D-Link DWM-221
LOM wrote:
Can you please re-test on known good hardware, on your CentOS6.5 system or on the Fortigate.
HI LOM ,
FortiGate is working fine with 2 line.
Cent OS is also working.
-
- Posts: 1
- Joined: 08 Jul 2015, 19:23
- Location: Lecce, Italy
Re: Modem D-Link DWM-221
Hi all,
I'm unable to get this working in Arch Linux.
After installing usb_modeswitch (&& rebooted), lsusb shows the same productId for the D-Link.
The following command change the productId, but still the modem is not shown under NetworkManager/ModemManager. Any idea?
usb_modeswitch version is 2.2.3
Thank you!
EDIT: by executing a binary blog 'modemtoatmode' found in the sr0, I got 4 /dev/ttyUSB* devices. Still MM cannot connect, but maybe it's a step forward.
I'm unable to get this working in Arch Linux.
After installing usb_modeswitch (&& rebooted), lsusb shows the same productId for the D-Link.
The following command change the productId, but still the modem is not shown under NetworkManager/ModemManager. Any idea?
Code: Select all
sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000
Thank you!
EDIT: by executing a binary blog 'modemtoatmode' found in the sr0, I got 4 /dev/ttyUSB* devices. Still MM cannot connect, but maybe it's a step forward.
-
- Posts: 2
- Joined: 27 Jul 2015, 08:37
Re: Modem D-Link DWM-221
I've also trying to get it working on a Fortigate. But look like i'm missing something becaese it is not working for me.chyiwen wrote:
HI LOM ,
FortiGate is working fine with 2 line.
Cent OS is also working.
I added the 4 lines to modem_list.conf file. It's detected but not responding to AT commanda (read time out).
Can you please provide your configuration?
Regards,
Jean
Re: Modem D-Link DWM-221
It took me two weeks to find this forum and make the D-Link DWM-221 work on Lubuntu 14.10. Is there an easy way, so Lubuntu recognizes the DWM-221 without using the LX Terminal every time I want to connect to the 4G network?kubik007 wrote:Hi all,
good news is, that the DWM-221 rev B. I made working on my Arch Linux and Ubuntu, actally it was up 30 minutes after I bought it. Pay attention to USB power, friends told me some 3g sticks take lot of power, my seemd to be dead on notebook, unless I plug it to the port on the rear side of my noteook. Probably port, with stronger USB power.
Bad new is, that I didn't managed to switch it on Open-WRT.
Linux
How did I made it work on Arch and Ubuntu?
- attached USB may appear as cdrom device, check it is not mounted, umount- switch modeCode: Select all
mount umount /dev/...
- you have to see id 2001:7e19 to get next step workingCode: Select all
sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000
- now I only have to load the generic driver by:Code: Select all
lsusb | grep 7e19
- in my case, 3G came up in my NetworkManager applet, dmesg showes 4 USB devices related to DWM-221Code: Select all
sudo modprobe usbserial vendor=0x2001 product=0x7e19
Code: Select all
dmesg [ 1779.372545] usbcore: registered new interface driver usbserial [ 1779.372567] usbcore: registered new interface driver usbserial_generic [ 1779.372584] usbserial: USB Serial support registered for generic [ 1779.372605] usbserial_generic 2-3:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes. ... [ 1779.372733] usb 2-3: generic converter now attached to ttyUSB0 .... [ 1779.373134] usb 2-3: generic converter now attached to ttyUSB4
OpenWrt
their 3g hardware page says 'wip'=work in progress, OpenWrt uses lates usb-modeswitch / usbmode , where the messge is in json format, so I have to build json with above mentioned message:
555342435b000000000000000001061e000000000000000000000000000000 555342435c000000000000000001061b000000010000000000000000000000
555342435d000000000000000001061b000000020000000000000000000000
Finally this post makes me crazy: http://lists.freedesktop.org/archives/l ... 00451.html
It is mentioning, that this stick works as QMI, no, I didn't get qmi working ..
Summary:
There is more questions and answers, but since my configuration is workinq, I gave up further experiments ...
How to switch the USB stick without venor-specific installation?
What is in the vendor installation?
How to switch to QMI device?
How to switch on OpenWrt?
PS: my first post on this forum, regards Kubik
Re: Modem D-Link DWM-221
aldi7talk wrote: Is there an easy way, so Lubuntu recognizes the DWM-221 without using the LX Terminal every time I want to connect to the 4G network?
Script your commands.
Add the initial id 2001:a401 in /lib/udev/rules.d/40-usb_modeswitch.rules and call your script from it.
or
download the latest usb_modeswitch executable and data package where support for DWM-221 is included.
You may have to download the source and compile it yourself if your linux distro maintainer hasn't made it available.
Source and data package here:
http://www.draisberghof.de/usb_modeswitch/
Re: Modem D-Link DWM-221
The commands I have to script are:Script your commands.
Add the initial id 2001:a401 in /lib/udev/rules.d/40-usb_modeswitch.rules and call your script from it./
Code: Select all
sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000
Code: Select all
lsusb | grep 7e19
Code: Select all
sudo modprobe usbserial vendor=0x2001 product=0x7e19
Re: Modem D-Link DWM-221
Just put these commands into a text file, one command per line. Remove the "sudo" part, it will be run with admin privileges anyway.
Also, to be on the safe side, give the full path to the executables, like "/usr/sbin/usb_modeswitch" instead of "usb_modeswitch".
As the first line in the file, use this:
Call the script file anything you like, but don't forget to make it executable (chmod 755 <scriptfile>).
If you put it into the folder "/lib/udev", you can call it without a path from the "rules" file.
Have a look at the other lines in "40-usb-modeswitch.rules"; you can create a line for your purpose and make your script start simply with
There is good information available about udev rules. I recommend this:
http://www.reactivated.net/writing_udev_rules.html
Also, to be on the safe side, give the full path to the executables, like "/usr/sbin/usb_modeswitch" instead of "usb_modeswitch".
As the first line in the file, use this:
Code: Select all
#!/bin/sh
If you put it into the folder "/lib/udev", you can call it without a path from the "rules" file.
Have a look at the other lines in "40-usb-modeswitch.rules"; you can create a line for your purpose and make your script start simply with
Code: Select all
... RUN+="<scriptfile>"
http://www.reactivated.net/writing_udev_rules.html
Re: Modem D-Link DWM-221
For diagnostic reasons - if you're not sure if the rule 'triggers' correctly - include test lines in the script that write to a temporary file.
Example:
Example:
Code: Select all
/bin/echo "Triggered!" >/tmp/rule-test
Re: Modem D-Link DWM-221
This is what I did:Josh wrote:Just put these commands into a text file, one command per line. Remove the "sudo" part, it will be run with admin privileges anyway.
Also, to be on the safe side, give the full path to the executables, like "/usr/sbin/usb_modeswitch" instead of "usb_modeswitch".
As the first line in the file, use this:Call the script file anything you like, but don't forget to make it executable (chmod 755 <scriptfile>).Code: Select all
#!/bin/sh
If you put it into the folder "/lib/udev", you can call it without a path from the "rules" file.
Have a look at the other lines in "40-usb-modeswitch.rules"; you can create a line for your purpose and make your script start simply withThere is good information available about udev rules. I recommend this:Code: Select all
... RUN+="<scriptfile>"
http://www.reactivated.net/writing_udev_rules.html
step 1:
I made a file called dlink_script in the Documents folder with the following content:
Code: Select all
#!/bin/sh
/lib/udev/usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000
lsusb | grep 7e19
modprobe usbserial vendor=0x2001 product=0x7e19
Step 2:
Code: Select all
chmod 755 /home/lubuntu/Documents/dlink_script
I opened /lib/udev/rules.d/40-usb_modeswitch.rules and added a line like this and saved it:
Code: Select all
# D-Link DWM-221 (added myself)
ATTR{idVendor}=="2001", ATTR{idProduct}=="7e19", RUN+="/home/lubuntu/Documents/dlink_script"
I restarted the computer with the D-Link 4G modem inserted, but I could not connect to the 4G network.
Step 5:
I added
Code: Select all
/bin/echo "Triggered!" >/home/lubuntu/Documents/rule-test
Re: Modem D-Link DWM-221
You really should be more accurate. Every character counts when writing programs.
The path to usb_modeswitch is /usr/sbin/usb_modeswitch. Check again in that folder.
What you are calling in your script is itself annother little script, a 'wrapper' to start usb_modeswitch (the binary program).
I strongly recommend using a decent file manager to quickly have a look at programs and scripts (so you see which is which).
I'm using Midnight Commander which has largely the same functions (and key commands) as Total Commander for Windows.
It's a terminal program, but if you enlarge your terminal window you'll get a neat interactive surface. I'm using the Fixedsys TTF font with all of my terminals (in Windows too), which delivers excellent readability. YMMV.
The path to usb_modeswitch is /usr/sbin/usb_modeswitch. Check again in that folder.
What you are calling in your script is itself annother little script, a 'wrapper' to start usb_modeswitch (the binary program).
I strongly recommend using a decent file manager to quickly have a look at programs and scripts (so you see which is which).
I'm using Midnight Commander which has largely the same functions (and key commands) as Total Commander for Windows.
It's a terminal program, but if you enlarge your terminal window you'll get a neat interactive surface. I'm using the Fixedsys TTF font with all of my terminals (in Windows too), which delivers excellent readability. YMMV.
Re: Modem D-Link DWM-221
Also, to get the whole path of a program that you can run, append it to the "which" command.
As you can see, it's better to double-check a given path, as Linux distributions may differ.
Code: Select all
$ which echo
/usr/bin/echo