Merge tag 'dey-2.2-r3.3' into dey-2.2/master

Manually changed recipes to use the master branches instead of the
fixed SHA1 from the last release.

Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
Jose Diaz de Grenu 2017-12-21 13:21:05 +01:00
commit 1850f74ddd
6 changed files with 149 additions and 116 deletions

176
README.md
View File

@ -19,40 +19,45 @@ OS versions:
# Supported Platforms # Supported Platforms
The current release supports the following hardware platforms:
Software for the following hardware platforms is in production support: Software for the following hardware platforms is in production support:
* Digi ConnectCore 6UL ## ConnectCore 6UL
* [Digi P/N CC-WMX-JN58-NE](http://www.digi.com/products/models/cc-wmx-jn58-ne) * ConnectCore 6UL System-on-Module (SOM)
* [Digi P/N CC-MX-JN58-Z1](https://www.digi.com/products/models/cc-mx-jn58-z1) * [CC-WMX-JN58-NE](https://www.digi.com/products/models/cc-wmx-jn58-ne)
* Digi P/N CC-WMX-JN7A-NE * [CC-MX-JN58-Z1](https://www.digi.com/products/models/cc-mx-jn58-z1)
* Digi ConnectCore 6UL SBC Express * CC-WMX-JN7A-NE
* [Digi P/N CC-WMX6UL-START](http://www.digi.com/products/models/cc-wmx6ul-start) ([Get Started](https://www.digi.com/resources/documentation/digidocs/90001548/default.htm#concept/yocto/c_get_started_with_yocto.htm)) * ConnectCore 6UL SBC Express
* Digi ConnectCore 6UL SBC Pro * [CC-WMX6UL-START](https://www.digi.com/products/models/cc-wmx6ul-start) ([Get Started](https://www.digi.com/resources/documentation/digidocs/90001548/default.htm#concept/yocto/c_get_started_with_yocto.htm))
* [Digi P/N CC-WMX6UL-KIT](https://www.digi.com/products/models/cc-wmx6ul-kit) ([Get Started](https://www.digi.com/resources/documentation/digidocs/90001547/default.htm#concept/yocto/c_get_started_with_yocto.htm)) * [CC-SBE-WMX-JN58](https://www.digi.com/products/models/cc-sbe-wmx-jn58)
* ConnectCore 6UL SBC Pro
* [CC-WMX6UL-KIT](https://www.digi.com/products/models/cc-wmx6ul-kit) ([Get Started](https://www.digi.com/resources/documentation/digidocs/90001547/default.htm#concept/yocto/c_get_started_with_yocto.htm))
* [CC-SBP-WMX-JN58](https://www.digi.com/products/models/cc-sbp-wmx-jn58)
* Digi ConnectCore 6 ## ConnectCore 6
* [Digi P/N CC-WMX-J97C-TN](http://www.digi.com/products/models/cc-wmx-j97c-tn) * ConnectCore 6 System-on-Module (SOM)
* [Digi P/N CC-WMX-L96C-TE](http://www.digi.com/products/models/cc-wmx-l96c-te) * [CC-WMX-J97C-TN](https://www.digi.com/products/models/cc-wmx-j97c-tn)
* [Digi P/N CC-WMX-L87C-TE](http://www.digi.com/products/models/cc-wmx-l87c-te) * [CC-WMX-L96C-TE](https://www.digi.com/products/models/cc-wmx-l96c-te)
* [Digi P/N CC-MX-L76C-Z1](http://www.digi.com/products/models/cc-mx-l76c-z1) * [CC-WMX-L87C-TE](https://www.digi.com/products/models/cc-wmx-l87c-te)
* [Digi P/N CC-MX-L86C-Z1](http://www.digi.com/products/models/cc-mx-l86c-z1) * [CC-MX-L76C-Z1](https://www.digi.com/products/models/cc-mx-l76c-z1)
* [Digi P/N CC-MX-L96C-Z1](http://www.digi.com/products/models/cc-mx-l96c-z1) * [CC-MX-L86C-Z1](https://www.digi.com/products/models/cc-mx-l86c-z1)
* [Digi P/N CC-WMX-L76C-TE](http://www.digi.com/products/models/cc-wmx-l76c-te) * [CC-MX-L96C-Z1](https://www.digi.com/products/models/cc-mx-l96c-z1)
* Digi P/N CC-WMX-K87C-FJA * [CC-WMX-L76C-TE](https://www.digi.com/products/models/cc-wmx-l76c-te)
* Digi P/N CC-WMX-K77C-TE * CC-WMX-K87C-FJA
* Digi P/N CC-WMX-L97D-TN * CC-WMX-K77C-TE
* Digi P/N CC-WMX-J98C-FJA * CC-WMX-L97D-TN
* Digi P/N CC-WMX-J98C-FJA-1 * CC-WMX-J98C-FJA
* CC-WMX-J98C-FJA-1
* ConnectCore 6 SBC
* [CC-WMX6-KIT](https://www.digi.com/products/models/cc-wmx6-kit) ([Get Started](https://www.digi.com/resources/documentation/digidocs/90001546/default.htm#concept/yocto/c_get_started_with_yocto.htm))
* [CC-SB-WMX-J97C-1](https://www.digi.com/products/models/cc-sb-wmx-j97c-1)
* [CC-SB-WMX-L87C-1](https://www.digi.com/products/models/cc-sb-wmx-l87c-1)
* [CC-SB-WMX-L76C-1](https://www.digi.com/products/models/cc-sb-wmx-l76c-1)
* Digi ConnectCore 6 Development Kit ## ConnectCore 6 Plus
* [Digi P/N CC-WMX6-KIT](http://www.digi.com/products/models/cc-wmx6-kit) ([Get Started](https://www.digi.com/resources/documentation/digidocs/90001546/default.htm#concept/yocto/c_get_started_with_yocto.htm)) * ConnectCore 6 Plus System-on-Module (SOM)
* CC-WMX-KK8D-TN
* Digi ConnectCore 6 SBC * ConnectCore 6 Plus SBC
* [Digi P/N CC-SB-WMX-J97C-1](http://www.digi.com/products/models/cc-sb-wmx-j97c-1) * CC-SB-WMX-KK8D
* [Digi P/N CC-SB-WMX-L87C-1](https://www.digi.com/products/models/cc-sb-wmx-l87c-1)
* [Digi P/N CC-SB-WMX-L76C-1](https://www.digi.com/products/models/cc-sb-wmx-l76c-1)
Previous versions of Digi Embedded Yocto include support for additional Digi Previous versions of Digi Embedded Yocto include support for additional Digi
hardware. hardware.
@ -68,14 +73,15 @@ To install, please follow the instructions at the dey-manifest [README](https://
Documentation is available online on the Digi documentation site: Documentation is available online on the Digi documentation site:
* [Digi ConnectCore 6UL SBC Express](https://www.digi.com/resources/documentation/digidocs/90001548/default.htm) * [ConnectCore 6UL SBC Express](https://www.digi.com/resources/documentation/digidocs/90001548/default.htm)
* [Digi ConnectCore 6UL SBC Pro](https://www.digi.com/resources/documentation/digidocs/90001547/default.htm) * [ConnectCore 6UL SBC Pro](https://www.digi.com/resources/documentation/digidocs/90001547/default.htm)
* [Digi ConnectCore 6 Jumpstart Development Kit](https://www.digi.com/resources/documentation/digidocs/90001546/default.htm) * [ConnectCore 6 SBC](https://www.digi.com/resources/documentation/digidocs/90001546/default.htm)
* [ConnectCore 6 Plus SBC](https://www.digi.com/resources/documentation/digidocs/90002275/default.htm)
# Downloads # Downloads
* Demo images: ftp://ftp1.digi.com/support/digiembeddedyocto/2.2/r2/images/ * Demo images: ftp://ftp1.digi.com/support/digiembeddedyocto/2.2/r3/images/
* Software Development Kit (SDK): ftp://ftp1.digi.com/support/digiembeddedyocto/2.2/r2/sdk/ * Software Development Kit (SDK): ftp://ftp1.digi.com/support/digiembeddedyocto/2.2/r3/sdk/
# Release Changelog # Release Changelog
@ -85,6 +91,8 @@ Documentation is available online on the Digi documentation site:
## 2.2-r3 ## 2.2-r3
* Added support for ConnectCore 6 Plus platform
* Updated kernel version to v4.9 for ConnectCore 6UL platform
* Added Digi APIX C library to access and manage ConnectCore platforms interfaces: * Added Digi APIX C library to access and manage ConnectCore platforms interfaces:
* ADC * ADC
* GPIO * GPIO
@ -92,14 +100,33 @@ Documentation is available online on the Digi documentation site:
* PWM * PWM
* SPI * SPI
* Updated AWS Greengrass Core software to v1.1.0 * Updated AWS Greengrass Core software to v1.1.0
======= * Updated TrustFence Code Signing Tool to v2.3.3
* Default rootfs images are now Eclipse debug ready
* Updated documentation
## 2.2-r2 ## 2.2-r2
* Fix for KRACK Attack vulnerability:
* [CVE-2017-13077](https://nvd.nist.gov/vuln/detail/CVE-2017-13077)
* [CVE-2017-13078](https://nvd.nist.gov/vuln/detail/CVE-2017-13078)
* [CVE-2017-13079](https://nvd.nist.gov/vuln/detail/CVE-2017-13079)
* [CVE-2017-13080](https://nvd.nist.gov/vuln/detail/CVE-2017-13080)
* [CVE-2017-13081](https://nvd.nist.gov/vuln/detail/CVE-2017-13081)
* [CVE-2017-13082](https://nvd.nist.gov/vuln/detail/CVE-2017-13082)
* [CVE-2017-13086](https://nvd.nist.gov/vuln/detail/CVE-2017-13086)
* [CVE-2017-13087](https://nvd.nist.gov/vuln/detail/CVE-2017-13087)
* [CVE-2017-13088](https://nvd.nist.gov/vuln/detail/CVE-2017-13088)
* Cloud Connector: fix connections through PPP
* Use NetworkManager for ethernet, wireless (station) and cellular network interfaces * Use NetworkManager for ethernet, wireless (station) and cellular network interfaces
* Updated kernel version to v4.1.41 for CC6 platform * Updated kernel version to v4.1.41 for CC6 platform
* Added support for SPI Slave mode on CC6UL platform * Added support for SPI Slave mode on CC6UL platform
* Added support for Atmel Cryptochip ATEC508A using Cryptoauthlib * Added support for Atmel Cryptochip ATEC508A using Cryptoauthlib
* Network failover mechanism * Network failover mechanism
* Raspberry Pi Sense hat Yocto support using meta-digi-maker layer for CC6UL SBC Express
* QT fonts fix
* QT software renderer for CC6UL
* Fix for CVE-2017-1000251 vulnerability (https://nvd.nist.gov/vuln/detail/CVE-2017-1000251)
* RS-485 kernel patches
* Powered by AWS certified on all supported hardware platforms including: * Powered by AWS certified on all supported hardware platforms including:
* AWS GreenGrass core software * AWS GreenGrass core software
* AWS IoT Device SDK for embedded C * AWS IoT Device SDK for embedded C
@ -156,51 +183,60 @@ boot a signed U-Boot only.
devices (ConnectCore 6UL and ConnectCore 6 Plus) running a 4.9 kernel devices (ConnectCore 6UL and ConnectCore 6 Plus) running a 4.9 kernel
version fail to join to autonomous groups. version fail to join to autonomous groups.
## Digi ConnectCore 6UL ## ConnectCore 6UL
* The UART connected to the Bluetooth chip on early versions of the ConnectCore * ConnectCore 6UL System-on-Module (SOM)
6UL system-on-module (hardware version < 4) cannot properly execute flow * The UART connected to the Bluetooth chip on early versions of the ConnectCore
control. To work around this issue, UART1 of these SOM versions has been 6UL system-on-module (hardware version < 4) cannot properly execute flow
configured to operate at 115200 bps and without hardware flow control, control. To work around this issue, UART1 of these SOM versions has been
reducing the maximum throughput of this interface. configured to operate at 115200 bps and without hardware flow control,
* When using wireless concurrent mode as the wireless interface is shared reducing the maximum throughput of this interface.
between several different functionalities performance is reduced. * When using wireless concurrent mode as the wireless interface is shared
* When using wireless concurrent mode Digi recommends to keep the different between several different functionalities performance is reduced.
modes on the same frequency channels. For example, when configuring access * When using wireless concurrent mode Digi recommends to keep the different
point mode on channel 36 on band A, the recommendation would be to connect modes on the same frequency channels. For example, when configuring access
to the same channel both in station mode and WiFi direct so that the radio point mode on channel 36 on band A, the recommendation would be to connect
performance is optimized to the same channel both in station mode and WiFi direct so that the radio
* When working as an access point, DFS capable channels in band A are not performance is optimized.
currently supported. * When working as an access point, DFS capable channels in band A are not
* The QCA6564 wireless chip does not support Wake On Wireless LAN currently supported.
* The QCA6564 wireless chip does not support Wake On Wireless LAN.
## Digi ConnectCore 6 ## ConnectCore 6
* NXP i.MX6 processor has a documented errata (ERR004512) whereby the maximum * ConnectCore 6 System-on-Module (SOM)
performance of the Gigabit FEC is limited to 400Mbps (total for Tx and Rx) * NXP i.MX6 processor has a documented errata (ERR004512) whereby the maximum
* When using softAP mode on Band A on the Qualcomm AR6233, channels used for performance of the Gigabit FEC is limited to 400Mbps (total for Tx and Rx).
Dynamic Frequency Selection (DFS) are not supported * When using softAP mode on Band A on the Qualcomm AR6233, channels used for
* The Qualcomm AR6233 firmware does not support the following configuration Dynamic Frequency Selection (DFS) are not supported.
modes: * The Qualcomm AR6233 firmware does not support the following configuration
* Concurrent modes involving P2P mode, such as P2P + softAP or P2P + STA modes:
* Bluetooth + softAP + STA concurrent mode * Concurrent modes involving P2P mode, such as P2P + softAP or P2P + STA.
* A maximum of five clients are supported when using Qualcomm's AR6233 in * Bluetooth + softAP + STA concurrent mode.
softAP mode * A maximum of five clients are supported when using Qualcomm's AR6233 in
* A maximum of ten connected devices are supported when using Qualcomm's AR6233 softAP mode.
Bluetooth Low Energy mode * A maximum of ten connected devices are supported when using Qualcomm's AR6233
Bluetooth Low Energy mode.
* ConnectCore 6 SBC
* The Micrel PHY KSZ9031 may take between five and six seconds to
auto-negotiate with Gigabit switches.
## Digi ConnectCore 6 SBC ## ConnectCore 6 Plus
* The Micrel PHY KSZ9031 may take between five and six seconds to * ConnectCore 6 Plus System-on-Module (SOM)
auto-negotiate with Gigabit switches * NXP i.MX6QP processor has a documented errata (ERR004512) whereby the maximum
performance of the Gigabit FEC is limited to 400Mbps (total for Tx and Rx).
* ConnectCore 6 Plus SBC
* The Micrel PHY KSZ9031 may take between five and six seconds to
auto-negotiate with Gigabit switches.
# Support Contact Information # Support Contact Information
For support questions please contact Digi Technical Support: For support questions please contact Digi Technical Support:
* [Enterprise Support](https://mydigi.secure.force.com/customers/) * [Enterprise Support](https://mydigi.secure.force.com/customers/)
* [Product Technical Support](http://www.digi.com/support/product-support) * [Product Technical Support](https://www.digi.com/support#support-tools)
* [Support forum](http://www.digi.com/support/forum/) * [Support forum](https://www.digi.com/support/forum/)
When you contact Digi Technical Support, include important system details and When you contact Digi Technical Support, include important system details and
device information to help Digi resolve the issue more quickly. device information to help Digi resolve the issue more quickly.

View File

@ -48,11 +48,17 @@ bluetooth_init() {
# Start the Bluetooth driver and bring up the interface # Start the Bluetooth driver and bring up the interface
HCIATTACH_LOG="/var/log/hciattach.log" HCIATTACH_LOG="/var/log/hciattach.log"
killproc hciattach
powercycle_gpio "${BT_EN_QCA_GPIO_NR}" for RETRY in $(seq 1 5)
if ! hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then do
BT_ERROR="FAIL (hciattach)" killproc hciattach
fi powercycle_gpio "${BT_EN_QCA_GPIO_NR}"
if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then
return
fi
sleep 1
done
BT_ERROR="FAIL (hciattach)"
} }
# Source function library # Source function library

View File

@ -67,11 +67,17 @@ bluetooth_init() {
# Start the Bluetooth driver and bring up the interface # Start the Bluetooth driver and bring up the interface
HCIATTACH_LOG="/var/log/hciattach.log" HCIATTACH_LOG="/var/log/hciattach.log"
killproc hciattach
powercycle_gpio "${BT_EN_QCA_GPIO_NR}" for RETRY in $(seq 1 5)
if ! hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then do
BT_ERROR="FAIL (hciattach)" killproc hciattach
fi powercycle_gpio "${BT_EN_QCA_GPIO_NR}"
if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then
return
fi
sleep 1
done
BT_ERROR="FAIL (hciattach)"
} }
# Source function library # Source function library

View File

@ -22,6 +22,7 @@ lockfd="9"
BT_INIT="/etc/init.d/bluetooth-init" BT_INIT="/etc/init.d/bluetooth-init"
BT_DAEMON="/etc/init.d/bluetooth" BT_DAEMON="/etc/init.d/bluetooth"
NM_DAEMON="/etc/init.d/networkmanager"
usage() { usage() {
printf "\nSuspend system to RAM memory\n" printf "\nSuspend system to RAM memory\n"
@ -31,18 +32,14 @@ usage() {
} }
suspend_interfaces() { suspend_interfaces() {
# Stop NetworkManager before suspend
${NM_DAEMON} stop
# Suspend wireless interfaces # Suspend wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then if [ -d "/proc/device-tree/wireless" ]; then
for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do
ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}"
done done
# Get a list of the wireless interfaces managed by NetworkManager
# and set them to unmanaged before suspend.
for i in $(nmcli -t -f DEVICE,TYPE,STATE dev | grep :wifi: | grep -v unmanaged | cut -d':' -f1); do
nmcli dev set "${i}" managed no && NM_MANAGED_IFACES="${NM_MANAGED_IFACES:+${NM_MANAGED_IFACES} }${i}"
done
grep -qs '^wlan' /proc/modules && rmmod wlan grep -qs '^wlan' /proc/modules && rmmod wlan
fi fi
@ -61,17 +58,15 @@ resume_interfaces() {
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A" udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A"
timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Set interfaces managed by NetworkManager back as managed
for i in $(echo ${NM_MANAGED_IFACES} | tr ' ' '\n' | sort); do
nmcli dev set "${i}" managed yes
done
# Bring up the interfaces that were bring down on suspend # Bring up the interfaces that were bring down on suspend
for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do
grep -qs "^${i}" /var/run/ifstate || ifup "${i}" grep -qs "^${i}" /var/run/ifstate || ifup "${i}"
done done
fi fi
# Resume NetworkManager after suspend
${NM_DAEMON} start
# Resume bluetooth interface # Resume bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then if [ -d "/proc/device-tree/bluetooth" ]; then
if [ -n "${up_bt_on_resume}" ]; then if [ -n "${up_bt_on_resume}" ]; then

View File

@ -22,6 +22,7 @@ lockfd="9"
BT_INIT="/etc/init.d/bluetooth-init" BT_INIT="/etc/init.d/bluetooth-init"
BT_DAEMON="/etc/init.d/bluetooth" BT_DAEMON="/etc/init.d/bluetooth"
NM_DAEMON="/etc/init.d/networkmanager"
usage() { usage() {
printf "\nSuspend system to RAM memory\n" printf "\nSuspend system to RAM memory\n"
@ -31,18 +32,14 @@ usage() {
} }
suspend_interfaces() { suspend_interfaces() {
# Stop NetworkManager before suspend
${NM_DAEMON} stop
# Suspend wireless interfaces # Suspend wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then if [ -d "/proc/device-tree/wireless" ]; then
for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do
ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}"
done done
# Get a list of the wireless interfaces managed by NetworkManager
# and set them to unmanaged before suspend.
for i in $(nmcli -t -f DEVICE,TYPE,STATE dev | grep :wifi: | grep -v unmanaged | cut -d':' -f1); do
nmcli dev set "${i}" managed no && NM_MANAGED_IFACES="${NM_MANAGED_IFACES:+${NM_MANAGED_IFACES} }${i}"
done
grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core
fi fi
@ -61,11 +58,6 @@ resume_interfaces() {
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0301" udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0301"
timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Set interfaces managed by NetworkManager back as managed
for i in $(echo ${NM_MANAGED_IFACES} | tr ' ' '\n' | sort); do
nmcli dev set "${i}" managed yes
done
# Bring up the interfaces that were bring down on suspend # Bring up the interfaces that were bring down on suspend
for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do
grep -qs "^${i}" /var/run/ifstate || ifup "${i}" grep -qs "^${i}" /var/run/ifstate || ifup "${i}"
@ -79,6 +71,9 @@ resume_interfaces() {
${BT_DAEMON} start >/dev/null ${BT_DAEMON} start >/dev/null
fi fi
fi fi
# Resume NetworkManager after suspend
${NM_DAEMON} start
} }
enter_critical_section() { enter_critical_section() {

View File

@ -22,6 +22,7 @@ lockfd="9"
BT_INIT="/etc/init.d/bluetooth-init" BT_INIT="/etc/init.d/bluetooth-init"
BT_DAEMON="/etc/init.d/bluetooth" BT_DAEMON="/etc/init.d/bluetooth"
NM_DAEMON="/etc/init.d/networkmanager"
usage() { usage() {
printf "\nSuspend system to RAM memory\n" printf "\nSuspend system to RAM memory\n"
@ -31,18 +32,14 @@ usage() {
} }
suspend_interfaces() { suspend_interfaces() {
# Stop NetworkManager before suspend
${NM_DAEMON} stop
# Suspend wireless interfaces # Suspend wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then if [ -d "/proc/device-tree/wireless" ]; then
for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do
ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}"
done done
# Get a list of the wireless interfaces managed by NetworkManager
# and set them to unmanaged before suspend.
for i in $(nmcli -t -f DEVICE,TYPE,STATE dev | grep :wifi: | grep -v unmanaged | cut -d':' -f1); do
nmcli dev set "${i}" managed no && NM_MANAGED_IFACES="${NM_MANAGED_IFACES:+${NM_MANAGED_IFACES} }${i}"
done
grep -qs '^wlan' /proc/modules && rmmod wlan grep -qs '^wlan' /proc/modules && rmmod wlan
fi fi
@ -61,11 +58,6 @@ resume_interfaces() {
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A" udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A"
timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Set interfaces managed by NetworkManager back as managed
for i in $(echo ${NM_MANAGED_IFACES} | tr ' ' '\n' | sort); do
nmcli dev set "${i}" managed yes
done
# Bring up the interfaces that were bring down on suspend # Bring up the interfaces that were bring down on suspend
for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do
grep -qs "^${i}" /var/run/ifstate || ifup "${i}" grep -qs "^${i}" /var/run/ifstate || ifup "${i}"
@ -79,6 +71,9 @@ resume_interfaces() {
${BT_DAEMON} start >/dev/null ${BT_DAEMON} start >/dev/null
fi fi
fi fi
# Resume NetworkManager after suspend
${NM_DAEMON} start
} }
enter_critical_section() { enter_critical_section() {