You are not logged in.

#1 2009-01-19 16:37:19

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

Hello,
I'm trying to get suspend to RAM and suspend to disk to work. Everything works fine unless I've plugged in the Fritz! USB stick. The notebook suspends correctly but when it resumes it freezes after a few seconds. When I unplug the USB stick before I resume everything works fine. I played around a bit and the last thing I tried was to stop all the wlan services (wicd, wicd-client), kill the wpa_supplicant, unload all the usbrelated modules (ndiswrapper, ehci_hcd, uhci_hcd, usbcore) and then unplug the USB stick before going to suspend. After resume I plugged in the stick and reloaded all the modules. After I restarted the wicd service the notebook froze again.

My questions are:
  Does a command exist to remove usb devices?
  Does anyone know how to further debug the problem?

I've checked the pm-utils log file, but there are only events from the suspend action not from the resume.

Last edited by BertiBoeller (2009-01-19 16:37:49)

Offline

#2 2009-01-19 18:46:39

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

build a script. Something like /etc/pm/sleep.d/sleep_crappy_stuff.sh and chmod +x it.

#! /bin/bash
    case $1 in
    suspend)
        sync && sync && sync
        /etc/rc.d/wicd stop
        dhcpcd -x wlan0
        killall -9 wpa_supplicant
        ifconfig wlan0 down
        sleep 2
        modprobe -r ndiswrapper
    ;;
    resume)
        modprobe ndiswrapper
        sleep 2
        iwpriv wlan0 ndis_reset 1
        sleep 1
        ifconfig wlan0 up
        /etc/rc.d/wicd start
    ;;
    esac

start with this. Add stuff as you start knowing how your win-netstick works. I got a TPLINK, which works very well with the script stated above.

Last edited by kjon (2009-01-19 18:48:04)


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#3 2009-01-20 04:01:54

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

Thank you for your feedback! Unfortunately I wasn't able to get the suspend to RAM working.

I've played with the file you gave me and modified it a little bit, so that it stores the stdout and stderr to a log file.

#! /bin/bash
wlan_suspend()
{
        echo "Going to suspend" >> /home/martin/suspend.log 2>&1
        sync && sync && sync

        echo "Executing the wicd suspend script" >> /home/martin/suspend.log 2>&1
        /usr/lib/wicd/suspend.py 1>/dev/null 2>/dev/null >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        echo "Stopping wicd daemon" >> /home/martin/suspend.log 2>&1
        /etc/rc.d/wicd stop >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        echo "Stopping dhcpcd dameon" >> /home/martin/suspend.log 2>&1
        dhcpcd -x wlan0 >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        echo "Kill wpa_supplicant" >> /home/martin/suspend.log 2>&1
        killall -9 wpa_supplicant >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        echo "Stopping wlan interface" >> /home/martin/suspend.log 2>&1
        ifconfig wlan0 down >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        sleep 2

        echo "Stopping ndiswrapper module" >> /home/martin/suspend.log 2>&1
        modprobe -r ndiswrapper >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi
 }

wlan_resume()
{
        echo "Starting ndiswrapper module" >> /home/martin/suspend.log 2>&1
        modprobe ndiswrapper >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        sleep 2

        echo "Resetting ndiswrapper" >> /home/martin/suspend.log 2>&1
        iwpriv wlan0 ndis_reset 1 >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi
        sleep 1

        echo "Bringing the WLAN interface up" >> /home/martin/suspend.log 2>&1
        ifconfig wlan0 up >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        echo "Starting the wicd daemon" >> /home/martin/suspend.log 2>&1
        /etc/rc.d/wicd start >> /home/martin/suspend.log 2>&1
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi

        echo "Executing the wicd resume script" >> /home/martin/suspend.log 2>&1
        /usr/lib/wicd/autoconnect.py 1>/dev/null 2>/dev/null
        if [ "$?" -ne "0" ]; then
          echo "failure" >> /home/martin/suspend.log 2>&1
        else
          echo "success" >> /home/martin/suspend.log 2>&1
        fi
}

case "$1" in
    hibernate|suspend)
        wlan_suspend
        ;;
    thaw|resume)
        wlan_resume
        ;;
    *) exit $NA
        ;;
esac

Here's the content of the log file:

Going to suspend
Executing the wicd suspend script
success
Stopping wicd daemon
:: Stopping wicd Daemon    [BUSY]    [DONE] 
success
Stopping dhcpcd dameon
wlan0: dhcpcd not running
failure
Kill wpa_supplicant
success
Stopping wlan interface
success
Stopping ndiswrapper module
success
Starting ndiswrapper module
success
Resetting ndiswrapper
Interface doesn't accept private ioctl...
ndis_reset (8BF0): Operation not supported
failure
Bringing the WLAN interface up
success
Starting the wicd daemon
:: Starting wicd Daemon    [BUSY]

