How to 'talk' to USB modem in Linux?
I have a USB modem that is identified in Linux (Ubuntu 12.04) with lsusb as
Bus 001 Device 003: ID 0572:1329 Conexant Systems (Rockwell), Inc.How to talk to that device (e.g. with microcom etc?)? What dev device should I use? There is no /dev/ttyUSBXXX available and just one /dev/ttyACM0.
6 Answers
You can use cu.
$ sudo apt-get install cuYou can connect to your modem with:
$ cu -l ttyACM0(with: ttyACM0 being the device /dev/ttyACM0) You should get a response:
connectedAt this point you can use any of the standard AT commands such as to test dialing:
ATDT 123-456-7890You should have your userid set to the group dialout for permission to access the modem.
You can exit the cu application with "~." (tilde dot).
You can find other Hayese commands at:
If by talk you mean send AT commands in the form
echo "ATi" > /dev/usbDevtry this:
2Use minicom, socat or screen:
socat - /dev/ttyUSB1
minicom -D /dev/ttyUSB1
screen /dev/ttyUSB1NOTE: I used real device name /dev/ttyUSB1 instead of fake /dev/usbDev.
I believe the answer you're looking for is here: Using a USB winmodem with a Conexant driver in (K)Ubuntu 11.10 (Oneiric).
Important stuff (extracted from the site):
When I plugged a Conexant modem, I executed
lsusband it said:
[...]
Bus 006 Device 002: ID 0572:1300 Conexant Systems (Rockwell), Inc. SoftK56 Data Fax Voice CARP[...]
so I knew that the HSF modem was recognized by the system.
As I had a previous internet connection, I upgraded the system
sudo apt-get update && sudo apt-get dist-upgradeI checked that I had no previous Conexant drivers installed. For example: I executed
ls /usr/sbin/hsfconfigand it said that that file did not exist; if it existed I would have thought that something was still installed.
I made sure that I had "gcc" and "make" ready, executing
sudo apt-get install gcc makeThen I executed those steps told there:
sudo -s
cd /lib/modules/$(uname -r)/build/include/linux
ln -s ../generated/utsrelease.h
ln -s ../generated/autoconf.h
exitI prepared the files for the driver compilation, executing
mkdir ~/conexant_modem
cd ~/conexant_modemand if I had a 64-bit operating system I executed
wget
tar xzf hsfmodem-7.68.00.09x86_64oem.tar.gz
wget
unzip hsfmodem-7.80.02.05-DiacoEdition.zip
cp -a hsfmodem-7.80.02.05-DiacoEdition/modules/imported/include/framewrk.h hsfmodem-7.68.00.09x86_64oem/modules/imported/include/framewrk.h
cp -a hsfmodem-7.80.02.05-DiacoEdition/modules/imported/include/osservices.h hsfmodem-7.68.00.09x86_64oem/modules/imported/include/osservices.helse, if I had a 32-bit operating system I executed
wget
tar xzf hsfmodem-7.68.00.09oem.tar.gz
wget
unzip hsfmodem-7.80.02.05-DiacoEdition.zip
cp -a hsfmodem-7.80.02.05-DiacoEdition/modules/imported/include/framewrk.h hsfmodem-7.68.00.09oem/modules/imported/include/framewrk.h
cp -a hsfmodem-7.80.02.05-DiacoEdition/modules/imported/include/osservices.h hsfmodem-7.68.00.09oem/modules/imported/include/osservices.h
A note for the curious ones: those "framewrk.h" and "osservices.h" files were the different ones between the directories "hsfmodem-7.68.00.09oem/modules/imported" and "hsfmodem-7.80.02.05-DiacoEdition/modules/imported".If I had a 64-bit operating system I executed
wget else, if I had a 32-bit operating system I executed
wget A note for the curious ones: that file was the newest one in
And then, if I had a 64-bit operating system I executed
tar xzf hsfmodem-7.80.02.06x86_64full.tar.gz
rm -r hsfmodem-7.80.02.06x86_64full/modules/imported
cp -R hsfmodem-7.68.00.09x86_64oem/modules/imported hsfmodem-7.80.02.06x86_64full/modules/
cp -R hsfmodem-7.68.00.09x86_64oem/modules/imported hsfmodem-7.80.02.06x86_64full/modules/else, if I had a 32-bit operating system I executed
tar xzf hsfmodem-7.80.02.06full.tar.gz
rm -r hsfmodem-7.80.02.06full/modules/imported
cp -R hsfmodem-7.68.00.09oem/modules/imported hsfmodem-7.80.02.06full/modules/
cp -R hsfmodem-7.68.00.09oem/modules/imported hsfmodem-7.80.02.06full/modules/The next step was to clean the present directory.
If I had a 64-bit operating system I executed
rm -rf hsfmodem-7.68.00.09x86_64oem
rm -rf hsfmodem-7.80.02.05-DiacoEdition
rm hsfmodem-7.68.00.09x86_64oem.tar.gz
rm hsfmodem-7.80.02.05-DiacoEdition.zip
rm hsfmodem-7.80.02.06x86_64full.tar.gzelse, if I had a 32-bit operating system I executed
rm -rf hsfmodem-7.68.00.09oem
rm -rf hsfmodem-7.80.02.05-DiacoEdition
rm hsfmodem-7.68.00.09oem.tar.gz
rm hsfmodem-7.80.02.05-DiacoEdition.zip
rm hsfmodem-7.80.02.06full.tar.gzThen I had to change some files to adapt them to work with the 3.0.0 version of the Linux kernel. If I had a 64-bit operating system I executed
cd hsfmodem-7.80.02.06x86_64full
xdg-open modules/GPL/serial_cnxt.celse, if I had a 32-bit operating system I executed
cd hsfmodem-7.80.02.06full
xdg-open modules/GPL/serial_cnxt.cand then a text editor was launched. I searched for the string
#ifndef FOUND_UART_REGISTER_PORTand below I found the string
static DECLARE_MUTEX(cnxt_port_sem);I deleted that last string, and wrote there
static DEFINE_SEMAPHORE(cnxt_port_sem);and I saved and closed that file. I executed
xdg-open modules/osdiag.cand then a text editor was launched. I searched for the string
THIS_MODULE,and below I found the string
.ioctl = diag_ioctl,I deleted that string, and wrote there
.compat_ioctl = diag_ioctl,and I saved and closed that file. I executed
xdg-open modules/osnvm.cand then a text editor was launched. I searched for the string
static LIST_HEAD(nvm_newinst_list);and below I found the string
static DECLARE_MUTEX(nvmelem_writelist_sem);I deleted that last string, and wrote there
static DEFINE_SEMAPHORE(nvmelem_writelist_sem);and I saved and closed that file.
A note for the curious ones: the source of those changes in those files was
The user named Chiaseth helped telling those steps that I followed, this way:
I executed
xdg-open modules/osservices.c
and then a text editor was launched. I searched for the string
#include <linux/smp_lock.h>and I deleted that string, and wrote there
#include <linux/mutex.h>
DEFINE_MUTEX(os_mutex); // Define a mutexIn that file I searched for the strings
unlock_kernel()replacing all of them with
mutex_unlock(&os_mutex)Also, in that file I searched for the strings
lock_kernel()replacing all of them with
mutex_lock(&os_mutex)and I saved and closed that file.
I executed
xdg-open modules/osdcp.c
In that file I searched for the string
static spinlock_t dcp_lock = SPIN_LOCK_UNLOCKED;replacing it with
static DEFINE_SPINLOCK(dcp_lock);and I saved and closed that file.
I executed
xdg-open modules/osdiag.c
In that file I searched for the string
static spinlock_t diag_lock = SPIN_LOCK_UNLOCKED;replacing it with
static DEFINE_SPINLOCK(diag_lock);and I saved and closed that file.
I executed
xdg-open modules/osfloat.c
In that file I searched for the string
static spinlock_t fpstates_lock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;replacing it with
static DEFINE_SPINLOCK(fpstates_lock);and I saved and closed that file.
I executed
xdg-open modules/osservices.c
In that file I searched for the string
static spinlock_t atomic_lock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;replacing it with
static DEFINE_SPINLOCK(atomic_lock);and I saved and closed that file.
I executed
xdg-open modules/GPL/oscompat.h
In that file I searched for the string
static spinlock_t tqueue_lock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;replacing it with
static DEFINE_SPINLOCK(tqueue_lock);and I saved and closed that file.
Finally... If executed
sudo make install
sudo hsfconfigIt asked "Where is the linux source build directory that matches your running kernel?", then I simply pressed the return key to accept the default answer. I also accepted the default answer in other questions.
Finally the command reported that
The /dev/modem alias (symlink) points to ttySHSF0I executed
dmesgand at the end I saw
[59190.782005] hsfengine: module license 'see LICENSE file distributed with driver' taints kernel.
[59190.782011] Disabling lock debugging due to kernel taint
[59192.564398] ttySHSF0 at MMIO 0x0 (irq = 0) is a Conexant HSF softmodem (USB-0572:1300)
[59192.600274] usbcore: registered new interface driver hsfusbcd2
[59194.416241] usbcore: deregistering interface driver hsfusbcd2
[59194.600064] usb 6-1: reset full speed USB device using uhci_hcd and address 2
[59194.811746] cnxthsf_DcpDestroy: units still active, waiting..
[59194.811764] cnxthsf_DcpDestroy: units still active, waiting..
[59194.811778] cnxthsf_DcpDestroy: units still active, waiting..
[59196.967466] ttySHSF0 at MMIO 0x0 (irq = 0) is a Conexant HSF softmodem (USB-0572:1300)
[59196.994150] usbcore: registered new interface driver hsfusbcd2which meant, among other things, that the USB modem was detected at /dev/ttySHSF0.
Note: as they said in : "do not delete or move the source tree [in our case: ~/conexant_modem] from your system after these steps, it will be required to uninstall and patch the driver."
I launched kppp (for example) and configured a new "connection", specifying that the modem was at /dev/ttySHSF0. You could also use a program like efax-gtk to send faxes through the modem.
Ensure that your USB modem is properly inserted into any available USB port on your Ubuntu computer.
Click the network icon and select
Edit connections. This will launch Ubuntu's networking management utility.Select the name of the USB modem from the list of available connections, then click
Properties.Click
Enable this Connectionto tell Ubuntu that you want to use this device to connect to Internet networks.Click
OK.Your USB modem will now be properly connected to and configured in Ubuntu, and you can now use it to connect to the Internet.
Source of tutorial here
There are two software I know of you can use to send AT(Attention) commands to your modem one is Serial port terminal and other one is Cutecom.