You are not logged in.

#1 2013-08-24 20:22:30

Registered: 2013-07-30
Posts: 64

hotplug of usb wlan stick

Sorry for interrupting, but I'm to blind to see the way:

I managed to setup my wlan with a Digitus 7045 usb Device using netctl.


netctl start my_device

starts my device, and

netctl stop my_device

  turns the stick and the network setup off.

What I didn't get to work is this:
With wlan set up, I was used to be able to remove the stick and reconnect it at any later time. The wlan-device and the network were setup again automatically.

On my debian/ubuntu boxes, the entry "allow-hotplug my device", e.g

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

in /etc/network/interfaces did the trick. What would be the equivalent in arch linux?


#2 2013-08-25 14:24:46

Registered: 2013-07-30
Posts: 64

Re: hotplug of usb wlan stick

I guess, according to this , all I would have to do is

systemctl start netctl-ifplugd@wlan0

But my device won't start.

I helped myself with some googling  how to add a udev rule.

So I created /etc/udev/rules.d/hotplug-Digitus.rules:

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8176", RUN+="/root/scripts/"

with /root/scripts/ having the following simple content:


# in case this is not the first hotplug in the current session
netctl stop wlan0

# start W-Lan
netctl start wlan0

The magic numbers of the udev-rule are those presented by lsusb:

l[root@pentiumIII bernd_b]#susb                                                                                                            
Bus 002 Device 036: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

Until now, this seem to work. For testing purposes, I found

udevadm control --reload-rules


Last edited by bernd_b (2013-08-25 14:25:29)


#3 2013-08-25 14:45:24

From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: hotplug of usb wlan stick

Your idea of using netctl-ifplugd is wrong.  There are two special versions of netctl.  The netctl-auto is for wireless interfaces, and gives proper roaming support of the specified device name.  So that means that you can be connected to one network, close your laptop, go to a coffee shop, and assuming you have a profile for the network there, it will automagically connect with the help of wpa_actiond.  Netctl-ifplugd is for ethernet devices, and in fact, it just utilizes the ifplugd package, which is a simple daemon that watches for whether or not an ethernet cable is plugged in, and starts and stops whatever is specified. 

So I think that you are on the right track in terms of the udev rule.  But it might be better to use some of the built in features of udev instead of that script you are using.  So I might do something like:

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8176", ENV{SYSTEMD_WANTS}="netctl-auto@$name.service"

Of course, this will mean tat you would set up netctl-auto.  But really all that includes is installing wpa_actiond and then making sure that the wireless profiles you want loaded do not have "ExcludeAuto=yes" in them.


#4 2013-08-28 18:15:21

Registered: 2013-07-30
Posts: 64

Re: hotplug of usb wlan stick

Thanks for the reply.

No luck so far with the udev-line you suggested. The re-plugged stick won't wake up. It is the same behaviour I have with the netcl-auto-service started from commandline. The first time, it works. Then I disconnect the wlan-stick, then I reconnect it and no login into the network is done any more. So I assume the netctl-auto service is good for people who move through different networks, but use fix built in devices?


#5 2014-11-26 12:15:53

Registered: 2014-08-26
Posts: 14

Re: hotplug of usb wlan stick


I have same issue. I'm using netctl-auto@interface.service.
If I start my session with dongle disconnected and I connect it (during startup sequence, if I connect it too late it does not create wlan0), it connects to wireless network. Then if I disconnect/reconnect it, device is recognized but it does not connect to wireless network (no wlan0).

Here is a quote from … figuration "At boot, udev takes an inventory of your hardware and loads appropriate modules (drivers) for your corresponding hardware, which will in turn allow creation of a network interface. "
As I can see from logs, first time device is recognized, its driver is loaded and wlan0 becomes up.
After when I disconnect and reconnect dongle, it is recognized... but network interface isn't created.

Why does execution timeline differs after disconnection? How can I find udev rules executed during startup (I've already grepped in udev with my usb device name and other attributes)?

Any help would be appreciated.

Last edited by lah (2014-11-26 12:35:54)


Board footer

Powered by FluxBB