Skip to contentSkip to conversation

Renaming hci interfaces with udev

DISCUSSION Andrej Rosano 3 participants 5 messages Jul 28, 2009 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,
I would like to change the default name of bluetooth interfaces (hci0, hci1, ...) using udev rules.

While with wlan usb dongles it works with the line:

    KERNEL=="wlan*", NAME="foo0"
the analogous for the bt:
    KERNEL=="hci*", NAME="foo0"
doesn't work, while
    KERNEL=="hci*", RUN+="/usr/bin/touch /tmp/foo"

works.

I'm using kernel 2.6.30.1, udev 125 and bluez 4.46.

Regards,
Andrej

Signature · 2 lines
Andrej Rosano                                               <[email protected]>
0x7B470744                    E5DF 7810 AD63 A215 2D0E  AF56 53C7 A2CB 7B47 0744
maintainer
#1 lore raw

Hi Andrej,

Quoted 4 lines

I would like to change the default name of bluetooth interfaces (hci0, hci1, ...) using udev rules.

While with wlan usb dongles it works with the line:

Quoted 8 lines
    KERNEL=="wlan*", NAME="foo0"
the analogous for the bt:
    KERNEL=="hci*", NAME="foo0"
doesn't work, while
    KERNEL=="hci*", RUN+="/usr/bin/touch /tmp/foo"

works.

I'm using kernel 2.6.30.1, udev 125 and bluez 4.46.

we don't support renaming HCI devices. However feel free to send a kernel patch to enable it.

Regards

Marcel

#2 lore raw
In reply to Andrej Rosano
Quoted 3 lines · Andrej Rosano

Hi,
I would like to change the default name of bluetooth interfaces (hci0, hci1, ...) using udev rules.

Could I ask why you want to do that?

#3 lore raw
Quoted 6 lines · Bastien Nocera
Quoted 3 lines · Andrej Rosano

Hi,
I would like to change the default name of bluetooth interfaces (hci0, hci1, ...) using udev rules.

Could I ask why you want to do that?

I have more than one bt dongle connected to the box and I would like to assign always the same bluetooth name (the one set with hciconfig hciX name ...), ex:

the one with BD_ADDR=xx:yy:zz:00:00:01  ->  foo
the one with BD_ADDR=xx:yy:zz:00:00:02  ->  bar

...

If one could use the udev persistent rules like with ethernet interfaces:

ACTION=="add", KERNEL=="hci*", ATTR{address}=="xx:yy:zz:00:00:01", NAME="hci0" ACTION=="add", KERNEL=="hci*", ATTR{address}=="xx:yy:zz:00:00:02", NAME="hci1"
...

and then set the appropriate bluetooth name:

hciconfig hci0 name foo
hciconfig hci1 name bar
...

Currently I am using a script to do that.

Regards,
Andrej

Signature · 2 lines
Andrej Rosano                                               <[email protected]>
0x7B470744                    E5DF 7810 AD63 A215 2D0E  AF56 53C7 A2CB 7B47 0744
maintainer
#4 lore raw

Hi Andrej,

Quoted 19 lines
Quoted 4 lines
Quoted 2 lines

I would like to change the default name of bluetooth interfaces (hci0, hci1, ...) using udev rules.

Could I ask why you want to do that?

I have more than one bt dongle connected to the box and I would like to assign always the same bluetooth name (the one set with hciconfig hciX name ...), ex:

the one with BD_ADDR=xx:yy:zz:00:00:01  ->  foo
the one with BD_ADDR=xx:yy:zz:00:00:02  ->  bar

...

If one could use the udev persistent rules like with ethernet interfaces:

ACTION=="add", KERNEL=="hci*", ATTR{address}=="xx:yy:zz:00:00:01", NAME="hci0" ACTION=="add", KERNEL=="hci*", ATTR{address}=="xx:yy:zz:00:00:02", NAME="hci1"
...

Quoted 7 lines

and then set the appropriate bluetooth name:

hciconfig hci0 name foo
hciconfig hci1 name bar
...

Currently I am using a script to do that.

and actually bluetoothd is doing that for you no matter what the device name is. You just have to set the name once using the D-Bus interface.

Regards

Marcel