如何在Linux中与USB调制解调器“对话”?

我有一个USB调制解调器,在Linux(Ubuntu 12.04)中用lsusb标识

 Bus 001 Device 003: ID 0572:1329 Conexant Systems (Rockwell), Inc. 

如何与该设备通信(例如与microcom等?)? 我应该使用什么dev设备? 没有/dev/ttyUSBXXX可用,只有一个/dev/ttyACM0

如果通过谈话你的意思是发送表格中的AT命令

 echo "ATi" > /dev/usbDev 

试试这个: http : //brunomgalmeida.wordpress.com/2012/04/06/send-at-commands-to-usb-modem/

你可以用铜。

 $ sudo apt-get install cu 

您可以通过以下方式连接调制解调器

 $ cu -l ttyACM0 

(with:ttyACM0是设备/ dev / ttyACM0)你应该得到一个回复​​:

 connected 

此时,您可以使用任何标准AT命令,例如测试拨号:

 ATDT 123-456-7890 

您应该将您的用户ID设置为组拨出以获得访问调制解调器的权限。

您可以使用“〜”退出cu应用程序。 (波浪点)。

您可以在以下位置找到其他Hayese命令:

http://en.wikipedia.org/wiki/Hayes_command_set

我相信你要找的答案就在这里: 在(K)Ubuntu 11.10(Oneiric)中使用带有Conexant驱动程序的USB winmodem 。

重要的东西(从网站上提取):

当我插入Conexant调制解调器时,我执行了

 lsusb 

它说:

[…]

 Bus 006 Device 002: ID 0572:1300 Conexant Systems (Rockwell), Inc. SoftK56 Data Fax Voice CARP 

[…]

所以我知道HSF调制解调器已被系统识别。

由于我之前有互联网连接,我升级了系统

 sudo apt-get update && sudo apt-get dist-upgrade 

我检查过我之前没有安装过Conexant驱动程序。 例如:我执行了

 ls /usr/sbin/hsfconfig 

它说该文件不存在; 如果它存在,我会认为仍然安装了一些东西。

我确保我已经准备好“gcc”和“make”,执行

 sudo apt-get install gcc make 

然后我执行了那些告诉那里的步骤:

 sudo -s cd /lib/modules/$(uname -r)/build/include/linux ln -s ../generated/utsrelease.h ln -s ../generated/autoconf.h exit 

我准备了驱动程序编译的文件,执行

 mkdir ~/conexant_modem cd ~/conexant_modem 

如果我有一个64位操作系统,我执行

 wget http://linux.dell.com/files/ubuntu/hardy/modem-drivers/hsf/hsfmodem-7.68.00.09x86_64oem.tar.gz tar xzf hsfmodem-7.68.00.09x86_64oem.tar.gz wget http://www.bargweb.net/images/2009/november/hsfmodem-7.80.02.05-DiacoEdition.zip 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.h 

否则,如果我有一个32位操作系统,我执行

 wget http://linux.dell.com/files/ubuntu/hardy/modem-drivers/hsf/hsfmodem-7.68.00.09oem.tar.gz tar xzf hsfmodem-7.68.00.09oem.tar.gz wget http://www.bargweb.net/images/2009/november/hsfmodem-7.80.02.05-DiacoEdition.zip 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". 

如果我有一个64位操作系统,我执行

 wget http://www.linuxant.com/drivers/hsf/full/archive/hsfmodem-7.80.02.06x86_64full/hsfmodem-7.80.02.06x86_64full.tar.gz 

否则,如果我有一个32位操作系统,我执行

 wget http://www.linuxant.com/drivers/hsf/full/archive/hsfmodem-7.80.02.06full/hsfmodem-7.80.02.06full.tar.gz 

好奇的一个注释:该文件是http://www.linuxant.com/drivers/hsf/full/downloads.php中的最新文件。

然后,如果我有一个64位操作系统,我执行

 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/ 

否则,如果我有一个32位操作系统,我执行

 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/ 

下一步是清理当前目录。

如果我有一个64位操作系统,我执行

 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.gz 

否则,如果我有一个32位操作系统,我执行

 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.gz 

然后我不得不更改一些文件以使它们适用于3.0.0版本的Linux内核。 如果我有一个64位操作系统,我执行

 cd hsfmodem-7.80.02.06x86_64full xdg-open modules/GPL/serial_cnxt.c 

否则,如果我有一个32位操作系统,我执行

 cd hsfmodem-7.80.02.06full xdg-open modules/GPL/serial_cnxt.c 

然后启动了一个文本编辑器。 我搜索了字符串

 #ifndef FOUND_UART_REGISTER_PORT 

在下面我找到了字符串

 static DECLARE_MUTEX(cnxt_port_sem); 

我删除了最后一个字符串,并写在那里

 static DEFINE_SEMAPHORE(cnxt_port_sem); 

我保存并关闭了该文件。 我执行了

 xdg-open modules/osdiag.c 

