0

I have a Debian 8.4 machine that I am using for sending/receiving sms via smstools. My modem is: Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem All works great for a few days and then modem becomes unavailable via /dev/ttyUSB0, I have to change to /dev/ttyUSB1. For the next few days it is working fine and then same thing happens - I have to switch back to /dev/ttyUSB0 Anybody has an idea why that happens? What can I do? Is it modems fault? On my previous machine I had the same modem model and it could work fine for months. Unfortunately I can't use that modem as ESXi does not see it.

0

The reasons

Well, I think the reason is that something resets the modem/USB bus (I don't know for sure: is it a USB bus reset, a modem reset caused by its firmware, a modem reset caused by the SMS sending daemon or something else completely), and hence makes the modem appear as another device: because naming of hot-pluggable devices is intentionally not fixed—at least since the Linux kernel had switched to using udev for managing /dev hierarchy.

The remedy

What you should do is to use the udev's ability to provide you with persistent device naming when you need it.

There are multiple ways to do it, but the simplest is to request the kernel to create a symlink with your custom name pointing to the real device node file.

For instance, on a Debian system serving the same purpose as yours, we have:

$ cat /etc/udev/rules.d/55-USB-modems.rules
# idVendor           0x12d1 Huawei Technologies Co., Ltd.
# idProduct          0x1001 E169/E620/E800 HSDPA Modem
SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1001",SYMLINK+="ttyGSM1"

This rule will make the modem be also available as /dev/ttyGSM1 node.

Note that those idVendor and idProduct attributes used to match the device are different between different devices; query the USB bus to figire out what your device has. On that our system, we have:

$ lsusb|grep 12d1
Bus 002 Device 008: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

So I think you have the idea.

Note that you will need to restart udev to make it reload its rules and then re-plug the modem to make it reappear from the udev's PoV.

  • Heh, fun point: just finished writing my answer and discovered you have the same modem we do ;-) – kostix Dec 20 '16 at 9:59
  • Hi, thank you for your input. I had it done earlier but with "SUBSYSTEMS==tty" and it worked for while but when the "reset" happened it did not switch to the new one. I tried doing it how you suggested but it did not work. In the app log I get first: Cannot open serial port /dev/huawei, error: Permission denied then after manually setting it to 666 I get this: Unexpected input: @�^R^A^P^C^B^A ^BU^C^A^A�� ^D^C���^G^E�^C@^E^G^E�^B^B ^G^E^A^B^B ^D^A^B���^G^E�^B^B ^G^E^B^B^B ^D^B^B���^G^E� – Kliwer Dec 21 '16 at 5:30
  • @Kliwer, 1) Don't do that! Modem devices should have permission bits set like 1660 and be owned by root:dialout; then you need to make your S/W use an account which is included into that dialout group. 2) This is another program completely. I'd start with installing picocom, minicom or a similiar program and chatting with your modem form it. For a start, does it respond to the basic AT command with OK? That is, for a start, verify it works as expected, and then try using special software to drive it. – kostix Dec 21 '16 at 6:17
  • @Kliwer, one reason for the modem to not work could be wrong expectation about the baud rate, number of data, stop and parity bits between the modem and your software. Please do your research using these key words. – kostix Dec 21 '16 at 6:20
  • @Kliwer, I also recommend you to post a message to the debian-users mailing list describing your problem--chances are much better you get help there. You don't have to be subscribed. Also don't miss out the #debian IRC channel on debian.oftc.net: there, you can get almost real-time help on immediate problems like setting correct permissions on the devices or chatting with your modem. – kostix Dec 21 '16 at 6:22
0

It seems that it was indeed a faulty modem. I changed it to another one and it works fine now.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.