Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
USB wifi dongle - startup script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
zeptin
n00b
n00b


Joined: 28 Jun 2005
Posts: 3

PostPosted: Fri Mar 28, 2014 7:25 pm    Post subject: USB wifi dongle - startup script Reply with quote

I have a wifi dongle that requires the following command to be run every time the machine is started (the driver is not loaded until this command is run, even modprobe does not work):

echo "2001 330D" | tee /sys/bus/usb/drivers/rtl8192cu/new_id

Which startup/init script do I place this command in so that the init script for the wifi adapter will complete successfully? I do not want to edit the adapter's init script, as it is linked to the loopback adapter's script.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Fri Mar 28, 2014 10:09 pm    Post subject: Reply with quote

You can create an initramfs to do it, but I think create an entry in /etc/inittab would be enough
Code:
# System initialization, mount local filesystems, etc.
ai::sysinit:/bin/echo "2001 330D" | /usr/bin/tee /sys/bus/usb/drivers/rtl8192cu/new_id
si::sysinit:/sbin/rc sysinit

This way, your Usb wireless card should be drive before any net services start.

According with what you say, an other way is to use the /etc/modprobe.d/modprobe.conf file
Code:
install rtl8192cu /bin/echo "2001 330D" | /usr/bin/tee /sys/bus/usb/drivers/rtl8192cu/new_id && /sbin/modprobe rtl8192cu

Maybe this one have more chances to succeed:
Code:
install rtl8192cu /sbin/modprobe rtl8192cu && /bin/echo "2001 330D" | /usr/bin/tee /sys/bus/usb/drivers/rtl8192cu/new_id

If you use an initramfs, you may have to recreate it to include the modprobe.conf file.
_________________
Paul


Last edited by Logicien on Fri Mar 28, 2014 10:21 pm; edited 5 times in total
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3934
Location: Dallas area

PostPosted: Fri Mar 28, 2014 10:11 pm    Post subject: Reply with quote

You could add the echo line to the end of /etc/local.d/baselayout1.start (assuming you are using openrc not systemd)

I have several unbind commands there for hardware that I've set aside for vm usage.

Or you can do as Logicien suggested.

It all depends on whether the dongle is your primary network interface.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
zeptin
n00b
n00b


Joined: 28 Jun 2005
Posts: 3

PostPosted: Sat Mar 29, 2014 7:30 am    Post subject: Reply with quote

Thanks, I went with Logicien's suggestion to put it into /etc/inittab, and everything now appears to be correctly loaded on startup. However, the dongle itself is not appearing in /dev and it is therefore not appearing in the ifconfig list either. To be honest, it wasn't actually showing up there before, but I wanted to resolve the kernel modules not loading on startup first.

dmesg seems to indicate that it is happy:
Code:

[    2.960160] usb 1-5: New USB device found, idVendor=2001, idProduct=330d
[    2.960217] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.960271] usb 1-5: Product: 802.11n WLAN Adapter
[    2.960324] usb 1-5: Manufacturer: Realtek
[    2.960376] usb 1-5: SerialNumber: 00e04c000001
[    2.960623] usb 1-5: usb_probe_device
[    2.960626] usb 1-5: configuration #1 chosen from 1 choice
[    2.961403] usb 1-5: adding 1-5:1.0 (config #1, interface 0)

...

[    5.968531] usbcore: registered new interface driver rtl8192cu


lsusb finds the dongle as well:
Code:

Bus 001 Device 003: ID 2001:330d D-Link Corp.


Just to confirm that the modules are indeed being loaded, here's the lsmod output:
Code:

Module                  Size  Used by
rtl8192cu              90431  0
rtlwifi               105981  1 rtl8192cu
rtl8192c_common        53674  1 rtl8192cu


Based on the above, I would expect /dev/wlp0s18f2u5 to be present. I think I got it working briefly once, hence knowing what the device name is, but currently there is only a /dev/enp2s0 for the wired connection.

Just a note for anyone else trying to get a wifi dongle of this type working in the future: I had to emerge the linux-firmware package, it is not immediately obvious that you have to do this.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43186
Location: 56N 3W

PostPosted: Sat Mar 29, 2014 9:21 am    Post subject: Reply with quote

zeptin,

Your device 2001 330D is not known to the rtl8192cu driver. The echo command tells the rtl8192cu driver to take the device anyway.

There are two cleaner ways to do what you need.
1. Patch your kernel. Its a one line change.
2. Run modinfo rtl8192cu. This will tell what options the module takes. You may be able to run
Code:
modprobe  rtl8192cu <Option1>=2001 <Option2>=330d

If 2 works, (it depends on the module) then the options can be provided in /etc/conf.d/modules along with the instruction to load the module.

You may find that the one line kernel patch is already in a newer kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.


Last edited by NeddySeagoon on Sat Mar 29, 2014 10:08 am; edited 1 time in total
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Sat Mar 29, 2014 9:57 am    Post subject: Reply with quote

A lot of network modules need firmwares. So, some firmware packages often have to be emerge. The name of a network device do not appear in the /dev directory. Why, is a good question.

You have to make ifconfig show all the network devices available, up and down, with the -a parameter to be sure your Usb wireless device is listed or not.
Code:
ifconfig -a

or
Code:
ip link show

The firmwares needed by the rtl8192cu module are all include in the linux-firmware package. I see no module parameter to tell rtl8192cu to try to support your card. So you will have to echo it. To be sure the echo command have succeeded, do
Code:
cat /sys/bus/usb/drivers/rtl8192cu/new_id


In the case where you cannot use your wireless card, try to use the latest ~amd64 kernel 3.13.7 from gentoo-sources or vanilla-sources like NeddySeagoon recommand.
_________________
Paul
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum