# [Solved] Q: WiFi Disconnects When Lid Is Closed

## solamour

When I close my laptop's lid, the WiFi disconnects. When I open the lid, WiFi resumes. I'm fairly sure it's just the WiFi (i.e. laptop isn't suspended), because if I do something like the following, the timer keeps going even the lid is closed.

```
while :; do date; sleep 1; done
```

So, how do I prevent the WiFi from going to sleep when the lid is closed?

__

solLast edited by solamour on Wed Apr 29, 2015 5:24 am; edited 1 time in total

----------

## dmpogo

 *solamour wrote:*   

> When I close my laptop's lid, the WiFi disconnects. When I open the lid, WiFi resumes. I'm fairly sure it's just the WiFi (i.e. laptop isn't suspended), because if I do something like the following, the timer keeps going even the lid is closed.
> 
> ```
> while :; do date; sleep 1; done
> ```
> ...

 

Well you need to find out who controls the action on lid closure - probably your desktop environment

----------

## solamour

 *dmpogo wrote:*   

> Well you need to find out who controls the action on lid closure - probably your desktop environment

 

See, that's what I thought initially, but I'm not using any desktops; it's just console-based, and I noticed the problem even without X running at all.

__

sol

----------

## The Doctor

Did you check the bios? I don't think any of my 3 laptops ever had any response to their lid closing under Gentoo. It might be a hardware "feature." I wouldn't put it past an engineer to think that any power save=good.

----------

## dmpogo

 *solamour wrote:*   

>  *dmpogo wrote:*   Well you need to find out who controls the action on lid closure - probably your desktop environment 
> 
> See, that's what I thought initially, but I'm not using any desktops; it's just console-based, and I noticed the problem even without X running at all.
> 
> __
> ...

 

Im my case I have a custom acpid script that captures lid event and does something that I want.   But even if you run acpid, I don't think that default event handler explcitly link lid to depowering radios.   So it maybe happening at hardware (or bios) level. Check your bios settings

----------

## solamour

It turned out the way laptop's antenna is designed. When the lid is closed, (I think) the WiFi antenna isn't working optimally, so if I'm a little far from the access point, WiFi loses the connection. When I move the laptop close to the access point, WiFi keeps working even with the lid closed. Thanks everyone for taking time to respond.

__

sol

----------

## dmpogo

 *solamour wrote:*   

> It turned out the way laptop's antenna is designed. When the lid is closed, (I think) the WiFi antenna isn't working optimally, so if I'm a little far from the access point, WiFi loses the connection. When I move the laptop close to the access point, WiFi keeps working even with the lid closed. Thanks everyone for taking time to respond.
> 
> __
> 
> sol

 

Perhaps antenna is in the lid, and so  it is just the geometry of it lyng flat ?   What if you put closed laptop veritcally, will result change ?

----------

## dmpogo

 *solamour wrote:*   

> It turned out the way laptop's antenna is designed. When the lid is closed, (I think) the WiFi antenna isn't working optimally, so if I'm a little far from the access point, WiFi loses the connection. When I move the laptop close to the access point, WiFi keeps working even with the lid closed. Thanks everyone for taking time to respond.
> 
> __
> 
> sol

 

Also, since your laptop is running, perhaps if you can have wired connection as well, you could ssh into it and see what wireless is doing while lid is closed.

----------

## solamour

 *dmpogo wrote:*   

> Perhaps antenna is in the lid, and so  it is just the geometry of it lyng flat ?   What if you put closed laptop veritcally, will result change ?

 

If I'm not right next to the AP and the lid is closed, WiFi is off no matter how I hold the laptop. I was hoping it would make a difference, but it didn't.

__

sol

----------

## solamour

 *dmpogo wrote:*   

> Also, since your laptop is running, perhaps if you can have wired connection as well, you could ssh into it and see what wireless is doing while lid is closed.

 

When WiFi is up and running, this is the output of ifconfig.

```
wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.4  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::d324:d86:6f38:ecb8  prefixlen 64  scopeid 0x20<link>

        ether 70:18:8b:d8:ec:41  txqueuelen 1000  (Ethernet)

        RX packets 488  bytes 45327 (44.2 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 58  bytes 7690 (7.5 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

But when I close the lid, WiFi loses the connection. It comes back shortly after I open the lid.

```
wlo1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        inet6 fe80::d324:d86:6f38:ecb8  prefixlen 64  scopeid 0x20<link>

        ether 70:18:8b:d8:ec:41  txqueuelen 1000  (Ethernet)

        RX packets 488  bytes 45327 (44.2 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 59  bytes 7780 (7.5 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

Let me know if there is any other commands I should run to see what's happening.

__

sol

----------

## abduct

My HP envy 1130us has the same situation, although it seems that no matter how close to the AP I am it shuts off.

I think it has something to do with RF kill switch, since the LED indicating the state of the wireless card changes to the OFF color and when the lid opens changes back after 2-3 seconds.

Happens with kernel 3.2.65 and 3.18.9.

----------

## solamour

As for my case, rfkill shows nothing is blocked when the lid is closed.

```

# rfkill list

0: phy0: Wireless LAN

        Soft blocked: no

        Hard blocked: no
```

It does feel somewhat strange, because when I *almost* close the lid (and leave just enough gap for my finger to hold the lid), WiFi is up and running. But WiFi goes off the moment I close the lid completely, as if it's waiting for me.

__

sol

----------

## abduct

I just ran some tests on my laptop and I guess my problem wasn't actually a problem. The wifi keeps on working, it just changes the STATE LED on the wifi button different colors when you open/close the lid which is no big deal.

Have you tried looking at the logs of "iwconfig" while opening/closing the lid?

Maybe it has something to do with power saving of the specific device. ""iwconfig wlan0 power off"

----------

## solamour

Not sure it's relevant, but here is the output. Perhaps I should try different commands (suggestions, please).

```
# iwconfig wlo1 power on

Error for wireless request "Set Power Management" (8B2D) :

    GET failed on device wlo1 ; Operation not supported.

```

__

sol

----------

