Problems with USB GSM modem and devd

Colleagues, could you please tell me what I'm doing wrong?
I have a Huawei E1550 USB GSM modem. When turned on, it creates three COM ports. I want the names of the special files to be unique and not change their order when connecting other USB-serial adapters.

Here it is:
ogogon@devel:/usr/local/etc/devd# lsusb
Bus /dev/usb Device /dev/ugen3.4: ID 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem


I created a description for devd. Here it is:
Code:
#
# Example devd configuration file for USB printers.
# Uncomment the notify rule below to enable.
#
# Huawei Technologies Co., Ltd. E1550 HSDPA Modem

# Rules for modem Huawei E1550 (Interface 0)
attach 100 {
match "vendor" "0x12d1";
match "product" "0x1001";
match "interface" "0x00";
action "/bin/ln -sf /dev/$device-name /dev/modem_huawei_0";
};

detach 100 {
match "vendor" "0x12d1";
match "product" "0x1001";
match "interface" "0x00";
action "/bin/rm -f /dev/modem_huawei_0";
};

# Rules for modem Huawei E1550 (Interface 1)
attach 101 {
match "vendor" "0x12d1";
match "product" "0x1001";
match "interface" "0x01";
action "/bin/ln -sf /dev/$device-name /dev/modem_huawei_1";
};

detach 101 {
match "vendor" "0x12d1";
match "product" "0x1001";
match "interface" "0x01";
action "/bin/rm -f /dev/modem_huawei_1";
};

# Rules for modem Huawei E1550 (Interface 2)
attach 102 {
match "vendor" "0x12d1";
match "product" "0x1001";
match "interface" "0x02";
action "/bin/ln -sf /dev/$device-name /dev/modem_huawei_2";
};

detach 102 {
match "vendor" "0x12d1";
match "product" "0x1001";
match "interface" "0x02";
action "/bin/rm -f /dev/modem_huawei_2";
};

Unfortunately, the regular special files are created, but the links are not.
I ran devd -d. It outputs a lot of output, but I don't see any attempts to run ln.

What am I doing wrong? How can I solve my problem?

Thank you for your advice,
Ogogon.
 
You will likely need to do the links with devfs. You won't need the rules here if that's all you want to do. also, trying to do anything to the device here is racey since these actions run when the attach routine of the driver returns, but some drivers defer creating the /dev nodes until a tiny time later after they've configured them for use. See devfs(8) and devfs.conf(5) for more details. You can even set permissions, ownership, etc for the device nodes.

But since you want to associate the different kinds of modem with an alias, that may be trickier. There is a cdev event that devfs generates, but that might require the devd event to write some temporary state so that the cdev event can link to the right device. Unfortunately, there's not a good connection between 'tty' and 'device name' so that you can learn about the device. If you had that, you could use devfs(8) to add rules to get the right links.... I tried to add this association some time ago, but it got bogged down in review.
 
Back
Top