2

I don't know exactly how to troubleshoot the issue I'm having, so I'll ask here.

I have a USB 3G modem attached to a physical machine server4 running ProxMox OS based on Debian Wheezy, and I can send SMS with it just fine using gsmsendsms.

echo "Message" | gsmsendsms -d /dev/ttyUSB0 -b 19200 <phone number>

This works well. Now I have a virtual machine (Ubuntu Server 14.04) installed on a different physical server server1 also running Proxmox based on Debian Wheezy, and I want this virtual machine to access the USB modem on server4.

So far I've tried using ser2net on server4 to 'share' the USB modem trough the network using this line in config:

2000:raw:0:/dev/ttyUSB0:19200 8DATABITS NONE 1STOPBIT banner

which should do the job from what I've managed to understand about ser2net.

On the virtual machine I tried using socat to add a virtual device linked to shared USB modem:

socat pty,link=/dev/virtualcom0,raw tcp:server4:2000

which seems to do the job, as the device virtualcom0 appears in /dev. However, if I try to send an SMS using virtualcom0, I get a funny error:

user@vm:~$ echo "SMS Test Message!" | sudo gsmsendsms -d /dev/virtualcom0 -b 19200 <phone number>
gsmsendsms[ERROR]: clearing DTR failed (errno: 22/Invalid argument)

I use the exact same command as on physical server where USB modem is connected, but it fails, and googling 'gsmsendsms errno 22' wasn't very productive.

In the end, I'd like to make a USB modem plugged into the physical server4 accessible for Zabbix, which runs in a virtual machine on server1. If there is a better way of doing this than using ser2net and socat, I'm ready to try something else.

  • Hardware handshaking is probably not supported over network. Try the -X option of gsmsendsms or access the real device directly via sshfs. – jofel Sep 23 '14 at 15:04
  • Thanks, -X was a part of solution, I got it to work, just not using gsmsendsms but sending text directly onto the device with some flags and all that. Now I have a problem because I can't access this virtualcom0 as a normal user, only as root. – Issak Sep 24 '14 at 6:48
  • Nevermind, I got that too, I just had to execute socat command as user not as root, and mount the virtualcom0 in $HOME directory instead of /dev. – Issak Sep 24 '14 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.