wlan / wifi reset without reboot [not a question]

asked 2014-02-05 23:23:43 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2014-02-15 13:28:25 +0200

richhanz gravatar image

I have an icon "wlan reset" setup as following:

a file /usr/share/applications/wlan-reset.desktop containing:

[Desktop Entry]
Type=Application
Name=wlan reset
Exec=sh -c "exec /path/program"
Icon=icon-launcher-mad-developer

as devel-su created a script

#!/bin/sh
rmmod wlan
sleep 20
modprobe wlan

script with setuid bit:

chmod 4755 <script>

c code from setuid on shell scripts

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
   setuid( 0 );
   system( "/path/script" );
   return 0;
}

compile the program:

gcc <c code> -o <program>

program with setuid bit:

chmod 4755 <program>

et voila a wlan / wifi reset without rebooting

Both with the icon and the commandline is that wlan status icons most of the time does not get updated.

edit retag flag offensive reopen delete

The question has been closed for the following reason "not a real question" by Low
close date 2014-02-06 01:07:26.870398

Comments

nice, thank you!

Low ( 2014-02-06 01:07:42 +0200 )edit

Excellent, thank you very much!

IZ1IVA ( 2014-02-06 22:25:09 +0200 )edit
1

Thank you! I needed this. Now I see there is an app based on this solution on OpenRepos: Wlan reset

cocof2001 ( 2014-02-07 15:20:16 +0200 )edit

Thanks! Shouldn't it use "modprobe -r" instead of rmmod? "man rmmod" says so.

etam ( 2014-02-16 12:14:58 +0200 )edit