fixed name in /dev for USB devices

Use devd.conf(5) to detect the device on attach and create a link to it. Warning: I have not tried these recently, and there have been some changes to dev(8), so consider these untested. Worked months ago, though.

I put my own additions in /etc/devd/wb.conf to avoid having to add them to /etc/devd.conf every time that is updated.
Code:
# WB
# link Epson R200 printer to /dev/ulpt-r200 and unlpt-r200
attach 20 {
        device-name "ulpt[0-9]";
        match "vendor" "0x04b8";
        match "product" "0x0005";
        action "ln -sf /dev/$device-name /dev/ulpt-r200";
        action "ln -sf /dev/`echo $device-name \
                | sed -e 's/ulpt/unlpt/'` /dev/unlpt-r200";
        action "chmod g+w /dev/ulpt-r200 /dev/unlpt-r200";
};

# WB
detach 20 {
        device-name "ugen[0-9].[0-9]";
        match "vendor" "0x04b8";
        match "product" "0x0005";
        action "rm -f /dev/ulpt-r200 /dev/unlpt-r200";
};
 
That looks quite interesting. I had also observed the ever changing USB attachments as described by the OP (e.g. now the external HDD is /dev/foo but next time I boot it may be assigned /dev/bar) but it never annoyed me enough to really look into it. It seems like I have found something to do ;)
 
I really think there should be a system file, possibly an addition to /etc/devfs.conf, that would let the user associate USB vendor and product IDs with links in /dev.

Code:
link    usb:0x04b8:0x0005    ulpt-r200

I'm sure this can be done, but have not given any thought to implementation.
 
I want to fixed name for 3g modem (example /dev/cuaU99) but I don't understand what is make.
When I attached usb 3g modem:

Code:
kernel: u3g0: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2> on usbus0
kernel: u3g0: Found 4 ports.
kernel: umass1: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2> on usbus0
kernel: umass1:  SCSI over Bulk-Only; quirks = 0x0000
kernel: umass1:5:1:-1: Attached to scbus5
kernel: (probe0:umass-sim1:1:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
kernel: (probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
kernel: (probe0:umass-sim1:1:0:0): SCSI status: Check Condition
kernel: (probe0:umass-sim1:1:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready to ready change, medium may have changed)
kernel: cd1 at umass-sim1 bus 1 scbus5 target 0 lun 0
kernel: cd1: <HUAWEI Mass Storage 2.31> Removable CD-ROM SCSI-2 device 
kernel: cd1: 1.000MB/s transfers
kernel: cd1: cd present [41280 x 2048 byte records]

As I understand the u3g driver assign devices to /dev/cuaU?, /dev/ttyU? via ucom driver. What rule must specify in this case for a devd?
 
Back
Top