Hi! Some general question + Wifi USB Realtek RTL8191S

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby Jocko » Wed Jan 08, 2014 7:05 pm

Hi matzi

Forget that because there is no action "remove" available for eth0, we must make rule on your wlan0.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby matzi » Wed Jan 08, 2014 7:31 pm

OK here is what I did up to now. For testing purpose the main instructions in the shellscripts are comment tagged yet.

Created 70-udef.rules in /etc/udev/rules.d

BUS=="usb", SUBSYSTEM=="net", KERNEL=="wlan0", ACTION=="add", RUN="/etc/iface_scripts/bringup_wlan0.sh"
BUS=="usb", SUBSYSTEM=="net", KERNEL=="wlan0", ACTION=="remove", RUN="/etc/iface_scripts/bringdown_wlan0.sh"


/etc/iface_scripts/bringdown_wlan0:
Code: Select all
# ifconfig eth0 up
# /sbin/route add default gw 192.168.178.1 dev eth0
# ifconfig wlan0 down
echo "bringdownwlan0" >> /etc/iface_scripts/udev.log


/etc/iface_scripts/bringup_wlan0:
# ifconfig wlan0 up
# ifconfig eth0 down
echo "bringupwlan0" >> /etc/iface_scripts/udev.log



Created empty file /etc/iface_scripts/udev.log with permission 0666.

That file stays with no entry when plugging / unplugging the dongle. The scripts are not called!?
matzi
Donator VIP
Donator VIP
 
Posts: 253
Joined: Wed Jul 06, 2011 8:08 am
Location: Hannover Germany

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby Jocko » Wed Jan 08, 2014 7:50 pm

if I understand well, you want to test first the udev events (shell command with '#').

if you remove the "#", there is an error in your command line.

You don't follow this warning
Note2: in your shell script, you must use the command with their full path (e.g. /sbin/route) because the PATH environment variable is not available.

so make
Code: Select all
which ifconfig
to find its full path. (same thing for echo)
Otherwise, I would add a command line in /etc/iface_scripts/bringup_wlan0:
/sbin/ifconfig wlan0 up
/sbin/route add default gw 192.168.178.1 dev wlan0
/sbin/ifconfig eth0 down
/usr/bin/echo "bringupwlan0" >> /etc/iface_scripts/udev.log

You must add a gateway rule for wlan0. indeed after a bring down this route is no longer available
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby matzi » Wed Jan 08, 2014 8:09 pm

modified shell scripts into
# /sbin/ifconfig eth0 up
# /sbin/route add default gw 192.168.178.1 dev eth0
# /sbin/ifconfig wlan0 down
/usr/bin/echo "bringdownwlan0" >> /etc/iface_scripts/udev.log


and

# /sbin/ifconfig wlan0 up
# /sbin/route add dafault gw 192.168.178.1 dev wlan0
# /sbin/ifconfig eth0 down

/usr/bin/echo "bringupwlan0" >> /etc/iface_scripts/udev.log


Still no entry in udev.log
matzi
Donator VIP
Donator VIP
 
Posts: 253
Joined: Wed Jul 06, 2011 8:08 am
Location: Hannover Germany

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby Jocko » Wed Jan 08, 2014 8:14 pm

So do you set run permission on your shell file ?

could you post the output of
Code: Select all
udevinfo -a -p /sys/class/net/wlan0


if the path is wrong do
Code: Select all
 find /sys/class -name wlan0
to get the rigth path
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby matzi » Wed Jan 08, 2014 8:29 pm

Yes script permission is set to oct 755

root@fvdwsl-base:/ # udevinfo -a -p /sys/class/net/wlan0

udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

looking at device '/devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/net/wlan0':
KERNEL=="wlan0"
SUBSYSTEM=="net"
SYSFS{mtu}=="1500"
SYSFS{type}=="1"
SYSFS{netdev_group}=="0"
SYSFS{flags}=="0x1002"
SYSFS{addr_assign_type}=="0"
SYSFS{dev_id}=="0x0"
SYSFS{iflink}=="6"
SYSFS{addr_len}=="6"
SYSFS{address}=="7c:dd:90:16:ee:e9"
SYSFS{operstate}=="down"
SYSFS{broadcast}=="ff:ff:ff:ff:ff:ff"
SYSFS{tx_queue_len}=="1000"
SYSFS{ifalias}==""
SYSFS{ifindex}=="6"
SYSFS{link_mode}=="0"

looking at device '/devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/net':
ID=="net"
BUS==""
DRIVER==""

looking at device '/devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0':
ID=="1-1:1.0"
BUS=="usb"
DRIVER=="rt2800usb"
SYSFS{bInterfaceClass}=="ff"
SYSFS{modalias}=="usb:v148Fp5370d0101dc00dsc00dp00icFFiscFFipFFin00"
SYSFS{bInterfaceSubClass}=="ff"
SYSFS{bInterfaceProtocol}=="ff"
SYSFS{bNumEndpoints}=="07"
SYSFS{supports_autosuspend}=="0"
SYSFS{bAlternateSetting}==" 0"
SYSFS{bInterfaceNumber}=="00"
SYSFS{interface}=="1.0"

