# Loss of connection to AirVantage - only reboot works

**URL:** <https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651>\
**Category:** Legato Application Framework\
**Created:** [November 30, 2023, 3:51pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651 "2023-11-30T15:51:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [November 30, 2023, 3:51pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/1 "2023-11-30T15:51:42Z")

</div>

After about a day of my WP7601-1 running, the connection to AirVantage is lost and cant be recovered unless I reboot the module.

When looking at logread -F, there appears to be the following output stating about some kind of sleep mode? Can anyone confirm if this is normal behavior?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/8/880535d6d9ca92520be9957ada1c399b90f8c70f.png)

I have also checked for the possibility of some kind of sleep mode.

I checked the AT command AT+CSPSM and the result was 0, indicating no sleep mode was active.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 30, 2023, 4:03pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/2 "2023-11-30T16:03:08Z")

</div>

do you mean you want to keep module waking up?  
If yes, you can try this:  
`echo NO_SLEEP > /sys/power/wake_lock`

---

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [November 30, 2023, 4:08pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/3 "2023-11-30T16:08:54Z")

</div>

I would like to make sure any sleep modes are not enabled.

Thank you, I will try this.

---

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [November 30, 2023, 4:09pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/4 "2023-11-30T16:09:55Z")

</div>

> [@jyijyi](#):
>
> NO\_SLEEP \> /sys/power/wake\_lock

Looks like I was able to set it. I will let you know how it goes

![image](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/6/6a801a8cf3d02e78b748019f6fb672815e7c0a07.png)

---

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [November 30, 2023, 4:29pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/5 "2023-11-30T16:29:05Z")

</div>

It looks like when I reboot the module, the setting is not saved. Is this correct?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/c/cf7b5e466cc2506daf5adcc93d08ccff0ad4e4aa.png)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 30, 2023, 4:41pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/6 "2023-11-30T16:41:08Z")

</div>

yes, you need to enter this every boot up

---

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [November 30, 2023, 5:18pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/7 "2023-11-30T17:18:04Z")

</div>

> [@jyijyi](#):
>
> echo NO\_SLEEP \> /sys/power/wake\_lock

Could this be implemented in a legato application so this command will run automatically during the init phase of my legato application?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 30, 2023, 6:03pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/8 "2023-11-30T18:03:51Z")

</div>

Yes, you can run script in legato application

> [@Invoking shell scripts from Legato app](https://forum.legato.io/t/invoking-shell-scripts-from-legato-app/5575/4):
>
> I don’t see problem on WP76 FW R13. You can use my hello6.tar.gz. [hello6.tar.gz](https://forum.legato.io/uploads/short-url/czj2K4NaAp4M02tLAjqZGY8p95w.gz) (314.7 KB) root@swi-mdm9x28-wp:~# chmod 777 /tmp/test.sh root@swi-mdm9x28-wp:~# /tmp/test.sh root@swi-mdm9x28-wp:~# ls /tmp/123.txt /tmp/123.txt root@swi-mdm9x28-wp:~# cat /tmp/123.txt 123 root@swi-mdm9x28-wp:~# rm /tmp/123.txt root@swi-mdm9x28-wp:~# ls /tmp/ hello6.wp76xx.update legato test.sh hosts pkgdwl thermal\_engi\_ipc ld.so.cache psm\_socket …

---

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [December 4, 2023, 10:30pm UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/9 "2023-12-04T22:30:12Z")

</div>

> [@jyijyi](#):
>
> echo NO\_SLEEP \> /sys/power/wake\_lock

Hello, I have been struggling with this. I tried the legato app approach that you shared, and I also tried to create a script under init.d. Both are not working, however when I issue the command from the command line, it works as expected.

This is telling me there is a permissions issue?

Do you have any suggestions?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [December 5, 2023, 1:39am UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/10 "2023-12-05T01:39:00Z")

</div>

i don’t see problem.  
you can try my script and modify the init script:

```auto

root@fx30:~# cat /home/root/test.sh
sleep 30
echo NO_SLEEP > /sys/power/wake_lock

root@fx30:~# chmod 777 /home/root/test.sh
root@fx30:~#

root@fx30:~# cat /etc/init.d/startlegato.sh
#!/bin/sh
# Copyright (c) Sierra Wireless, Inc.
#
# Provides a hook for legato into the init scripts

if [-e "/etc/run.env"]; then
    source /etc/run.env
fi

FLASH_MOUNTPOINT=${FLASH_MOUNTPOINT:-/mnt/flash}
FLASH_MOUNTPOINT_LEGATO=${FLASH_MOUNTPOINT_LEGATO:-/mnt/legato}

if [-e "${FLASH_MOUNTPOINT_LEGATO}/systems/current/read-only"]
then
    export PATH=/legato/systems/current/bin:$PATH
    LEGATO_START=/legato/systems/current/bin/start
    LEGATO_MNT=${FLASH_MOUNTPOINT_LEGATO}
else
    LEGATO_START=${FLASH_MOUNTPOINT_LEGATO}/start
    LEGATO_MNT=${FLASH_MOUNTPOINT}/legato

    # Create mountpoint in case it doesn't already exists.
    mkdir -p ${LEGATO_MNT}
fi

case "$1" in
    start)
        echo "Legato start sequence"

        umount /legato 2>/dev/null
        mount -o bind $LEGATO_MNT /legato

        test -x $LEGATO_START && $LEGATO_START

#jyi
sh /home/root/test.sh &

        ;;

    stop)
        # Do something to stop Legato
        echo "Legato shutdown sequence"
        test -x $LEGATO_START && $LEGATO_START stop
        umount /legato
        ;;

    *)
        exit 1
        ;;

esac

echo "Finished Legato $1 Sequence"

```

---

<div class="post-metadata">

**Author:** ![kevine](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kevine](https://forum.legato.io/u/kevine)\
**Post date:** [December 5, 2023, 4:14am UTC](https://forum.legato.io/t/loss-of-connection-to-airvantage-only-reboot-works/6651/11 "2023-12-05T04:14:18Z")

</div>

> [@jyijyi](#):
>
> `sh /home/root/test.sh &`

Fantastic, thank you, I was first attempting to use the system() api inside a legato app.

I then tried to write an init.d script separately echoing NO\_SLEEP.

You wrote a script in the home folder, then ran that script from existing startlegato.sh.

This worked for me. Thank you!

the NO\_SLEEP directive is now auto written at startup.