然后启动了一个文本编辑器。 我搜索了字符串

 THIS_MODULE, 

在下面我找到了字符串

 .ioctl = diag_ioctl, 

我删除了那个字符串,并写在那里

 .compat_ioctl = diag_ioctl, 

我保存并关闭了该文件。 我执行了

 xdg-open modules/osnvm.c 

然后启动了一个文本编辑器。 我搜索了字符串

 static LIST_HEAD(nvm_newinst_list); 

在下面我找到了字符串

 static DECLARE_MUTEX(nvmelem_writelist_sem); 

我删除了最后一个字符串,并写在那里

 static DEFINE_SEMAPHORE(nvmelem_writelist_sem); 

我保存并关闭了该文件。

关于好奇文章的说明:这些文件中这些变化的来源是http://www.openmamba.org/showfile.ht…l-2.6.37.patch

名为Chiaseth的用户帮助告诉了我遵循的步骤,这样:

  1. 我执行了

    xdg-open modules / osservices.c

然后启动了一个文本编辑器。 我搜索了字符串

 #include  

我删除了那个字符串,并写在那里

 #include  DEFINE_MUTEX(os_mutex); // Define a mutex 

在那个文件中,我搜索了字符串

 unlock_kernel() 

用它们替换所有这些

 mutex_unlock(&os_mutex) 

此外,在该文件中我搜索了字符串

 lock_kernel() 

用它们替换所有这些

 mutex_lock(&os_mutex) 

我保存并关闭了该文件。

  1. 我执行了

    xdg-open modules / osdcp.c

在那个文件中,我搜索了字符串

 static spinlock_t dcp_lock = SPIN_LOCK_UNLOCKED; 

用它代替

 static DEFINE_SPINLOCK(dcp_lock); 

我保存并关闭了该文件。

  1. 我执行了

    xdg-open modules / osdiag.c

在那个文件中,我搜索了字符串

 static spinlock_t diag_lock = SPIN_LOCK_UNLOCKED; 

用它代替

 static DEFINE_SPINLOCK(diag_lock); 

我保存并关闭了该文件。

  1. 我执行了

    xdg-open modules / osfloat.c

在那个文件中,我搜索了字符串

 static spinlock_t fpstates_lock __attribute__((unused)) = SPIN_LOCK_UNLOCKED; 

用它代替

 static DEFINE_SPINLOCK(fpstates_lock); 

我保存并关闭了该文件。

  1. 我执行了

    xdg-open modules / osservices.c

在那个文件中,我搜索了字符串

 static spinlock_t atomic_lock __attribute__((unused)) = SPIN_LOCK_UNLOCKED; 

用它代替

 static DEFINE_SPINLOCK(atomic_lock); 

我保存并关闭了该文件。

  1. 我执行了

    xdg-open modules / GPL / oscompat.h

在那个文件中,我搜索了字符串

 static spinlock_t tqueue_lock __attribute__((unused)) = SPIN_LOCK_UNLOCKED; 

用它代替

 static DEFINE_SPINLOCK(tqueue_lock); 

我保存并关闭了该文件。

最后……如果执行

 sudo make install sudo hsfconfig 

它询问“linux源代码构建目录与运行的内核匹配在哪里?”,然后我只需按回车键即可接受默认答案。 我也接受了其他问题的默认答案。

最后,该命令报告说

 The /dev/modem alias (symlink) points to ttySHSF0 

我执行了

 dmesg 

最后我看到了

 [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 hsfusbcd2 

这意味着,在/dev/ttySHSF0检测到USB调制解调器。

注意:正如他们在https://help.ubuntu.com/community/Di…Howto/Conexant中所述:“在这些步骤之后,不要从系统中删除或移动源树[在我们的例子中:〜/ conexant_modem] ,它将被要求卸载并修补驱动程序。“

我启动了kppp (例如)并配置了一个新的“连接”,指定调制解调器位于/dev/ttySHSF0 。 您也可以使用像efax-gtk这样的程序通过调制解调器发送传真。

使用minicomsocatscreen

 socat - /dev/ttyUSB1 minicom -D /dev/ttyUSB1 screen /dev/ttyUSB1 

注意:我使用真实设备名称/dev/ttyUSB1而不是假/dev/usbDev

  1. 确保您的USB调制解调器已正确插入Ubuntu计算机上任何可用的USB端口。

  2. 单击网络图标,然后选择Edit connections 。 这将启动Ubuntu的网络管理实用程序。

  3. 从可用连接列表中选择USB调制解调器的名称,然后单击“ Properties.

  4. 单击“ Enable this Connection以告知Ubuntu您要使用此设备连接到Internet网络。

  5. 单击OK. 您的USB调制解调器现在可以在Ubuntu中正确连接和配置,现在您可以使用它连接到Internet。

这里的教程来源

我知道有两个软件可用于向调制解调器发送AT(注意)命令,一个是串口终端,另一个是Cutecom。