There's a suspend script for wicd in "/usr/lib/pm-utils/sleep.d" called "55wicd". I've disabled both the "55wicd" script and the "55NetworkManager" script (networkmanager isn't installed, so it shouldn't make any difference). Two things are catching my eye:
  1. "iwpriv wlan0 ndis_reset 1" doesn't seem to work on my system
  2. the wicd daemon never gets started

Any ideas are welcome.

Offline

#4 2009-01-20 11:57:34

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

that's weird. Do you have the latest drivers of your stick? What is the output of 'iwpriv wlan0'?


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#5 2009-01-20 16:06:35

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

weird indeed...
As I'm relatively new to Linux I don't really know how to debug things.

Im using the latest drivers from AVM (05.04.21).

Here's the output from iwpriv:

wlan0     Available private ioctls :
          ndis_reset       (8BF0) : set   0       & get   0      
          power_profile    (8BF1) : set   1 int   & get   0      
          deauthenticate   (8BF3) : set   0       & get   0      
          network_type     (8BF2) : set   1 char  & get   0      
          media_stream     (8BF4) : set   1 int   & get   0      
          reload_defaults  (8BF7) : set   0       & get   0

Offline

#6 2009-01-20 16:38:24

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

there is ndis_reset as private ioctl. So, you should be able to reset the driver when it misbehaves. Try running 'iwpriv wlan0 ndis_reset 1' as root. It should take 1 or 2 seconds and you might lose connectivity (but that's the idea).


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#7 2009-01-20 16:53:04

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

Hello again, thanks again for feedback. I really appreciate it.

Here's the output after executing "iwpriv wlan0 ndis_reset 1":

Interface doesn't accept private ioctl...
ndis_reset (8BF0): Operation not supported

Offline

#8 2009-01-20 19:19:19

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

no idea then. I don't know what's going wrong with your netstick. What chip does it use? Because, you can look for a more linux-friendly driver if your hardware supports it (that would require a little bit of luck in your case, but let's keep the faith for a while, ok?)


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#9 2009-01-21 00:50:39

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

It's a TNETW1450 chip. There's an open source project which tries to create a driver for that chip (http://acx100.sourceforge.net) but there doesn't seem to be a lot of activity lately. AVM released a linux driver for that stick but they seem to have quit the work on it and it doesn't compile when using newer kernel versions. I saw an alternative windows driver on the ubuntu wiki but that also didn't work for me.

The stick works in two modes. When you plug it in it works as a removeable drive. After a few seconds it converts to a WLAN stick. The system seems to freeze when it converts to WLAN mode (I've unplugged the stick before suspend, then resumed and then plugged the stick in, the LED flashes when it changes mode and that's when the freeze happened).

Well I think that's far beyond the scope I'm able to debug.

Bad luck...

Offline

#10 2009-01-21 02:09:56

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

ndiswrapper has a debug mode. Look for it. I don't remember exactly how you should load ndiswrapper to engange this mode.


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#11 2009-01-23 00:59:44

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

I give up. Either I've compiled it the wrong way, looked at the wrong place or ndiswrapper doesn't give a lot of debug information, I didn't find anything interesting. I tried to recompile the kernel with pm debug information and tuxonice enabled. But it didn't work with tuxonice also. I was playing with the suspend stuff on my desktop computer too. At least suspend to disk works there (both computers are pretty old, I wonder if the suspend stuff works better for newer computers). In the hibernate script from tuxonice I saw that the via_rhine driver is known for causing troubles also, so I deactivated it too. Didn't change anything. I skipped the kernel pm debug part. Enough time spent on this subject. Seems I have to live with the fact that I can't suspend and resume my laptop when using my USB WLAN stick. There are worse things in the world than that. smile

Offline

#12 2009-01-30 01:06:36

bwh1969
Member
Registered: 2008-01-05
Posts: 151

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

If you are willing to spend 20 bucks, you can install zd1211-firmware and run this stick with "native" support and my machine suspends and wakes with it.

http://www.amazon.com/Airlink101-AWLL30 … 10&sr=8-12

I actually have 2... don't ask.  Ubuntu supports it natively and Arch has the "source" for it.  Just install the package and reboot.  I could not for the life of me to get it to work until I rebooted.  I didn't know what to modprobe exactly but it was taken care of upon boot with the stick in.

Offline

#13 2009-01-30 01:47:18

BertiBoeller
Member
Registered: 2009-01-19
Posts: 58

Re: pm-utils+ndiswrapper+Fritz! WLAN USB stick = freeze after wakeup

Thank you for your reply.

I think you're right that it would be the best to just go for a stick which is supported by linux natively (If I remember correctly the prism and atheros chips are used for USB WLAN devices and supported natively). But I don't really need the notebook that much neither the S2R or the S2D features. It just would have been nice to get it to work and find a solution for the problem so that others can avoid the trouble.

Offline

Board footer

Powered by FluxBB