looking at device '/devices/platform/orion-ehci.0/usb1/1-1':
ID=="1-1"
BUS=="usb"
DRIVER=="usb"
SYSFS{dev}=="189:1"
SYSFS{bDeviceSubClass}=="00"
SYSFS{bDeviceProtocol}=="00"
SYSFS{devpath}=="1"
SYSFS{idVendor}=="148f"
SYSFS{speed}=="480"
SYSFS{bNumInterfaces}==" 1"
SYSFS{bConfigurationValue}=="1"
SYSFS{bMaxPacketSize0}=="64"
SYSFS{busnum}=="1"
SYSFS{devnum}=="2"
SYSFS{configuration}==""
SYSFS{bMaxPower}=="450mA"
SYSFS{authorized}=="1"
SYSFS{bmAttributes}=="80"
SYSFS{bNumConfigurations}=="1"
SYSFS{maxchild}=="0"
SYSFS{bcdDevice}=="0101"
SYSFS{avoid_reset_quirk}=="0"
SYSFS{quirks}=="0x0"
SYSFS{serial}=="1.0"
SYSFS{version}==" 2.00"
SYSFS{urbnum}=="140"
SYSFS{ltm_capable}=="no"
SYSFS{manufacturer}=="Ralink"
SYSFS{removable}=="unknown"
SYSFS{idProduct}=="5370"
SYSFS{bDeviceClass}=="00"
SYSFS{product}=="802.11 n WLAN"

looking at device '/devices/platform/orion-ehci.0/usb1':
ID=="usb1"
BUS=="usb"
DRIVER=="usb"
SYSFS{dev}=="189:0"
SYSFS{bDeviceSubClass}=="00"
SYSFS{bDeviceProtocol}=="01"
SYSFS{devpath}=="0"
SYSFS{idVendor}=="1d6b"
SYSFS{speed}=="480"
SYSFS{bNumInterfaces}==" 1"
SYSFS{bConfigurationValue}=="1"
SYSFS{bMaxPacketSize0}=="64"
SYSFS{authorized_default}=="1"
SYSFS{busnum}=="1"
SYSFS{devnum}=="1"
SYSFS{configuration}==""
SYSFS{bMaxPower}=="0mA"
SYSFS{authorized}=="1"
SYSFS{bmAttributes}=="e0"
SYSFS{bNumConfigurations}=="1"
SYSFS{maxchild}=="1"
SYSFS{bcdDevice}=="0309"
SYSFS{avoid_reset_quirk}=="0"
SYSFS{quirks}=="0x0"
SYSFS{serial}=="orion-ehci.0"
SYSFS{version}==" 2.00"
SYSFS{urbnum}=="37"
SYSFS{ltm_capable}=="no"
SYSFS{manufacturer}=="Linux 3.9.5 ehci_hcd"
SYSFS{removable}=="unknown"
SYSFS{idProduct}=="0002"
SYSFS{bDeviceClass}=="09"
SYSFS{product}=="Marvell Orion EHCI"

looking at device '/devices/platform/orion-ehci.0':
ID=="orion-ehci.0"
BUS=="platform"
DRIVER=="orion-ehci"
SYSFS{modalias}=="platform:orion-ehci"
SYSFS{uframe_periodic_max}=="100"

looking at device '/devices/platform':
ID=="platform"
BUS==""
DRIVER==""
SYSFS{uevent}==""
matzi
Donator VIP
Donator VIP
 
Posts: 253
Joined: Wed Jul 06, 2011 8:08 am
Location: Hannover Germany

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby matzi » Wed Jan 08, 2014 8:31 pm

Shall I delete bus condition or set it empty?
matzi
Donator VIP
Donator VIP
 
Posts: 253
Joined: Wed Jul 06, 2011 8:08 am
Location: Hannover Germany

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby Jocko » Wed Jan 08, 2014 8:38 pm

so in your udev rules we can sure that the matches: SUBSYSTEM=="net" and KERNEL=="wlan0" are right and should be enough

you could try to remove the test BUS=="usb" and change the run command like this
Code: Select all
SUBSYSTEM=="net", KERNEL=="wlan0", ACTION=="add", RUN+="/bin/sh /etc/iface_scripts/bringup_wlan0.sh"
SUBSYSTEM=="net", KERNEL=="wlan0", ACTION=="remove", RUN+="/bin/sh /etc/iface_scripts/bringdown_wlan0.sh"
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby Jocko » Wed Jan 08, 2014 8:42 pm

other point :

your shell scripts begin with this first line :
Code: Select all
#!/bin/sh
:mrgreen:
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hi! Some general question + Wifi USB Realtek RTL8191S

Postby matzi » Wed Jan 08, 2014 8:56 pm

Now the shellscripts are called! I have entry in udev.log.
Then I deleted the comment marks.
Now it is like this:
Booted witout dongle.
Inserted dongle - I loose webinterface access through fixed IP, no access through wireless IP.
Unplugged dongle - I regain webinterface access through fixed IP,no access through wireless IP.

Can't I write the two actual routing tables to my logfile to see what happens? Maybe between the different ifconfig instructions.
matzi
Donator VIP
Donator VIP
 
Posts: 253
Joined: Wed Jul 06, 2011 8:08 am
Location: Hannover Germany

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 12 guests