diff --git a/README.md b/README.md index e4bff0859..71f1e0b8a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Digi Embedded Yocto (DEY) 2.2 -## Release 2.2-r1 +## Release 2.2-r2 This document provides information about Digi Embedded Yocto, Digi International's professional embedded Yocto development environment. @@ -62,6 +62,14 @@ Documentation is available online on the Digi documentation site: # Release Changelog +## 2.2-r2 + +* Digi Embedded Yocto + * Support to connect to AWS IoT with AWS IoT Device SDK for embedded C. + * Added support for Digi XBee Cellular 3G Global, with P/N XBC-M5-UT-001 + * Added support for U-Blox TOBY L-200/L-210 + * Added support for Quectel EC-25 + ## 2.2-r1 * Release based on [Yocto 2.2 (Morty)](https://www.yoctoproject.org/downloads/core/morty22) including: diff --git a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf index 224813415..33664cb87 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf @@ -11,6 +11,15 @@ UBOOT_CONFIG ??= "ccimx6ulsbc1GB ccimx6ulsbc" UBOOT_CONFIG[ccimx6ulsbc1GB] = "ccimx6ulsbc1GB_defconfig" UBOOT_CONFIG[ccimx6ulsbc] = "ccimx6ulsbc_defconfig" +# U-Boot environment offset (within partition) +UBOOT_ENV_OFFSET ?= "0x0" +# U-Boot environment size +UBOOT_ENV_SIZE ?= "0x20000" +# U-Boot environment range: size (in hex) in the environment partition that +# the U-Boot environment can take up (if undefined, it will take up all the +# available space in the environment partition) +UBOOT_ENV_RANGE ?= "" + KERNEL_DEVICETREE ?= " \ imx6ul-ccimx6ulsbc.dtb \ imx6ul-ccimx6ulsbc-wb.dtb \ diff --git a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf index 317b38ee5..f7b95048b 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf @@ -11,6 +11,15 @@ UBOOT_CONFIG ??= "ccimx6ulstarter1GB ccimx6ulstarter" UBOOT_CONFIG[ccimx6ulstarter1GB] = "ccimx6ulstarter1GB_defconfig" UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig" +# U-Boot environment offset (within partition) +UBOOT_ENV_OFFSET ?= "0x0" +# U-Boot environment size +UBOOT_ENV_SIZE ?= "0x20000" +# U-Boot environment range: size (in hex) in the environment partition that +# the U-Boot environment can take up (if undefined, it will take up all the +# available space in the environment partition) +UBOOT_ENV_RANGE ?= "" + KERNEL_DEVICETREE ?= " \ imx6ul-ccimx6ulstarter.dtb \ imx6ul-ccimx6ulstarter-wb.dtb \ diff --git a/meta-digi-arm/conf/machine/include/ccimx6ul.inc b/meta-digi-arm/conf/machine/include/ccimx6ul.inc index a75fcb089..de42135e9 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6ul.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6ul.inc @@ -29,7 +29,7 @@ MACHINE_EXTRA_RDEPENDS += " \ u-boot-fw-utils \ " MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}" -MACHINE_EXTRA_RRECOMMENDS += "imx-alsa-plugins cryptodev-module" +MACHINE_EXTRA_RRECOMMENDS += "imx-alsa-plugins cryptodev-module cryptoauthlib" MACHINE_FEATURES += "wifi bluetooth" diff --git a/meta-digi-arm/conf/machine/include/digi-defaults.inc b/meta-digi-arm/conf/machine/include/digi-defaults.inc index 4decd8251..1780c8ec7 100644 --- a/meta-digi-arm/conf/machine/include/digi-defaults.inc +++ b/meta-digi-arm/conf/machine/include/digi-defaults.inc @@ -11,7 +11,7 @@ PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg" # Platform Linux U-Boot # ------------------------------------------------- # ccardimx28 3.10 2013.01 -# ccimx6 3.14 2015.04 +# ccimx6 4.1, 3.14 2015.04 # ccimx6ul 4.1 2015.04 # diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/fw-4.bin b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/fw-4.bin index 35ebeff32..38a27059c 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/fw-4.bin and b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/fw-4.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb index 6bf486f38..5522fd5fe 100644 --- a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb @@ -14,7 +14,6 @@ FW_QCA6564-BT = " \ FW_QCA6564-WIFI = " \ file://bdwlan30_US.bin \ - file://bdwlan30_World.bin \ file://LICENCE.atheros_firmware \ file://otp30.bin \ file://qwlan30.bin \ @@ -42,7 +41,6 @@ do_install() { install -d ${D}${base_libdir}/firmware install -m 0644 \ bdwlan30_US.bin \ - bdwlan30_World.bin \ LICENCE.atheros_firmware \ otp30.bin \ qwlan30.bin \ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin deleted file mode 100644 index 65f13b87e..000000000 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin and /dev/null differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/cfg.dat b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/cfg.dat deleted file mode 100644 index 3860af48e..000000000 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/cfg.dat and /dev/null differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini deleted file mode 100644 index fd1a774a1..000000000 --- a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini +++ /dev/null @@ -1,373 +0,0 @@ -# This file allows user to override the factory - -# defaults for the WLAN Driver - -# Debug tracing bit values -# VOS tracing requires a debug build - see BUILD_DEBUG_VERSION - -# None = 0 -# Error -# Warn -# Info -# Info high -# Info med -# Info low -# Debug = 7 - -# Debug masks in decimal -# Default debug is Error and Warn 0x06 (6) -# All debug is 0xff (255) - -#vosTraceEnableTL=6 -#vosTraceEnableWDI=6 -#vosTraceEnableHDD=6 -#vosTraceEnableSME=6 -#vosTraceEnablePE=6 -#vosTraceEnablePMC=6 -#vosTraceEnableWDA=6 -#vosTraceEnableSYS=6 -#vosTraceEnableVOSS=6 -#vosTraceEnableSAP=6 -#vosTraceEnableHDDSAP=6 - -# Enable/Disable Idle Scan - -gEnableRxThread=1 - - -# Increase sleep duration (seconds) during IMPS -# 0 implies no periodic wake up from IMPS. Periodic wakeup is -# unnecessary if Idle Scan is disabled. -gImpsModSleepTime=0 - - -# Enable suspend or not - -# 1: Enable standby, 2: Enable Deep sleep, 3: Enable Mcast/Bcast Filter - -gEnableSuspend=3 - - -# Phy Mode (auto, b, g, n, etc) -# Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac -# 1 = 11abg, 2 = 11b, 3 = 11g, 5 = 11g only, 6 = 11n only -# 7 = 11b only 8 = 11ac only. -gDot11Mode=0 - -# CSR Roaming Enable(1) Disable(0) - -gRoamingTime=0 - -# Assigned MAC Addresses - This will be used until NV items are in place - -# Each byte of MAC address is represented in Hex format as XX - -Intf0MacAddress=000AF58989FF -Intf1MacAddress=000AF58989FE -Intf2MacAddress=000AF58989FD - -Intf3MacAddress=000AF58989FC - - -# UAPSD service interval for VO,VI, BE, BK traffic - -InfraUapsdVoSrvIntv=0 - -InfraUapsdViSrvIntv=0 - -InfraUapsdBeSrvIntv=0 - -InfraUapsdBkSrvIntv=0 - -# Flag to allow STA send AddTspec even when ACM is Off -gAddTSWhenACMIsOff=1 - -# Make 1x1 the default antenna configuration - -gNumRxAnt=1 - - -# Beacon filtering frequency (unit in beacon intervals) - -gNthBeaconFilter=50 - - -# Flags to filter Mcast abd Bcast RX packets. - -# Value 0: No filtering, 1: Filter all Multicast. - -# 2: Filter all Broadcast. 3: Filter all Mcast abd Bcast - -McastBcastFilter=3 - - -#Flag to enable HostARPOffload feature or not - -hostArpOffload=1 - -#Flag to enable HostNSOffload feature or not - -hostNSOffload=1 - -#Enable OBSS protection - -gEnableApOBSSProt=1 - - -# RTS threshold - -RTSThreshold=1048576 - - -# DFS Master Capability -gEnableDFSMasterCap=1 - -# fast transition -ImplicitQosIsEnabled=0 - -gNeighborLookupThreshold=76 - -#Check if the AP to which we are roaming is better than current AP in terms of RSSI. -#Checking is disabled if set to Zero.Otherwise it will use this value as to how better -#the RSSI of the new/roamable AP should be for roaming -RoamRssiDiff=3 - -# SAP auto channel selection configuration - -# 0 = disable auto channel selection - -# 1 = enable auto channel selection, channel provided by supplicant will be ignored - -gApAutoChannelSelection=0 - - -# Listen Energy Detect Mode Configuration - -# Valid values 0-128 - -# 128 means disable Energy Detect feature - -# 0-9 are threshold code and 7 is recommended value from system if feature is to be enabled. - -# 10-128 are reserved. - -# The EDET threshold mapping is as follows in 3dB step: - -# 0 = -60 dBm - -# 1 = -63 dBm - -# 2 = -66 dBm - -# ... - -# 7 = -81 dBm - -# 8 = -84 dBm - -# 9 = -87 dBm - -# Note: Any of these settings are valid. Setting 0 would yield the highest power saving (in a noisy environment) at the cost of more range. The range impact is approximately #calculated as: - -# - -# Range Loss (dB) = EDET threshold level (dBm) + 97 dBm. - -# - -gEnablePhyAgcListenMode=128 - - -#SOFTAP Channel Range selection - -gAPChannelSelectStartChannel=1 - -gAPChannelSelectEndChannel=11 - - -#SOFTAP Channel Range selection Operating band - -# 0:2.4GHZ 1: LOW-5GHZ 2:MID-5GHZ 3:HIGH-5GHZ 4: 4.9HZ BAND - -gAPChannelSelectOperatingBand=0 - - -#Channel Bonding -gChannelBondingMode5GHz=1 - - -#Enable Keep alive with non-zero period value - -gStaKeepAlivePeriod = 30 - -#Say gGoKeepAlivePeriod(5 seconds) and gGoLinkMonitorPeriod(10 seconds). -#For every 10 seconds DUT send Qos Null frame(i.e., Keep Alive frame if link is idle for last 10 seconds.) -#For both active and power save clients. - -#Power save clients: DUT set TIM bit from 10th second onwards and till client honors TIM bit. -#If doesn't honor for 5 seconds then DUT remove client. - -#Active clients: DUT send Qos Null frame for 10th seconds onwards if it is not success still we try on -#11th second if not tries on 12th and so on till 15th second. Hence before disconnection DUT will send 5 NULL frames. -#Hence in any case DUT will detect client got removed in (10+5) seconds. i.e., (gGoKeepAlivePeriod + gGoLinkMonitorPeriod).. - -#gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period -#where we send NULL frame. - -#gApLinkMonitorPeriod = 10 - -#gGoLinkMonitorPeriod = 10 - -#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not. -#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod. - - -gGoKeepAlivePeriod = 20 - -gApKeepAlivePeriod = 20 - - -gEnableLogp=1 - - -# 0 for OLPC 1 for CLPC and SCPC -gEnableCloseLoop=1 - -#Data Inactivity Timeout when in powersave (in ms) -gDataInactivityTimeout=200 - -# VHT Tx/Rx MCS values -# Valid values are 0,1,2. If commented out, the default value is 0. -# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9 -gVhtRxMCS=2 -gVhtTxMCS=0 - -# VHT Tx/Rx MCS values for 2x2 -# Valid values are 0,1,2. If commented out, the default value is 0. -# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9 -gEnable2x2=0 -gVhtRxMCS2x2=2 -gVhtTxMCS2x2=2 - -# Set txchainmask and rxchainmask -# These parameters are used only if gEnable2x2 is 0 -# Valid values are 1,2 -# Set gSetTxChainmask1x1=1 or gSetRxChainmask1x1=1 to select chain0. -# Set gSetTxChainmask1x1=2 or gSetRxChainmask1x1=2 to select chain1. -gSetTxChainmask1x1=1 -gSetRxChainmask1x1=1 - -# 1=enable STBC; 0=disable STBC -gEnableRXSTBC=1 - -# 1=enable tx STBC; 0=disable -gEnableTXSTBC=1 - -# 1=enable rx LDPC; 0=disable -gEnableRXLDPC=1 - -#Enable Scan Results Aging based on timer -#Timer value is in seconds -#If Set to 0 it will not enable the feature -gScanAgingTime=0 - -#Enable Scan Results Aging based on number of scans -gScanResultAgeCount=1 - -#Enable thermal mitigation -gThermalMitigationEnable=0 - -#Thermal Mitigation Levels -gThermalTempMinLevel0=0 -gThermalTempMaxLevel0=107 -gThermalTempMinLevel1=105 -gThermalTempMaxLevel1=117 -gThermalTempMinLevel2=110 -gThermalTempMaxLevel2=127 -gThermalTempMinLevel3=115 -gThermalTempMaxLevel3=0 - -#Maxium Channel time in msec -gMaxMediumTime = 6000 - -# 802.11K support -gRrmEnable=1 -gRrmOperChanMax=8 -gRrmNonOperChanMax=8 - -#Scan offload -gEnableDirectedScanOffload=1 - -#Enable Power Save offload -gEnablePowerSaveOffload=1 - -#Enable firmware log -gEnablefwlog=1 - -#P2P Listen offload -gEnableP2pListenOffload=1 - -# Maximum Receive AMPDU size (VHT only. Valid values: 0->8k 1->16k 2->32k 3->64k 4->128k) -gVhtAmpduLenExponent=7 - -# Maximum MPDU length (VHT only. Valid values: 0->3895 octets, 1->7991 octets, 2->11454 octets) -gVhtMpduLen=2 - -# Maximum number of wow filters required -#gMaxWoWFilters=22 - -# WOW Enable/Disable. -# 0 - Disable both magic pattern match and pattern byte match. -# 1 - Enable magic pattern match on all interfaces. -# 2 - Enable pattern byte match on all interfaces. -# 3 - Enable both magic patter and pattern byte match on all interfaces. -# Default value of gEnableWoW is 3. -# gEnableWoW=0 - -#Enable or Disable p2p device address administered -isP2pDeviceAddrAdministrated=0 - -# Set Thermal Power limit -TxPower2g=10 -TxPower5g=10 - -#Enable VHT on 2.4Ghz -gEnableVhtFor24GHzBand=1 - -#Enable or Disable 5G early beacon termination -gEnable5gEBT=1 - -ssdp = 0 - -#Enable Hysteretic mode -gEnableHystereticMode=1 - -# Bus bandwidth compute timeout value in ms -gBusBandwidthComputeInterval=2000 - -# Regulatory Setting; 0=STRICT; 1=CUSTOM -gRegulatoryChangeCountry=1 - -# Enable/Disable RX full reorder offload -gReorderOffloadSupported=1 - -#Set SAP max peer to 16 which allows 10 WEP connection -gSoftApMaxPeers=16 - -# Whether userspace country code setting shld have priority -gCountryCodePriority=1 - -# Enable(1)/Disable(0) SIFS burst -gEnableSifsBurst=1 - -# Enable or Disable Multi-user MIMO -# 1=Enable (default), 0=Disable -gEnableMuBformee=1 - -# Inactivity time (in ms) to end TX Service Period while in IBSS power save mode -gIbssTxSpEndInactivityTime=10 - -END - -# Note: Configuration parser would not read anything past the END marker - diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt index f86ceb43e..8a3c60f95 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt @@ -39,6 +39,8 @@ else setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb elif test "${module_variant}" = "0x13"; then setenv fdt_file uImage-imx6dl-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x14"; then + setenv fdt_file uImage-imx6q-ccimx6sbc.dtb else echo "------ Using default fdt_file" fi diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt index e30726d19..94c49ff4e 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt @@ -23,7 +23,7 @@ fi if test -n "${module_variant}"; then if test "${module_variant}" = "0x12"; then setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx; - elif test "${module_variant}" = "0x02" || test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x11"; then + elif test "${module_variant}" = "0x02" || test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x11" || test "${module_variant}" = "0x14"; then setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx; elif test "${module_variant}" = "0x03" || test "${module_variant}" = "0x0e" || test "${module_variant}" = "0x0f"; then setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-tools-env-factorize-function-to-get-device-type.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-tools-env-factorize-function-to-get-device-type.patch new file mode 100644 index 000000000..48aeb0745 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-tools-env-factorize-function-to-get-device-type.patch @@ -0,0 +1,68 @@ +From: Hector Palacios +Date: Mon, 29 May 2017 11:41:23 +0200 +Subject: [PATCH 1/2] tools: env: factorize function to get device type + +This function may be reused to determine the device type in other helper +functions. + +Signed-off-by: Hector Palacios + +https://jira.digi.com/browse/DUB-741 +--- + tools/env/fw_env.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c +index 1c337b4727a9..08ba0fd1111f 100644 +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -1134,7 +1134,7 @@ static int flash_write (int fd_current, int fd_target, int dev_target) + return 0; + } + +-static int flash_read (int fd) ++static int get_type(int dev, int fd) + { + struct mtd_info_user mtdinfo; + struct stat st; +@@ -1151,7 +1151,7 @@ static int flash_read (int fd) + rc = ioctl(fd, MEMGETINFO, &mtdinfo); + if (rc < 0) { + fprintf(stderr, "Cannot get MTD information for %s\n", +- DEVNAME(dev_current)); ++ DEVNAME(dev)); + return -1; + } + if (mtdinfo.type != MTD_NORFLASH && +@@ -1159,7 +1159,7 @@ static int flash_read (int fd) + mtdinfo.type != MTD_DATAFLASH && + mtdinfo.type != MTD_UBIVOLUME) { + fprintf (stderr, "Unsupported flash type %u on %s\n", +- mtdinfo.type, DEVNAME(dev_current)); ++ mtdinfo.type, DEVNAME(dev)); + return -1; + } + } else { +@@ -1167,10 +1167,20 @@ static int flash_read (int fd) + mtdinfo.type = MTD_ABSENT; + } + +- DEVTYPE(dev_current) = mtdinfo.type; ++ DEVTYPE(dev) = mtdinfo.type; ++ return 0; ++} ++ ++static int flash_read (int fd) ++{ ++ int rc; ++ ++ rc = get_type(dev_current, fd); ++ if (rc < 0) ++ return -1; + + rc = flash_read_buf(dev_current, fd, environment.image, CUR_ENVSIZE, +- DEVOFFSET (dev_current), mtdinfo.type); ++ DEVOFFSET(dev_current), DEVTYPE(dev_current)); + if (rc != CUR_ENVSIZE) + return -1; + diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0005-tools-env-add-support-to-set-dynamic-location-of-env.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0005-tools-env-add-support-to-set-dynamic-location-of-env.patch new file mode 100644 index 000000000..0742e56ac --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0005-tools-env-add-support-to-set-dynamic-location-of-env.patch @@ -0,0 +1,166 @@ +From: Hector Palacios +Date: Mon, 29 May 2017 12:10:10 +0200 +Subject: [PATCH 2/2] tools: env: add support to set dynamic location of + environment copies + +A mechanism was added in U-Boot to set the location of environment copies +dynamically in an shared area. If the config file sets both copies to the +same offset, a function will be called to set the offset of each copy to +the first two good NAND sectors within the specified area. + +The config file should contain the sector size and the number of sectors +of the area, like in this example: + + # Device name Offset Size Erase-size No.Blocks + /dev/mtd1 0x0 0x20000 0x20000 8 + /dev/mtd1 0x0 0x20000 0x20000 8 + +Signed-off-by: Hector Palacios + +https://jira.digi.com/browse/DUB-741 +--- + tools/env/fw_env.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 96 insertions(+), 7 deletions(-) + +diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c +index 08ba0fd1111f..c1a4d89f62c0 100644 +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -122,6 +122,8 @@ static int env_aes_cbc_crypt(char *data, const int enc); + static int caam_encryption_flag; + + static int HaveRedundEnv = 0; ++static int have_dynamic_env; ++static off_t top_of_range; /* end of the last block we may use */ + + static unsigned char active_flag = 1; + /* obsolete_flag must be 0 to efficiently set it on NOR flash without erasing */ +@@ -790,7 +792,6 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count, + 0 on NOR */ + size_t processed = 0; /* progress counter */ + size_t readlen = count; /* current read length */ +- off_t top_of_range; /* end of the last block we may use */ + off_t block_seek; /* offset inside the current block to the start + of the data */ + loff_t blockstart; /* running start of the current block - +@@ -809,12 +810,22 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count, + */ + blocklen = DEVESIZE (dev); + +- /* +- * To calculate the top of the range, we have to use the +- * global DEVOFFSET (dev), which can be different from offset +- */ +- top_of_range = ((DEVOFFSET(dev) / blocklen) + +- ENVSECTORS (dev)) * blocklen; ++ if (!have_dynamic_env) { ++ /* ++ * To calculate the top of the range, we have to use the ++ * global DEVOFFSET (dev), which can be different from ++ * offset ++ */ ++ top_of_range = ((DEVOFFSET(dev) / blocklen) + ++ ENVSECTORS(dev)) * blocklen; ++ } ++ ++ if (offset >= top_of_range) { ++ /* End of range is reached */ ++ fprintf(stderr, ++ "Too few good blocks within range\n"); ++ return -1; ++ } + + /* Limit to one block for the first read */ + if (readlen > blocklen - block_seek) +@@ -1208,6 +1219,72 @@ static int sysfs_mmcboot_set_protection(const char *device, int value) + return 0; + } + ++static int set_dynamic_location(void) ++{ ++ int fd, i, nsectors, type; ++ loff_t offset, blocksize; ++ int dev = 0; ++ int copies = 1; ++ int rc = 0; ++ ++ if (HaveRedundEnv) ++ copies++; ++ ++ fd = open(DEVNAME(dev), O_RDONLY); ++ if (fd < 0) { ++ fprintf(stderr, "Can't open %s: %s\n", DEVNAME(dev), ++ strerror(errno)); ++ rc = -1; ++ goto error; ++ } ++ ++ rc = get_type(dev, fd); ++ if (rc < 0) { ++ fprintf(stderr, "could not get type\n", DEVNAME(dev), ++ strerror(errno)); ++ rc = -1; ++ goto error; ++ } ++ ++ /* Set initial block to start looking for environment */ ++ offset = DEVOFFSET(dev); ++ /* Use variables for common values */ ++ blocksize = DEVESIZE(dev); ++ type = DEVTYPE(dev); ++ /* Look for the number of sectors specified for the primary copy */ ++ nsectors = ENVSECTORS(dev); ++ ++ for (i = 0; i < nsectors && copies; i++) { ++ rc = flash_bad_block(fd, type, &offset); ++ if (rc < 0) { ++ rc = -1; ++ goto error; ++ } else if (!rc) { ++ /* ++ * Set first good block as primary (no matter if it is ++ * the other copy. After all, the 'current' copy is ++ * determined by the active flag. ++ */ ++ DEVOFFSET(dev) = offset; ++ copies--; ++ dev++; ++ } ++ offset += blocksize; ++ } ++ ++ while (copies) { ++ /* No good sectors available. Set offset out of bounds */ ++ DEVOFFSET(dev) = offset; ++ copies--; ++ dev++; ++ } ++ rc = 0; ++ ++error: ++ close(fd); ++ return rc; ++} ++ + static int flash_io (int mode) + { + int fd_current, fd_target, rc, dev_target; +@@ -1341,6 +1418,18 @@ int fw_env_open(void) + environment.data = single->data; + } + ++ /* ++ * Trigger dynamic location of environment if redundant copy has the ++ * same offset than primary copy. ++ */ ++ if (HaveRedundEnv && (DEVOFFSET(0) == DEVOFFSET(1))) { ++ have_dynamic_env = 1; ++ top_of_range = DEVOFFSET(0) + (ENVSECTORS(0) * DEVESIZE(0)); ++ ++ if (set_dynamic_location() < 0) ++ return -1; ++ } ++ + dev_current = 0; + if (flash_io (O_RDONLY)) + return -1; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config index be29acc2f..e31ceca4d 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config @@ -1,7 +1,9 @@ # Configuration file for fw_(printenv/setenv) utility. # Up to two entries are valid, in this case the redundant # environment sector is assumed present. +# If both copies are set to the same offset, an automatic mechanism will +# determine the first good sectors where each copy lives, skipping bad blocks. -# Device name Offset Size -/dev/mtd1 0x0 0x20000 -/dev/mtd1 0x20000 0x20000 +# Device name Offset Size Erase-size No.Blocks +/dev/##MTDINDEX## ##ENV_OFFSET## ##ENV_SIZE## ##ERASEBLOCK## ##NBLOCKS## +/dev/##MTDINDEX## ##ENV_REDUND_OFFSET## ##ENV_SIZE## ##ERASEBLOCK## ##NBLOCKS## diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend index ef7fbfc26..547138192 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend @@ -10,6 +10,8 @@ UBOOT_FW_UTILS_PATCHES = " \ file://0001-tools-env-implement-support-for-environment-encrypti.patch \ file://0002-Implement-U-Boot-environment-access-functions.patch \ file://0003-fw_env-add-support-to-unlock-emmc-boot-partition.patch \ + file://0004-tools-env-factorize-function-to-get-device-type.patch \ + file://0005-tools-env-add-support-to-set-dynamic-location-of-env.patch \ " # Patches from 'meta-swupdate' touch the same files than ours, so we need to @@ -39,9 +41,50 @@ pkg_postinst_${PN}() { if [ x"$D" != "x" ]; then exit 1 fi + CONFIG_FILE="/etc/fw_env.config" MMCDEV="$(sed -ne 's,.*root=/dev/mmcblk\([0-9]\)p.*,\1,g;T;p' /proc/cmdline)" if [ -n "${MMCDEV}" ]; then - sed -i -e "s,^/dev/mmcblk[^[:blank:]]\+,/dev/mmcblk${MMCDEV},g" /etc/fw_env.config + sed -i -e "s,^/dev/mmcblk[^[:blank:]]\+,/dev/mmcblk${MMCDEV},g" ${CONFIG_FILE} + fi + + PARTTABLE="/proc/mtd" + MTDINDEX="$(sed -ne "s/\(^mtd[0-9]\+\):.*\.*/\1/g;T;p" ${PARTTABLE} 2>/dev/null)" + if [ -n "${MTDINDEX}" ]; then + # Initialize variables for fixed offset values + # (backwards compatible with old U-Boot) + ENV_OFFSET="${UBOOT_ENV_OFFSET}" + ENV_REDUND_OFFSET="${UBOOT_ENV_SIZE}" + ENV_SIZE="${UBOOT_ENV_SIZE}" + ERASEBLOCK="" + NBLOCKS="" + + if [ -f "/proc/device-tree/digi,uboot,dynamic-env" ]; then + # Update variables for dynamic environment + # - Both copies starting at the same offset + ENV_REDUND_OFFSET="${UBOOT_ENV_OFFSET}" + # - Calculated erase block size + ERASEBLOCK="$(grep "^${MTDINDEX}" ${PARTTABLE} | awk '{printf("0x%d",$3)}')" + # - Calculated number of blocks + MTDSIZE="$(grep "^${MTDINDEX}" ${PARTTABLE} | awk '{printf("0x%d",$2)}')" + NBLOCKS="$(((MTDSIZE - UBOOT_ENV_OFFSET) / ERASEBLOCK))" + # If a range was provided, calculate the number of + # blocks in the range and use that number, unless they + # exceed the total number of blocks available in the + # whole partition. + if [ -n "${UBOOT_ENV_RANGE}" ]; then + RANGE_BLOCKS="$((UBOOT_ENV_RANGE / ERASEBLOCK))" + [ "${RANGE_BLOCKS}" -lt "${NBLOCKS}" ] && NBLOCKS="${RANGE_BLOCKS}" + fi + fi + + # Substitute stub with configuration and calculated values + sed -i -e "s/##MTDINDEX##/${MTDINDEX}/g" \ + -e "s/##ENV_OFFSET##/${ENV_OFFSET}/g" \ + -e "s/##ENV_REDUND_OFFSET##/${ENV_REDUND_OFFSET}/g" \ + -e "s/##ENV_SIZE##/${ENV_SIZE}/g" \ + -e "s/##ERASEBLOCK##/${ERASEBLOCK}/g" \ + -e "s/##NBLOCKS##/${NBLOCKS}/g" \ + ${CONFIG_FILE} fi } diff --git a/meta-digi-arm/recipes-digi/mca/mca-tool_1.6.bb b/meta-digi-arm/recipes-digi/mca/mca-tool_1.7.bb similarity index 70% rename from meta-digi-arm/recipes-digi/mca/mca-tool_1.6.bb rename to meta-digi-arm/recipes-digi/mca/mca-tool_1.7.bb index 86ed5c3e1..7712c6270 100644 --- a/meta-digi-arm/recipes-digi/mca/mca-tool_1.6.bb +++ b/meta-digi-arm/recipes-digi/mca/mca-tool_1.7.bb @@ -7,8 +7,8 @@ LICENSE = "CLOSED" PKGNAME = "mca_tool" SRC_URI = "${DIGI_PKG_SRC}/${PKGNAME}-${PV}.tar.gz" -SRC_URI[md5sum] = "20992b6b30904ee4d75d196c957077e0" -SRC_URI[sha256sum] = "49458475dd5df11f0c4f4593ffc930fbcdaa457120f73ab18587d711eb9036f6" +SRC_URI[md5sum] = "f44b2547333b2900477a8b89b58d08a1" +SRC_URI[sha256sum] = "9659f591438955eab27fda7092fe4ba1d6874c276a4bc6d70689f91dc4bdccd8" S = "${WORKDIR}/${PKGNAME}-${PV}" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio.bb b/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio.bb deleted file mode 100644 index 7aa5a90f1..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio.bb +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2013 Digi International. - -SUMMARY = "Example GPIO kernel module." -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" - -inherit module - -PV = "2.1" - -SRC_URI = "\ - file://COPYING \ - file://gpio.c \ - file://gpio.h \ - file://Makefile \ -" - -S = "${WORKDIR}" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/COPYING b/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/COPYING deleted file mode 100644 index 6d45519c8..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/Makefile b/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/Makefile deleted file mode 100644 index eefc3d188..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -obj-m := gpio.o - -SRC := $(shell pwd) - -all: - $(MAKE) -C $(KERNEL_SRC) M=$(SRC) - -modules_install: - $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install - -clean: - rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c - rm -f Module.markers Module.symvers modules.order - rm -rf .tmp_versions Modules.symvers diff --git a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/gpio.c b/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/gpio.c deleted file mode 100644 index 9e0ecd6e4..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/gpio.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * gpio.c - * - * Copyright (C)2006-2008 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "gpio.h" - -#define DRIVER_VERSION "2.1" -#define DRIVER_NAME "gpio" - -static int gpio_major = 240; /* set to 0 for dynamic allocation */ -static int gpio_minor = 0; -static int gpio_nr_devs; -static struct gpio_dev *gpio_device = NULL; - -static int gpio_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg ); -static unsigned int gpio_poll(struct file *file, poll_table *wait ); -static ssize_t gpio_write(struct file * file, const char * buf, - size_t count, loff_t * ppos ); -static ssize_t gpio_read(struct file * file, char * buf, - size_t count, loff_t * ppos ); -static int gpio_open(struct inode * inode, struct file * file ); -static int gpio_release_close(struct inode * inode, struct file * file ); - -static struct file_operations gpio_fops = { - .owner = THIS_MODULE, - .read = gpio_read, - .write = gpio_write, - .ioctl = gpio_ioctl, - .poll = gpio_poll, - .open = gpio_open, - .release = gpio_release_close, -}; - -struct gpio_conf { - int dev_id; /* minor */ - int irqnum; /* irq number assigned */ - - /* needed for irq-waiting */ - wait_queue_head_t wait_q; - int triggered; -}; - -struct gpio_dev { - struct cdev cdev; - struct gpio_conf *gpio; -}; - -static irqreturn_t gpio_irq_handler(int irq, void *dev_id) -{ - struct gpio_conf *gpio = dev_id; - - /* awake those processes waiting... */ - gpio->triggered = 1; - wake_up_interruptible(&gpio->wait_q); - - return IRQ_HANDLED; -} - -static int gpio_ioctl(struct inode *inode, - struct file *file, - unsigned int cmd, - unsigned long arg ) -{ - struct gpio_conf *gpio = (struct gpio_conf *)file->private_data; - unsigned long irqflags = 0; - int gpionum = MINOR(inode->i_rdev); - char __user *argp = (char __user *)arg; - int retval = 0, irqnum; - - if(_IOC_TYPE(cmd)!= GPIO_IOCTL_BASE )return -ENOTTY; - if(_IOC_NR(cmd)> GPIO_IOCTL_MAXNR )return -ENOTTY; - - if (gpionum != gpio->dev_id) - return -EINVAL; - - switch(cmd ){ - case GPIO_CONFIG_AS_INP: /* config as input */ - if(gpio->irqnum >= 0 ){ - free_irq(gpio->irqnum, gpio ); - gpio->irqnum = -1; - } - retval = gpio_direction_input((unsigned int)gpionum); - break; - - case GPIO_CONFIG_AS_OUT: /* config as output */ - if(gpio->irqnum >= 0 ){ - free_irq(gpio->irqnum, gpio ); - gpio->irqnum = -1; - } - retval = gpio_direction_output((unsigned int)gpionum, - gpio_get_value((unsigned int)gpionum)); - break; - - case GPIO_READ_PIN_VAL: /* read value of the selected pin */ - retval = gpio_get_value((unsigned int)gpionum); - gpio->triggered = 0; - if (copy_to_user(argp, &retval, sizeof(int))) - return -EINVAL; - break; - - case GPIO_WRITE_PIN_VAL: /* write value to the selected pin */ - gpio_set_value((unsigned int)gpionum, *argp); - break; - - case GPIO_CONFIG_AS_IRQ: /* Configure this pin as external interrupt line */ - if(gpio->irqnum >= 0 ) - break; - retval = gpio_direction_input((unsigned int)gpionum); - irqnum = gpio_to_irq(gpionum); - if (irqnum >= 0){ - gpio->irqnum = irqnum; - - init_waitqueue_head(&gpio->wait_q ); - gpio->triggered = 0; - - switch( (ext_irq_type_t)*argp ) { - case IRQ_HIGH: - irqflags = IRQ_TYPE_LEVEL_HIGH; - break; - case IRQ_LOW: - irqflags = IRQ_TYPE_LEVEL_LOW; - break; - case IRQ_RISING: - irqflags = IRQ_TYPE_EDGE_RISING; - break; - case IRQ_FALLING: - irqflags = IRQ_TYPE_EDGE_FALLING; - break; - default: - return -EINVAL; - } - - if((retval = request_irq(gpio->irqnum, gpio_irq_handler, - irqflags, DRIVER_NAME, gpio ))!= 0 ){ - printk(KERN_ERR "Unable to request irq %d, ret %d\n", gpio->irqnum, retval ); - gpio->irqnum = -1; - return retval; - } - } - break; -#if defined(CONFIG_MACH_CC9M2443JS) || defined(CONFIG_MACH_CCW9M2443JS) - case GPIO_CONFIG_PULLUPDOWN: /* Configure this pin pull up/down */ - gpio_set_pullupdown((unsigned int)gpionum, (int)arg); - break; -#endif - default: return -ENOTTY; - } /* switch(cmd )*/ - - return retval; -} - -static unsigned int gpio_poll(struct file *file, poll_table *wait ) -{ - unsigned int ret = 0; - struct gpio_conf *gpio = (struct gpio_conf *)file->private_data; - - poll_wait(file, &gpio->wait_q, wait); - - if (file->f_mode & FMODE_WRITE) - ret |= POLLOUT | POLLWRNORM; - if (gpio->triggered) - ret |= POLLOUT | POLLRDNORM; - - return ret; -} - -static ssize_t gpio_write(struct file * file, const char * buf, size_t count, - loff_t * ppos) -{ - struct gpio_conf *gpio = (struct gpio_conf *)file->private_data; - int gpionum = MINOR(file->f_dentry->d_inode->i_rdev); - char outval; - - if ((gpionum != gpio->dev_id)|| (count != sizeof(char))) - return -EINVAL; - - if (copy_from_user(&outval, buf, sizeof(char))) - return -EFAULT; - - gpio_set_value(gpionum, (unsigned int)outval); - - return sizeof(char); -} - -static ssize_t gpio_read(struct file * file, char * buf, size_t count, - loff_t * ppos) -{ - struct gpio_conf *gpio = (struct gpio_conf *)file->private_data; - int gpionum = MINOR(file->f_dentry->d_inode->i_rdev); - int ret; - - if ((gpionum != gpio->dev_id)|| (count != sizeof(char))) - return -EINVAL; - - /* Check if configured for interrupt operation... */ - if (gpio->irqnum >= 0){ - /* Wait for data */ - if (!(file->f_flags & O_NONBLOCK)){ - wait_event_interruptible(gpio->wait_q, gpio->triggered != 0); - if (signal_pending(current)) - return -ERESTARTSYS; - } - gpio->triggered = 0; - } - - ret = gpio_get_value((unsigned int)gpionum); - - if (copy_to_user(buf, (char *)&ret, sizeof(char))) - return -EFAULT; - - return sizeof(char); -} - -static int gpio_open(struct inode * inode, struct file * file) -{ - int gpionum = MINOR(inode->i_rdev); - int ret; - struct gpio_dev *dev = - container_of(inode->i_cdev, struct gpio_dev, cdev); - - if (gpionum != dev->gpio[gpionum].dev_id) - return -EINVAL; - - ret = gpio_request(gpionum, DRIVER_NAME); - if (ret < 0) - return ret; - - file->private_data = &dev->gpio[gpionum]; - - return 0; -} - -static int gpio_release_close(struct inode * inode, struct file * file) -{ - struct gpio_conf *gpio = (struct gpio_conf *)file->private_data; - int gpionum = MINOR(inode->i_rdev); - - if (gpionum != gpio->dev_id) - return -EINVAL; - - if (gpio->irqnum >= 0){ - free_irq(gpio->irqnum, gpio); - gpio->irqnum = -1; - } - - gpio_free(gpionum); - - return 0; -} - -static void gpio_exit(void) -{ - int i; - dev_t devno = MKDEV(gpio_major, gpio_minor); - - if (gpio_device){ - for (i = 0; i < gpio_nr_devs; i++){ - if (gpio_device->gpio[i].irqnum != -1) - free_irq(gpio_device->gpio[i].irqnum, - &gpio_device->gpio[i]); - cdev_del(&gpio_device->cdev); - } - kfree(gpio_device); - } - unregister_chrdev_region(devno, gpio_nr_devs); -} - -static int gpio_init(void) -{ - int ret, i; - dev_t dev; - - gpio_nr_devs = 256; - - if (gpio_major){ - dev = MKDEV(gpio_major, gpio_minor); - ret = register_chrdev_region(dev, gpio_nr_devs, DRIVER_NAME); - } else { - ret = alloc_chrdev_region(&dev, gpio_minor, - gpio_nr_devs, DRIVER_NAME); - gpio_major = MAJOR(dev); - } - - if (ret < 0){ - pr_err(DRIVER_NAME ": major %d already in use \n", gpio_major); - return ret; - } - - gpio_device = kzalloc(sizeof(*gpio_device), GFP_KERNEL); - if (!gpio_device){ - ret = -ENOMEM; - goto fail; - } - - gpio_device->gpio = - kzalloc(sizeof(*gpio_device->gpio)* gpio_nr_devs, GFP_KERNEL); - if (!gpio_device->gpio){ - ret = -ENOMEM; - goto fail; - } - - cdev_init(&gpio_device->cdev, &gpio_fops); - gpio_device->cdev.owner = THIS_MODULE; - gpio_device->cdev.ops = &gpio_fops; - if (cdev_add(&gpio_device->cdev, dev, gpio_nr_devs)){ - pr_err(DRIVER_NAME ": Error adding cdev\n"); - ret = -ENODEV; - goto fail; - } - - for (i = 0; i < gpio_nr_devs; i++){ - gpio_device->gpio[i].dev_id = i; - gpio_device->gpio[i].irqnum = -1; - } - - pr_info(DRIVER_NAME ": GPIO driver v%s\n", DRIVER_VERSION); - return 0; - -fail: - gpio_exit(); - return ret; -} - -MODULE_AUTHOR("Digi International Inc."); -MODULE_DESCRIPTION("GPIO driver for the user space"); -MODULE_LICENSE("GPL v2"); - -module_init(gpio_init); -module_exit(gpio_exit); diff --git a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/gpio.h b/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/gpio.h deleted file mode 100644 index ac0c77d64..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-gpio/kernel-module-gpio/gpio.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * gpio.h - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#ifndef __DIGI_GPIO_H_ -#define __DIGI_GPIO_H_ - -typedef enum { - IRQ_HIGH, - IRQ_LOW, - IRQ_RISING, - IRQ_FALLING -}ext_irq_type_t; - -#define PULLUP 0x00 -#define PULLDOWN 0x02 -#define PULLUPDOWN_DISABLED 0x03 - -/* ioctl magic numbers */ -#define GPIO_IOCTL_BASE 'G' - -/* inputs */ -#define GPIO_CONFIG_AS_INP _IO (GPIO_IOCTL_BASE, 0) /* config this pin as input */ -#define GPIO_READ_PIN_VAL _IOR (GPIO_IOCTL_BASE, 1, int) /* read pin value */ - -/* outputs */ -#define GPIO_CONFIG_AS_OUT _IO (GPIO_IOCTL_BASE, 2) /* config this pin as output */ -#define GPIO_WRITE_PIN_VAL _IOW (GPIO_IOCTL_BASE, 3, int) /* sets the pin value */ - -/* irqs */ -#define GPIO_CONFIG_AS_IRQ _IOR (GPIO_IOCTL_BASE, 4, ext_irq_type_t) /* config this pin as interrupt */ - -/* pull up/down */ -#define GPIO_CONFIG_PULLUPDOWN _IOW (GPIO_IOCTL_BASE, 5, int) /* config this pin pull up/down resistor */ - -#define GPIO_IOCTL_MAXNR 5 - -#endif /* __DIGI_GPIO_H_ */ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb index 66894f694..40c72fcdf 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -17,8 +17,9 @@ SRC_URI = " \ " SRC_URI_append = " \ - file://qualcomm-pre-up \ + file://81-sdio-qcom.rules \ file://modprobe-qualcomm.conf \ + file://qualcomm.sh \ " S = "${WORKDIR}/git" @@ -38,18 +39,19 @@ do_compile_prepend() { } do_install_append() { - install -d ${D}${sysconfdir}/network/if-pre-up.d - install -m 0755 ${WORKDIR}/qualcomm-pre-up ${D}${sysconfdir}/network/if-pre-up.d/qualcomm install -d ${D}${sysconfdir}/modprobe.d install -m 0644 ${WORKDIR}/modprobe-qualcomm.conf ${D}${sysconfdir}/modprobe.d/qualcomm.conf install -d ${D}${base_libdir}/firmware/wlan/ install -m 0644 ${WORKDIR}/git/firmware_bin/WCNSS_cfg.dat ${D}${base_libdir}/firmware/wlan/cfg.dat install -m 0644 ${WORKDIR}/git/firmware_bin/WCNSS_qcom_cfg.ini ${D}${base_libdir}/firmware/wlan/qcom_cfg.ini + install -d ${D}${sysconfdir}/udev/rules.d ${D}${sysconfdir}/udev/scripts + install -m 0644 ${WORKDIR}/81-sdio-qcom.rules ${D}${sysconfdir}/udev/rules.d/ + install -m 0755 ${WORKDIR}/qualcomm.sh ${D}${sysconfdir}/udev/scripts/ } FILES_${PN} += " \ - ${sysconfdir}/network/if-pre-up.d/qualcomm \ ${sysconfdir}/modprobe.d/qualcomm.conf \ + ${sysconfdir}/udev/ \ ${base_libdir}/firmware/wlan/cfg.dat \ ${base_libdir}/firmware/wlan/qcom_cfg.ini \ " diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch deleted file mode 100644 index 63847821a..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Yi Chen -Date: Fri, 28 Aug 2015 19:24:45 +0800 -Subject: [PATCH] qcacld: Fix compiling errors when BUILD_DEBUG_VERSION := 0. - -This is a compiling issue when BUILD_DEBUG_VERSION := 0 is set in Kbuild. - -Change-Id: Iaee98eb91d66990dfa4989a7c07cb5592f8a6079 -CRs-Fixed: 898366 -(cherry picked from commit d0258ff1dcf19236e4cfa69e45f75b72a1334609) ---- - CORE/UTILS/FWLOG/dbglog_host.c | 4 ++-- - Kbuild | 8 ++++---- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/CORE/UTILS/FWLOG/dbglog_host.c b/CORE/UTILS/FWLOG/dbglog_host.c -index 2dfa45983a87..63fc742259fc 100644 ---- a/CORE/UTILS/FWLOG/dbglog_host.c -+++ b/CORE/UTILS/FWLOG/dbglog_host.c -@@ -55,8 +55,6 @@ - #include - #define FWLOG_DEBUG ATH_DEBUG_MAKE_MODULE_MASK(0) - --#if defined(DEBUG) -- - static bool appstarted = FALSE; - static bool senddriverstatus = FALSE; - static bool kd_nl_init = FALSE; -@@ -64,6 +62,8 @@ static int cnss_diag_pid = INVALID_PID; - static int get_version = 0; - static int gprint_limiter = 0; - -+#if defined(DEBUG) -+ - static ATH_DEBUG_MASK_DESCRIPTION g_fwlogDebugDescription[] = { - {FWLOG_DEBUG,"fwlog"}, - }; -diff --git a/Kbuild b/Kbuild -index 04461cfb7945..b248eee28bf0 100644 ---- a/Kbuild -+++ b/Kbuild -@@ -882,7 +882,6 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \ - -DWLAN_PERF \ - -DPTT_SOCK_SVC_ENABLE \ - -Wall\ -- -Werror\ - -D__linux__ \ - -DHAL_SELF_STA_PER_BSS=1 \ - -DWLAN_FEATURE_VOWIFI_11R \ -@@ -966,11 +965,12 @@ CDEFINES += -DWCN_PRONTO - CDEFINES += -DWCN_PRONTO_V1 - endif - -+CDEFINES += -DTRACE_RECORD \ -+ -DLIM_TRACE_RECORD \ -+ -DSME_TRACE_RECORD -+ - ifeq ($(BUILD_DEBUG_VERSION),1) - CDEFINES += -DWLAN_DEBUG \ -- -DTRACE_RECORD \ -- -DLIM_TRACE_RECORD \ -- -DSME_TRACE_RECORD \ - -DPE_DEBUG_LOGW \ - -DPE_DEBUG_LOGE \ - -DDEBUG diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch deleted file mode 100644 index 221547159..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Isaac Hermida -Date: Mon, 18 Apr 2016 08:48:14 +0200 -Subject: [PATCH] Update cfg80211_vendor_event_alloc call for newer kernel - versions - -Current compilation fails with next error. - -> wlan_hdd_cfg80211.h:995:9: error: too few arguments to function 'cfg80211_vendor_event_alloc' - -This function has been updated starting with kernel 3.15 - -Signed-off-by: Isaac Hermida ---- - CORE/HDD/inc/wlan_hdd_cfg80211.h | 2 +- - CORE/HDD/src/wlan_hdd_assoc.c | 8 ++++++++ - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h -index 7602f1d3874b..a40c55144bc5 100644 ---- a/CORE/HDD/inc/wlan_hdd_cfg80211.h -+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h -@@ -992,7 +992,7 @@ backported_cfg80211_vendor_event_alloc(struct wiphy *wiphy, - int approxlen, - int event_idx, gfp_t gfp) - { -- return cfg80211_vendor_event_alloc(wiphy, approxlen, event_idx, gfp); -+ return cfg80211_vendor_event_alloc(wiphy, wdev, approxlen, event_idx, gfp); - } - #define cfg80211_vendor_event_alloc backported_cfg80211_vendor_event_alloc - #endif -diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c -index bc3e15009d97..5dc882fa8f83 100644 ---- a/CORE/HDD/src/wlan_hdd_assoc.c -+++ b/CORE/HDD/src/wlan_hdd_assoc.c -@@ -2027,6 +2027,8 @@ static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, - eRoamCmdStatus roamStatus, - eCsrRoamResult roamResult ) - { -+ struct ieee80211_channel *chann; -+ - hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", - __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); - -@@ -2082,7 +2084,13 @@ static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, - return; - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) -+ chann = ieee80211_get_channel(pAdapter->wdev.wiphy, -+ (int)pRoamInfo->pBssDesc->channelId); -+ cfg80211_ibss_joined(pAdapter->dev, bss->bssid, chann, GFP_KERNEL); -+#else - cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); -+#endif - cfg80211_put_bss( - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) || defined(WITH_BACKPORTS) - pHddCtx->wiphy, diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch deleted file mode 100644 index 86c6a4ca7..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 10:30:51 +0200 -Subject: [PATCH] wlan_hdd_main: Update cfg80211_ap_stopped to - nl80211_send_ap_stopped - -Use nl80211_send_ap_stopped instead of cfg80211_ap_stopped for newer -kernel versions - -Signed-off-by: Isaac Hermida ---- - CORE/HDD/src/wlan_hdd_main.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c -index 5e4e95aaaee4..0ff3f31b9863 100755 ---- a/CORE/HDD/src/wlan_hdd_main.c -+++ b/CORE/HDD/src/wlan_hdd_main.c -@@ -9929,8 +9929,12 @@ VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx ) - #if defined(MSM_PLATFORM) && !defined(WITH_BACKPORTS) - hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send stop ap to supplicant", - __func__); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) - cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL); - #else -+ nl80211_send_ap_stopped(pAdapter->dev->ieee80211_ptr); -+#endif -+#else - hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant", - __func__); - /* event supplicant to restart */ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0004-qcacld-2.0-remove-unused-code.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0004-qcacld-2.0-remove-unused-code.patch deleted file mode 100644 index 09b3ee892..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0004-qcacld-2.0-remove-unused-code.patch +++ /dev/null @@ -1,215 +0,0 @@ -From: Karthick S -Date: Fri, 14 Aug 2015 14:52:23 +0530 -Subject: [PATCH] qcacld-2.0: remove unused code - -Removed unused code from ReinitSDIO. Also removed mmcbusmode and it's -related references in the code. - -Change-Id: Idaa40f31cc830c0e2fa5d6fbda8c78c9f434bdaf -CRs-Fixed: 890630 -(cherry picked from commit acca7f817db52580a985de2804f30973b2ed9cb7) - -Signed-off-by: Isaac Hermida -(cherry picked from commit d63533a6cc46671141ac31290e4f020c236298ee) ---- - CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 165 +-------------------- - 1 file changed, 2 insertions(+), 163 deletions(-) - -diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -index 31641c94351c..b3afed2a8d7c 100644 ---- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -+++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -@@ -57,11 +57,6 @@ - - #define MAX_HIF_DEVICES 2 - --unsigned int mmcbusmode = 0; --module_param(mmcbusmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); --MODULE_PARM_DESC(mmcbusmode, "Set MMC driver Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104"); --EXPORT_SYMBOL(mmcbusmode); -- - unsigned int mmcbuswidth = 0; - module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - MODULE_PARM_DESC(mmcbuswidth, "Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit"); -@@ -689,98 +684,6 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) - sdio_claim_host(func); - - do { -- /* 2.6.32 kernel does part of the SDIO initalization upon resume */ -- A_BOOL lt_2_6_32 = (LINUX_VERSION_CODEocr_avail) - 1; -- /* emulate the mmc_power_up(...) */ -- host->ios.vdd = bit; -- host->ios.chip_select = MMC_CS_DONTCARE; -- host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; -- host->ios.power_mode = MMC_POWER_UP; -- host->ios.bus_width = MMC_BUS_WIDTH_1; -- host->ios.timing = MMC_TIMING_LEGACY; -- host->ops->set_ios(host, &host->ios); -- /* -- * This delay should be sufficient to allow the power supply -- * to reach the minimum voltage. -- */ -- msleep(2); -- -- host->ios.clock = host->f_min; -- host->ios.power_mode = MMC_POWER_ON; -- host->ops->set_ios(host, &host->ios); -- -- /* -- * This delay must be at least 74 clock sizes, or 1 ms, or the -- * time required to reach a stable voltage. -- */ -- msleep(2); -- -- /* Issue CMD0. Goto idle state */ -- host->ios.chip_select = MMC_CS_HIGH; -- host->ops->set_ios(host, &host->ios); -- msleep(1); -- err = IssueSDCommand(device, MMC_GO_IDLE_STATE, 0, (MMC_RSP_NONE | MMC_CMD_BC), NULL); -- host->ios.chip_select = MMC_CS_DONTCARE; -- host->ops->set_ios(host, &host->ios); -- msleep(1); -- host->use_spi_crc = 0; -- -- if (err) { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD0 failed : %d \n",err)); -- break; -- } -- -- if (!host->ocr) { -- /* Issue CMD5, arg = 0 */ -- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, 0, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); -- if (err) { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); -- break; -- } -- host->ocr = resp; -- } -- -- /* Issue CMD5, arg = ocr. Wait till card is ready */ -- for (i=0;i<100;i++) { -- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, host->ocr, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); -- if (err) { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); -- break; -- } -- if (resp & MMC_CARD_BUSY) { -- break; -- } -- msleep(10); -- } -- -- if ((i == 100) || (err)) { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: card in not ready : %d %d \n",i,err)); -- break; -- } -- -- /* Issue CMD3, get RCA */ -- err = IssueSDCommand(device, SD_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6 | MMC_CMD_BCR, &resp); -- if (err) { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD3 failed : %d \n",err)); -- break; -- } -- rca = resp >> 16; -- host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; -- host->ops->set_ios(host, &host->ios); -- -- /* Issue CMD7, select card */ -- err = IssueSDCommand(device, MMC_SELECT_CARD, (rca << 16), MMC_RSP_R1 | MMC_CMD_AC, NULL); -- if (err) { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD7 failed : %d \n",err)); -- break; -- } -- } -- - /* Enable high speed */ - if (card->host->caps & MMC_CAP_SD_HIGHSPEED) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("ReinitSDIO: Set high speed mode\n")); -@@ -1212,10 +1115,7 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe - */ - { - A_UINT32 clock, clock_set = 12500000; --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) -- unsigned int bus_speed = 0, timing = 0; -- unsigned char speed = 0; --#endif -+ - sdio_claim_host(func); - if (writecccr1) { - A_UINT32 err = Func0_CMD52WriteByte(func->card, -@@ -1352,69 +1252,8 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe - if (debugcccr) { - HIFDumpCCCR(device); - } -- // Set MMC Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104 -- if (mmcbusmode > 0) { -- printk("host caps:0x%08X, card_sd3_bus_mode:0x%08X\n", (unsigned int)func->card->host->caps, (unsigned int)func->card->sw_caps.sd3_bus_mode); -- if (mmcbusmode == 5 && (func->card->host->caps & MMC_CAP_UHS_SDR104) && -- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104) || forcecard)) { -- bus_speed = SDIO_SPEED_SDR104; -- timing = MMC_TIMING_UHS_SDR104; -- func->card->sw_caps.uhs_max_dtr = UHS_SDR104_MAX_DTR; -- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR104. \n", __func__)); -- } else if (mmcbusmode == 4 && (func->card->host->caps & MMC_CAP_UHS_DDR50) && -- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_DDR50) || forcecard)) { -- bus_speed = SDIO_SPEED_DDR50; -- timing = MMC_TIMING_UHS_DDR50; -- func->card->sw_caps.uhs_max_dtr = UHS_DDR50_MAX_DTR; -- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to DDR50. \n", __func__)); -- } else if (mmcbusmode == 3 && (func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50)) && -- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) || forcecard)) { -- bus_speed = SDIO_SPEED_SDR50; -- timing = MMC_TIMING_UHS_SDR50; -- func->card->sw_caps.uhs_max_dtr = UHS_SDR50_MAX_DTR; -- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR50. \n", __func__)); -- } else if (mmcbusmode == 2 && (func->card->host->caps & -- (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25)) && -- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR25) || forcecard)) { -- bus_speed = SDIO_SPEED_SDR25; -- timing = MMC_TIMING_UHS_SDR25; -- func->card->sw_caps.uhs_max_dtr = UHS_SDR25_MAX_DTR; -- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR25. \n", __func__)); -- } else if (mmcbusmode == 1 && (func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | -- MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR12)) && -- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR12) || forcecard)) { -- bus_speed = SDIO_SPEED_SDR12; -- timing = MMC_TIMING_UHS_SDR12; -- func->card->sw_caps.uhs_max_dtr = UHS_SDR12_MAX_DTR; -- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR12. \n", __func__)); -- } else { -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: MMC bus mode %d not supported. \n", __func__, mmcbusmode)); -- return ret = -1; -- } -- -- ret = Func0_CMD52ReadByte(func->card, SDIO_CCCR_SPEED, &speed); -- if (ret){ -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: CMD52 to get CCCR SPEED failed: %d, cap_uhs: %lu, sd3_bus_mode: %x \n", __func__, ret, (long unsigned int)(func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR12)), func->card->sw_caps.sd3_bus_mode)); -- return ret; -- } -- -- speed &= ~SDIO_SPEED_BSS_MASK; -- speed |= bus_speed; -- ret = Func0_CMD52WriteByte(func->card, SDIO_CCCR_SPEED, speed); -- if (ret){ -- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: CMD52 to set CCCR SPPED failed: %d \n", __func__, ret)); -- return ret; -- } -- -- if (bus_speed) { -- device->host->ios.timing = timing; -- device->host->ops->set_ios(device->host, &device->host->ios); -- // mmc_set_clock(func->card->host, func->card->sw_caps.uhs_max_dtr); -- } -- } -- --#endif //#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) */ - sdio_release_host(func); - } - diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0005-Including-header-file-for-regulatory_hint_user.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0005-Including-header-file-for-regulatory_hint_user.patch deleted file mode 100644 index 750db8f12..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0005-Including-header-file-for-regulatory_hint_user.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 13:19:10 +0200 -Subject: [PATCH] Including header file for "regulatory_hint_user" - -The function "regulatory_hint_user" has been moved from -include/net/cfg80211.h to net/wireless/reg.h. - -Signed-off-by: Isaac Hermida -(cherry picked from commit db944bc907127c191b1bbdcc58d3aecedcf44a8c) ---- - CORE/VOSS/src/vos_nvitem.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/CORE/VOSS/src/vos_nvitem.c b/CORE/VOSS/src/vos_nvitem.c -index d79ae2871e4b..47290c9d1744 100644 ---- a/CORE/VOSS/src/vos_nvitem.c -+++ b/CORE/VOSS/src/vos_nvitem.c -@@ -53,6 +53,10 @@ - #include "regdomain.h" - #include "regdomain_common.h" - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) -+#include <../net/wireless/reg.h> -+#endif -+ - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) && !defined(WITH_BACKPORTS) - #define IEEE80211_CHAN_NO_80MHZ 1<<7 - #endif diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0006-Updating-calls-to-alloc_netdev_mq.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0006-Updating-calls-to-alloc_netdev_mq.patch deleted file mode 100644 index 644edbf66..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0006-Updating-calls-to-alloc_netdev_mq.patch +++ /dev/null @@ -1,75 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 13:52:18 +0200 -Subject: [PATCH] Updating calls to "alloc_netdev_mq" - -Signed-off-by: Isaac Hermida ---- - CORE/EPPING/src/epping_txrx.c | 6 ++++++ - CORE/HDD/src/wlan_hdd_hostapd.c | 4 ++++ - CORE/HDD/src/wlan_hdd_main.c | 10 +++++++--- - 3 files changed, 17 insertions(+), 3 deletions(-) - -diff --git a/CORE/EPPING/src/epping_txrx.c b/CORE/EPPING/src/epping_txrx.c -index 678d58e0cfae..0985e362f94a 100644 ---- a/CORE/EPPING/src/epping_txrx.c -+++ b/CORE/EPPING/src/epping_txrx.c -@@ -355,7 +355,13 @@ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, - struct net_device *dev; - epping_adapter_t *pAdapter; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) -+ dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", NET_NAME_UNKNOWN, ether_setup); -+#else - dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", ether_setup); -+#endif -+ -+ - if (dev == NULL) { - EPPING_LOG(VOS_TRACE_LEVEL_FATAL, - "%s: Cannot allocate epping_adapter_t\n", __func__); -diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c -index 6251224c11df..8a80d26f355a 100644 ---- a/CORE/HDD/src/wlan_hdd_hostapd.c -+++ b/CORE/HDD/src/wlan_hdd_hostapd.c -@@ -5447,7 +5447,11 @@ hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAd - - hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: iface_name = %s", __func__, iface_name); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) -+ pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, NET_NAME_UNKNOWN, ether_setup, NUM_TX_QUEUES); -+#else - pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, ether_setup, NUM_TX_QUEUES); -+#endif - - if (pWlanHostapdDev != NULL) - { -diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c -index 0ff3f31b9863..a10da2a9b164 100755 ---- a/CORE/HDD/src/wlan_hdd_main.c -+++ b/CORE/HDD/src/wlan_hdd_main.c -@@ -8226,7 +8226,11 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac - /* - * cfg80211 initialization and registration.... - */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) -+ pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, NET_NAME_UNKNOWN, ether_setup, NUM_TX_QUEUES); -+#else - pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, ether_setup, NUM_TX_QUEUES); -+#endif - - if(pWlanDev != NULL) - { -@@ -9929,10 +9933,10 @@ VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx ) - #if defined(MSM_PLATFORM) && !defined(WITH_BACKPORTS) - hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send stop ap to supplicant", - __func__); --#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) -- cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL); --#else -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) - nl80211_send_ap_stopped(pAdapter->dev->ieee80211_ptr); -+#else -+ cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL); - #endif - #else - hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant", diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch deleted file mode 100644 index 58df7fd70..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 13:56:15 +0200 -Subject: [PATCH] wlan_hdd_cfg80211: update "cfg80211_inform_bss" params for - kernel version - -Signed-off-by: Isaac Hermida ---- - CORE/HDD/src/wlan_hdd_cfg80211.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c -index c09ac0304852..c6c79552a9d0 100644 ---- a/CORE/HDD/src/wlan_hdd_cfg80211.c -+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c -@@ -8460,8 +8460,11 @@ static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - if (bss == NULL) { - rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; -- -- return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, -+ return (cfg80211_inform_bss(wiphy, chan, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) -+ CFG80211_BSS_FTYPE_BEACON, -+#endif -+ pBssDesc->bssId, - le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), - pBssDesc->capabilityInfo, - pBssDesc->beaconInterval, ie, ie_length, diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch deleted file mode 100644 index 773706b5c..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 13:57:03 +0200 -Subject: [PATCH] wlan_hdd_p2p: Update call to "cfg80211_rx_mgmt" for different - kernel versions - -Signed-off-by: Isaac Hermida ---- - CORE/HDD/src/wlan_hdd_p2p.c | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c -index 0c6645f077f1..476b456e165c 100644 ---- a/CORE/HDD/src/wlan_hdd_p2p.c -+++ b/CORE/HDD/src/wlan_hdd_p2p.c -@@ -826,7 +826,16 @@ void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter ) - // Check for cached action frame - if(pRemainChanCtx->action_pkt_buff.frame_length != 0) - { --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) -+ cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, -+ pRemainChanCtx->action_pkt_buff.freq, 0, -+ pRemainChanCtx->action_pkt_buff.frame_ptr, -+ pRemainChanCtx->action_pkt_buff.frame_length, -+ NL80211_RXMGMT_FLAG_ANSWERED); -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) -+ -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) - cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, - pRemainChanCtx->action_pkt_buff.freq, 0, - pRemainChanCtx->action_pkt_buff.frame_ptr, -@@ -2340,7 +2349,11 @@ void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter, - - //Indicate Frame Over Normal Interface - hddLog( LOG1, FL("Indicate Frame over NL80211 Interface")); --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) -+ cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames, -+ nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED); -+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) - cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames, - nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED, GFP_ATOMIC); - #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0009-linux_ac-Fix-for-f_dentry.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0009-linux_ac-Fix-for-f_dentry.patch deleted file mode 100644 index f3bbd3bfa..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0009-linux_ac-Fix-for-f_dentry.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 13:58:29 +0200 -Subject: [PATCH] =?UTF-8?q?linux=5Fac:=20Fix=20for=20=E2=80=98f=5Fdentry?= - =?UTF-8?q?=E2=80=99?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://communities.vmware.com/thread/499483?start=0&tstart=0 - -Signed-off-by: Isaac Hermida ---- - CORE/UTILS/PKTLOG/linux_ac.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/CORE/UTILS/PKTLOG/linux_ac.c b/CORE/UTILS/PKTLOG/linux_ac.c -index b1969ad5d2ba..8d45d7365b2b 100644 ---- a/CORE/UTILS/PKTLOG/linux_ac.c -+++ b/CORE/UTILS/PKTLOG/linux_ac.c -@@ -576,7 +576,10 @@ pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) - int rem_len; - int start_offset, end_offset; - int fold_offset, ppos_data, cur_rd_offset; --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) -+ struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) -+ PDE_DATA(file_inode(file)); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) - PDE_DATA(file->f_dentry->d_inode); - #else -@@ -817,7 +820,10 @@ static struct vm_operations_struct pktlog_vmops = { - - static int pktlog_mmap(struct file *file, struct vm_area_struct *vma) - { --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) -+ struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) -+ PDE_DATA(file_inode(file)); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) - PDE_DATA(file->f_dentry->d_inode); - #else diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch deleted file mode 100644 index a2a7ce05e..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 14:00:59 +0200 -Subject: [PATCH] native_sdio/src/hif: Do not call to HIGH SPEED functions for - newer kernels - -Signed-off-by: Isaac Hermida ---- - CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -index b3afed2a8d7c..1a1e51eff8c7 100644 ---- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -+++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -@@ -690,7 +690,9 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) - err = Func0_CMD52ReadByte(card, SDIO_CCCR_SPEED, &cmd52_resp); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 read to CCCR speed register failed : %d \n",err)); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - card->state &= ~MMC_STATE_HIGHSPEED; -+#endif - /* no need to break */ - } else { - err = Func0_CMD52WriteByte(card, SDIO_CCCR_SPEED, (cmd52_resp | SDIO_SPEED_EHS)); -@@ -698,14 +700,20 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 write to CCCR speed register failed : %d \n",err)); - break; - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - mmc_card_set_highspeed(card); -+#endif - host->ios.timing = MMC_TIMING_SD_HS; - host->ops->set_ios(host, &host->ios); - } - } - - /* Set clock */ -- if (mmc_card_highspeed(card)) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) -+ if (mmc_card_highspeed(card)) { -+#else -+ if (mmc_card_hs(card)) { -+#endif - clock = 50000000; - } else { - clock = card->cis.max_dtr; -@@ -1181,7 +1189,11 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe - if (mmcclock > 0){ - clock_set = mmcclock; - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - if (mmc_card_highspeed(func->card)){ -+#else -+ if (mmc_card_hs(func->card)){ -+#endif - clock = 50000000; - } else { - clock = func->card->cis.max_dtr; -@@ -2000,7 +2012,11 @@ addHifDevice(struct sdio_func *func) - hifdevice->func = func; - hifdevice->powerConfig = HIF_DEVICE_POWER_UP; - hifdevice->DeviceState = HIF_DEVICE_STATE_ON; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - ret = sdio_set_drvdata(func, hifdevice); -+#else -+ sdio_set_drvdata(func, hifdevice); -+#endif - - EXIT("status %d", ret); - return hifdevice; diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch deleted file mode 100644 index 53fc1fb07..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Isaac Hermida -Date: Thu, 21 Apr 2016 14:32:57 +0200 -Subject: [PATCH] osdep_adf.h: fix for undefined ath_sysctl_pktlog_size - -Signed-off-by: Isaac Hermida ---- - CORE/SERVICES/COMMON/osdep_adf.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/CORE/SERVICES/COMMON/osdep_adf.h b/CORE/SERVICES/COMMON/osdep_adf.h -index 708b6f89fa03..48ca78618840 100644 ---- a/CORE/SERVICES/COMMON/osdep_adf.h -+++ b/CORE/SERVICES/COMMON/osdep_adf.h -@@ -168,6 +168,10 @@ typedef unsigned long TQUEUE_ARG; - #define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ - proc_dostring(ctl, write, filp, buffer, lenp, ppos) - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) -+typedef struct ctl_table ctl_table; -+#endif -+ - /* - * Byte Order stuff - */ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch deleted file mode 100644 index de5ce9002..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Isaac Hermida -Date: Thu, 19 May 2016 12:28:39 +0200 -Subject: [PATCH] Kbuild: Add compilation flag based on kernel support - -The option WLAN_NL80211_TESTMODE was inconditionally added to the compilation -but it does required the specific kernel support. - -https://jira.digi.com/browse/DEL-2567 - -Signed-off-by: Isaac Hermida ---- - Kbuild | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/Kbuild b/Kbuild -index b248eee28bf0..339262874c94 100644 ---- a/Kbuild -+++ b/Kbuild -@@ -908,7 +908,6 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \ - -DWLAN_WAKEUP_EVENTS \ - -DFEATURE_WLAN_RA_FILTERING\ - -DWLAN_KD_READY_NOTIFIER \ -- -DWLAN_NL80211_TESTMODE \ - -DFEATURE_WLAN_BATCH_SCAN \ - -DFEATURE_WLAN_LPHB \ - -DFEATURE_WLAN_PAL_TIMER_DISABLE \ -@@ -948,6 +947,10 @@ CDEFINES += -DDFS_MASTER_OFFLOAD_IND_SUPPORT - endif - endif - -+ifeq ($(CONFIG_NL80211_TESTMODE), y) -+CDEFINES += -DWLAN_NL80211_TESTMODE -+endif -+ - ifeq ($(CONFIG_ARCH_MSM), y) - CDEFINES += -DMSM_PLATFORM - endif diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch deleted file mode 100644 index 98eb059b5..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Isaac Hermida -Date: Tue, 5 Jul 2016 17:57:07 +0200 -Subject: [PATCH] Kbuild: do not compile the DEBUG version inconditionally - -Do not compile the DEBUG version inconditionally by adding the posibility to -define the DEBUG version as a flag parameter. - -Signed-off-by: Isaac Hermida ---- - Kbuild | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Kbuild b/Kbuild -index b14417a558cd..a0e203ce5493 100644 ---- a/Kbuild -+++ b/Kbuild -@@ -121,7 +121,7 @@ endif - # Feature flags which are not (currently) configurable via Kconfig - - #Whether to build debug version --BUILD_DEBUG_VERSION := 1 -+BUILD_DEBUG_VERSION ?= 1 - - #Enable this flag to build driver in diag version - BUILD_DIAG_VERSION := 1 diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch deleted file mode 100644 index 0c9c91943..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Isaac Hermida -Date: Tue, 5 Jul 2016 17:52:44 +0200 -Subject: [PATCH] Kbuild: Group most of the relevant DEBUG options - -The value of BUILD_DEBUG_VERSION will be used to compile the driver with most -of the relevant DEBUG flags. Use that variable to compile the debug version. - -Signed-off-by: Isaac Hermida ---- - Kbuild | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Kbuild b/Kbuild -index a0e203ce5493..e5f2e8ebd4ad 100644 ---- a/Kbuild -+++ b/Kbuild -@@ -896,9 +896,7 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \ - -DWLAN_FEATURE_PACKET_FILTERING \ - -DWLAN_FEATURE_VOWIFI \ - -DWLAN_FEATURE_11AC \ -- -DWLAN_FEATURE_P2P_DEBUG \ - -DWLAN_ENABLE_AGEIE_ON_SCAN_RESULTS \ -- -DWLANTL_DEBUG\ - -DWLAN_NS_OFFLOAD \ - -DWLAN_ACTIVEMODE_OFFLOAD_FEATURE \ - -DWLAN_FEATURE_HOLD_RX_WAKELOCK \ -@@ -936,8 +934,7 @@ CDEFINES += -DCONFIG_HL_SUPPORT \ - -DSDIO_3_0 \ - -DHIF_SDIO \ - -DCONFIG_ATH_PROCFS_DIAG_SUPPORT \ -- -DFEATURE_HL_GROUP_CREDIT_FLOW_CONTROL \ -- -DDEBUG_HL_LOGGING -+ -DFEATURE_HL_GROUP_CREDIT_FLOW_CONTROL - endif - - ifeq ($(CONFIG_QCA_WIFI_SDIO), 1) -@@ -974,8 +971,11 @@ CDEFINES += -DTRACE_RECORD \ - - ifeq ($(BUILD_DEBUG_VERSION),1) - CDEFINES += -DWLAN_DEBUG \ -+ -DWLAN_FEATURE_P2P_DEBUG \ -+ -DWLANTL_DEBUG\ - -DPE_DEBUG_LOGW \ - -DPE_DEBUG_LOGE \ -+ -DDEBUG_HL_LOGGING \ - -DDEBUG - endif - diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch deleted file mode 100644 index c5621575e..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Isaac Hermida -Date: Fri, 14 Oct 2016 10:28:29 +0200 -Subject: [PATCH] wlan_hdd_cfg80211: fix missing ifdef clause - -Fix the compilation for old kernels by defining a missing "ifdef" clause. - -Signed-off-by: Isaac Hermida ---- - CORE/HDD/inc/wlan_hdd_cfg80211.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h -index a40c55144bc5..95c1ddce7de4 100644 ---- a/CORE/HDD/inc/wlan_hdd_cfg80211.h -+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h -@@ -992,7 +992,12 @@ backported_cfg80211_vendor_event_alloc(struct wiphy *wiphy, - int approxlen, - int event_idx, gfp_t gfp) - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) - return cfg80211_vendor_event_alloc(wiphy, wdev, approxlen, event_idx, gfp); -+#else -+ return cfg80211_vendor_event_alloc(wiphy, approxlen, event_idx, gfp); -+#endif -+ - } - #define cfg80211_vendor_event_alloc backported_cfg80211_vendor_event_alloc - #endif diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-Add-.gitignore-rules.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-Add-.gitignore-rules.patch deleted file mode 100644 index f29152d5c..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-Add-.gitignore-rules.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Isaac Hermida -Date: Mon, 17 Oct 2016 10:06:18 +0200 -Subject: [PATCH] Add .gitignore rules - -Signed-off-by: Isaac Hermida ---- - .gitignore | 9 +++++++++ - 1 file changed, 9 insertions(+) - create mode 100644 .gitignore - -diff --git a/.gitignore b/.gitignore -new file mode 100644 -index 000000000000..9886b5284c3f ---- /dev/null -+++ b/.gitignore -@@ -0,0 +1,9 @@ -+*.o -+*.o.cmd -+.tmp_versions -+.* -+Module.symvers -+modules.order -+*.mod.c -+cscope.* -+wlan.ko diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-wlan_hdd_main-initialize-all-adapter-completion-vari.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-wlan_hdd_main-initialize-all-adapter-completion-vari.patch deleted file mode 100644 index 501d36add..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-wlan_hdd_main-initialize-all-adapter-completion-vari.patch +++ /dev/null @@ -1,206 +0,0 @@ -From: Isaac Hermida -Date: Tue, 5 Jul 2016 14:55:15 +0530 -Subject: [PATCH] wlan_hdd_main: initialize all adapter completion variables - -In order to change the p2p device mode, delete and add virtual_iface -followed by change_iface will be invoked. But in this case device mode -is changed by invoking change_iface method without invoking delete and -add virtual_iface functions resulting in kernel panic. - -This is because, in latter case hdd_open_adapter will not be invoked -for the intended device mode. Hence uninitialized completion variables -will be used for further operations. - -To mitigate this issue, Initialize all completion variables of -hdd_adapter_t structure during open adapter irrespective of adapter's -device mode. - -https://jira.digi.com/browse/DEL-3072 -https://jira.digi.com/browse/DEL-3037 - -(cherry-picked from 20ed76a8e436042590aa25acb33a2ba3d6d34250) -Signed-off-by: Isaac Hermida ---- - CORE/HDD/inc/wlan_hdd_main.h | 1 + - CORE/HDD/src/wlan_hdd_hostapd.c | 10 ----- - CORE/HDD/src/wlan_hdd_main.c | 82 ++++++++++++++++++++++++----------------- - 3 files changed, 50 insertions(+), 43 deletions(-) - -diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h -index f01b7f309dc2..3c5a51a57d6c 100644 ---- a/CORE/HDD/inc/wlan_hdd_main.h -+++ b/CORE/HDD/inc/wlan_hdd_main.h -@@ -1740,4 +1740,5 @@ static inline void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter) {} - static inline void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) {} - #endif - bool wlan_hdd_get_fw_state(hdd_adapter_t *adapter); -+void hdd_initialize_adapter_common(hdd_adapter_t *adapter); - #endif // end #if !defined( WLAN_HDD_MAIN_H ) -diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c -index 8a80d26f355a..4bd6b844ac5a 100644 ---- a/CORE/HDD/src/wlan_hdd_hostapd.c -+++ b/CORE/HDD/src/wlan_hdd_hostapd.c -@@ -5389,9 +5389,6 @@ VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter ) - return status; - } - -- init_completion(&pAdapter->session_close_comp_var); -- init_completion(&pAdapter->session_open_comp_var); -- - sema_init(&(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->semWpsPBCOverlapInd, 1); - - // Register as a wireless device -@@ -5494,13 +5491,6 @@ hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAd - pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev ; - pHostapdAdapter->wdev.wiphy = pHddCtx->wiphy; - pHostapdAdapter->wdev.netdev = pWlanHostapdDev; -- init_completion(&pHostapdAdapter->tx_action_cnf_event); -- init_completion(&pHostapdAdapter->cancel_rem_on_chan_var); -- init_completion(&pHostapdAdapter->rem_on_chan_ready_event); -- init_completion(&pHostapdAdapter->ula_complete); -- init_completion(&pHostapdAdapter->offchannel_tx_event); -- init_completion(&pHostapdAdapter->scan_info.scan_req_completion_event); -- init_completion(&pHostapdAdapter->scan_info.abortscan_event_var); - vos_event_init(&pHostapdAdapter->scan_info.scan_finished_event); - pHostapdAdapter->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP; - -diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c -index a10da2a9b164..b447f0931d52 100755 ---- a/CORE/HDD/src/wlan_hdd_main.c -+++ b/CORE/HDD/src/wlan_hdd_main.c -@@ -8234,7 +8234,6 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac - - if(pWlanDev != NULL) - { -- - //Save the pointer to the net_device in the HDD adapter - pAdapter = (hdd_adapter_t*) netdev_priv( pWlanDev ); - -@@ -8244,43 +8243,11 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac - pAdapter->pHddCtx = pHddCtx; - pAdapter->magic = WLAN_HDD_ADAPTER_MAGIC; - -- init_completion(&pAdapter->session_open_comp_var); -- init_completion(&pAdapter->session_close_comp_var); -- init_completion(&pAdapter->disconnect_comp_var); -- init_completion(&pAdapter->linkup_event_var); -- init_completion(&pAdapter->cancel_rem_on_chan_var); -- init_completion(&pAdapter->rem_on_chan_ready_event); -- init_completion(&pAdapter->offchannel_tx_event); -- init_completion(&pAdapter->tx_action_cnf_event); --#ifdef FEATURE_WLAN_TDLS -- init_completion(&pAdapter->tdls_add_station_comp); -- init_completion(&pAdapter->tdls_del_station_comp); -- init_completion(&pAdapter->tdls_mgmt_comp); -- init_completion(&pAdapter->tdls_link_establish_req_comp); --#endif -- -- init_completion(&pHddCtx->mc_sus_event_var); -- init_completion(&pHddCtx->tx_sus_event_var); -- init_completion(&pHddCtx->rx_sus_event_var); -- init_completion(&pHddCtx->ready_to_suspend); -- init_completion(&pAdapter->ula_complete); -- init_completion(&pAdapter->change_country_code); -- --#ifdef WLAN_FEATURE_EXTWOW_SUPPORT -- init_completion(&pHddCtx->ready_to_extwow); --#endif -- --#ifdef FEATURE_WLAN_BATCH_SCAN -- init_completion(&pAdapter->hdd_set_batch_scan_req_var); -- init_completion(&pAdapter->hdd_get_batch_scan_req_var); - pAdapter->pBatchScanRsp = NULL; - pAdapter->numScanList = 0; - pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STOPPED; - pAdapter->prev_batch_id = 0; - mutex_init(&pAdapter->hdd_batch_scan_lock); --#endif -- init_completion(&pAdapter->scan_info.scan_req_completion_event); -- init_completion(&pAdapter->scan_info.abortscan_event_var); - - vos_event_init(&pAdapter->scan_info.scan_finished_event); - pAdapter->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP; -@@ -9018,6 +8985,7 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type, - pAdapter->wdev.iftype = NL80211_IFTYPE_P2P_CLIENT; - - pAdapter->device_mode = session_type; -+ hdd_initialize_adapter_common(pAdapter); - - status = hdd_init_station_mode( pAdapter ); - if( VOS_STATUS_SUCCESS != status ) -@@ -9089,6 +9057,7 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type, - NL80211_IFTYPE_P2P_GO; - pAdapter->device_mode = session_type; - -+ hdd_initialize_adapter_common(pAdapter); - status = hdd_init_ap_mode(pAdapter); - if( VOS_STATUS_SUCCESS != status ) - goto err_free_netdev; -@@ -9163,6 +9132,7 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type, - pAdapter->device_mode = session_type; - status = hdd_register_interface( pAdapter, rtnl_held ); - -+ hdd_initialize_adapter_common(pAdapter); - hdd_init_tx_rx( pAdapter ); - - //Stop the Interface TX queue. -@@ -11735,6 +11705,13 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) - init_completion(&pHddCtx->full_pwr_comp_var); - init_completion(&pHddCtx->standby_comp_var); - init_completion(&pHddCtx->req_bmps_comp_var); -+ init_completion(&pHddCtx->mc_sus_event_var); -+ init_completion(&pHddCtx->tx_sus_event_var); -+ init_completion(&pHddCtx->rx_sus_event_var); -+ init_completion(&pHddCtx->ready_to_suspend); -+#ifdef WLAN_FEATURE_EXTWOW_SUPPORT -+ init_completion(&pHddCtx->ready_to_extwow); -+#endif - - spin_lock_init(&pHddCtx->schedScan_lock); - -@@ -14494,6 +14471,45 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) - } - #endif - -+/** -+ * hdd_initialize_adapter_common() - initialize completion variables -+ * @adapter: pointer to hdd_adapter_t -+ * -+ * Return: none -+ */ -+void hdd_initialize_adapter_common(hdd_adapter_t *adapter) -+{ -+ if (NULL == adapter) { -+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: adapter is NULL ", __func__); -+ return; -+ } -+ init_completion(&adapter->session_open_comp_var); -+ init_completion(&adapter->session_close_comp_var); -+ init_completion(&adapter->disconnect_comp_var); -+ init_completion(&adapter->linkup_event_var); -+ init_completion(&adapter->cancel_rem_on_chan_var); -+ init_completion(&adapter->rem_on_chan_ready_event); -+ init_completion(&adapter->offchannel_tx_event); -+ init_completion(&adapter->tx_action_cnf_event); -+#ifdef FEATURE_WLAN_TDLS -+ init_completion(&adapter->tdls_add_station_comp); -+ init_completion(&adapter->tdls_del_station_comp); -+ init_completion(&adapter->tdls_mgmt_comp); -+ init_completion(&adapter->tdls_link_establish_req_comp); -+#endif -+ init_completion(&adapter->ula_complete); -+ init_completion(&adapter->change_country_code); -+ init_completion(&adapter->scan_info.scan_req_completion_event); -+ init_completion(&adapter->scan_info.abortscan_event_var); -+ -+#ifdef FEATURE_WLAN_BATCH_SCAN -+ init_completion(&adapter->hdd_set_batch_scan_req_var); -+ init_completion(&adapter->hdd_get_batch_scan_req_var); -+#endif -+ -+ return; -+} -+ - //Register the module init/exit functions - module_init(hdd_module_init); - module_exit(hdd_module_exit); diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch deleted file mode 100644 index 4d55231dd..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch +++ /dev/null @@ -1,76 +0,0 @@ -From: Alex Gonzalez -Date: Mon, 12 Dec 2016 16:19:48 +0100 -Subject: [PATCH] qcacld: Indicate disconnect event to upper layers. - -This is to avoid the following warning: - -------------[ cut here ]------------ -WARNING: CPU: 0 PID: 1120 at net/wireless/core.c:1140 cfg80211_netdev_notifier_call+0x3a0/0x574() -Modules linked in: wlan(O-) evbug [last unloaded: wlan] -CPU: 0 PID: 1120 Comm: rmmod Tainted: G O 4.1.15-95656-g4c5caa2cab98-dirty #11 -Hardware name: Freescale i.MX6 Ultralite (Device Tree) -[<80015ae4>] (unwind_backtrace) from [<8001269c>] (show_stack+0x10/0x14) -[<8001269c>] (show_stack) from [<80730464>] (dump_stack+0x84/0xc4) -[<80730464>] (dump_stack) from [<8002d220>] (warn_slowpath_common+0x80/0xb0) -[<8002d220>] (warn_slowpath_common) from [<8002d2ec>] (warn_slowpath_null+0x1c/0x24) -[<8002d2ec>] (warn_slowpath_null) from [<806bdad8>] (cfg80211_netdev_notifier_call+0x3a0/0x574) -[<806bdad8>] (cfg80211_netdev_notifier_call) from [<800462b8>] (notifier_call_chain+0x44/0x84) -[<800462b8>] (notifier_call_chain) from [<8004642c>] (raw_notifier_call_chain+0x18/0x20) -[<8004642c>] (raw_notifier_call_chain) from [<8057f8fc>] (rollback_registered_many+0x2a0/0x3a4) -[<8057f8fc>] (rollback_registered_many) from [<8057fa24>] (rollback_registered+0x24/0x38) -[<8057fa24>] (rollback_registered) from [<80581d24>] (unregister_netdevice_queue+0x54/0xb0) -[<80581d24>] (unregister_netdevice_queue) from [<80581d98>] (unregister_netdev+0x18/0x20) -[<80581d98>] (unregister_netdev) from [<7f02363c>] (hdd_close_all_adapters+0x7c/0xbc [wlan]) -[<7f02363c>] (hdd_close_all_adapters [wlan]) from [<7f025be4>] (hdd_wlan_exit+0x2e4/0x72c [wlan]) -[<7f025be4>] (hdd_wlan_exit [wlan]) from [<7f0260c8>] (__hdd_wlan_exit+0x9c/0xe4 [wlan]) -[<7f0260c8>] (__hdd_wlan_exit [wlan]) from [<7f1c3238>] (ath_hif_sdio_remove+0x54/0xfc [wlan]) -[<7f1c3238>] (ath_hif_sdio_remove [wlan]) from [<7f1c5de0>] (hifDeviceRemoved+0x7c/0x16c [wlan]) -[<7f1c5de0>] (hifDeviceRemoved [wlan]) from [<804e9c8c>] (sdio_bus_remove+0x30/0xf8) -[<804e9c8c>] (sdio_bus_remove) from [<8036f598>] (__device_release_driver+0x70/0xe4) -[<8036f598>] (__device_release_driver) from [<8036fd34>] (driver_detach+0xac/0xb0) -[<8036fd34>] (driver_detach) from [<8036f2f8>] (bus_remove_driver+0x4c/0xa0) -[<8036f2f8>] (bus_remove_driver) from [<7f1c53a8>] (HIFShutDownDevice+0xbc/0x17c [wlan]) -[<7f1c53a8>] (HIFShutDownDevice [wlan]) from [<7f1c36c4>] (hif_unregister_driver+0x28/0x48 [wlan]) -[<7f1c36c4>] (hif_unregister_driver [wlan]) from [<7f1d2fa8>] (hdd_module_exit+0x140/0x18c [wlan]) -[<7f1d2fa8>] (hdd_module_exit [wlan]) from [<8008ae18>] (SyS_delete_module+0x174/0x1b8) -[<8008ae18>] (SyS_delete_module) from [<8000f400>] (ret_fast_syscall+0x0/0x3c) ----[ end trace cb71790dd22e980e ]--- - -https://jira.digi.com/browse/DEL-3365 - -Signed-off-by: Alex Gonzalez ---- - CORE/HDD/src/wlan_hdd_cfg80211.c | 3 +++ - CORE/HDD/src/wlan_hdd_main.c | 5 +++++ - 2 files changed, 8 insertions(+) - -diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c -index 43543a9a473d..ae86c88fcfa5 100644 ---- a/CORE/HDD/src/wlan_hdd_cfg80211.c -+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c -@@ -11038,6 +11038,9 @@ disconnected: - FL("Set HDD connState to eConnectionState_NotConnected")); - pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; - -+ /* indicate disconnected event to nl80211 */ -+ cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED, NULL, 0, -+ GFP_KERNEL); - return 0; - } - -diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c -index df5b1065d463..f057f8c177b1 100755 ---- a/CORE/HDD/src/wlan_hdd_main.c -+++ b/CORE/HDD/src/wlan_hdd_main.c -@@ -9536,6 +9536,11 @@ VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, - "%s: wait on disconnect_comp_var failed", - __func__); - } -+ else -+ { -+ cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED, -+ NULL, 0, GFP_KERNEL); -+ } - } - else - { diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch deleted file mode 100644 index 7478b9ad3..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Alex Gonzalez -Date: Thu, 15 Dec 2016 13:31:12 +0100 -Subject: [PATCH] wdd_hdd_main: Print con_mode to clearly see if in FTM mode. - -We use FTM mode for RF testing. - -Signed-off-by: Alex Gonzalez ---- - CORE/HDD/src/wlan_hdd_main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c -index f057f8c177b1..d83602740b94 100755 ---- a/CORE/HDD/src/wlan_hdd_main.c -+++ b/CORE/HDD/src/wlan_hdd_main.c -@@ -12607,8 +12607,8 @@ static int hdd_driver_init( void) - #ifdef HDD_TRACE_RECORD - MTRACE(hddTraceInit()); - #endif -- pr_info("%s: loading driver v%s\n", WLAN_MODULE_NAME, -- QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR); -+ pr_info("%s: loading driver v%s in mode %d\n", WLAN_MODULE_NAME, -+ QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR, con_mode); - - do { - diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch deleted file mode 100644 index cb1d3be24..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Alex Gonzalez -Date: Mon, 9 Jan 2017 16:51:17 +0100 -Subject: [PATCH] Makefile: Pass BUILD_DEBUG_VERSION to kbuild system. - -https://jira.digi.com/browse/DEL-3392 - -Signed-off-by: Alex Gonzalez ---- - Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile b/Makefile -index c05b00f26c57..25cec85a0c1e 100644 ---- a/Makefile -+++ b/Makefile -@@ -16,6 +16,7 @@ KBUILD_OPTIONS += CONFIG_QCA_WIFI_ISOC=0 - KBUILD_OPTIONS += CONFIG_QCA_WIFI_2_0=1 - KBUILD_OPTIONS += $(WLAN_SELECT) - KBUILD_OPTIONS += WLAN_OPEN_SOURCE=$(WLAN_OPEN_SOURCE) -+KBUILD_OPTIONS += BUILD_DEBUG_VERSION=$(BUILD_DEBUG_VERSION) - KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any - - all: diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch deleted file mode 100644 index 2b2c6c8fb..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Pedro Perez de Heredia -Date: Mon, 13 Feb 2017 09:43:50 +0100 -Subject: [PATCH] kernel-module-qualcomm: cosmetic change log level for anoying - driver messages - -Signed-off-by: Pedro Perez de Heredia ---- - CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 4 ++-- - CORE/SVC/src/logging/wlan_logging_sock_svc.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -index 1a1e51e..ee2af05 100644 ---- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -+++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c -@@ -1202,7 +1202,7 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe - clock = device->host->f_max; - } - -- printk(KERN_ERR "%s: Dumping clocks (%d,%d)\n", __func__, func->card->cis.max_dtr, device->host->f_max); -+ pr_info("%s: Dumping clocks (%d,%d)\n", __func__, func->card->cis.max_dtr, device->host->f_max); - - /* - // We don't need to set the clock explicitly on 8064/ADP platforms. -@@ -1513,7 +1513,7 @@ static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func) - sdio_release_host(func); - return A_ERROR; - } -- printk(KERN_ERR"AR6000: Set async interrupt delay clock as %d.\n", asyncintdelay); -+ pr_info("AR6000: Set async interrupt delay clock as %d.\n", asyncintdelay); - } - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c -index 0253215..379d878 100644 ---- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c -+++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c -@@ -431,13 +431,13 @@ static int wlan_logging_thread(void *Arg) - || gwlan_logging.exit)); - - if (ret_wait_status == -ERESTARTSYS) { -- pr_err("%s: wait_event_interruptible returned -ERESTARTSYS", -+ pr_info("%s: wait_event_interruptible returned -ERESTARTSYS", - __func__); - break; - } - - if (gwlan_logging.exit) { -- pr_err("%s: Exiting the thread\n", __func__); -+ pr_info("%s: Exiting the thread\n", __func__); - break; - } - diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch deleted file mode 100644 index 6f1f6fb51..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch +++ /dev/null @@ -1,102 +0,0 @@ -From: Pedro Perez de Heredia -Date: Mon, 13 Feb 2017 10:28:35 +0100 -Subject: [PATCH] kernel-module-qualcomm: fix issue with _scan_callback at - module unload - -Protect the invocation of the _scan_done() callback function with the -global lock to avoid that it is called while the module is being unloaded -and the data structures have been freed. - -https://jira.digi.com/browse/DEL-3607 -https://jira.digi.com/browse/DEL-3393 - -Signed-off-by: Pedro Perez de Heredia ---- - CORE/SME/src/csr/csrApiScan.c | 43 +++++++++++++++++++++++++++++-------------- - 1 file changed, 29 insertions(+), 14 deletions(-) - -diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c -index 83a74cb..2f90cce 100644 ---- a/CORE/SME/src/csr/csrApiScan.c -+++ b/CORE/SME/src/csr/csrApiScan.c -@@ -6420,13 +6420,20 @@ eHalStatus csrScanFreeRequest(tpAniSirGlobal pMac, tCsrScanRequest *pReq) - - void csrScanCallCallback(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus scanStatus) - { -- if(pCommand->u.scanCmd.callback) -+ eHalStatus status; -+ -+ status = sme_AcquireGlobalLock( &pMac->sme ); -+ if ( HAL_STATUS_SUCCESS( status ) ) - { -- pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, -- pCommand->sessionId, -- pCommand->u.scanCmd.scanID, scanStatus); -- } else { -- smsLog( pMac, LOG2, "%s:%d - Callback NULL!!!", __func__, __LINE__); -+ if(pCommand->u.scanCmd.callback) -+ { -+ pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, -+ pCommand->sessionId, -+ pCommand->u.scanCmd.scanID, scanStatus); -+ } else { -+ smsLog( pMac, LOG2, "%s:%d - Callback NULL!!!", __func__, __LINE__); -+ } -+ sme_ReleaseGlobalLock( &pMac->sme ); - } - } - -@@ -7126,6 +7133,7 @@ tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionI - tSmeCmd *pCommand; - tDblLinkList localList; - tDblLinkList *pCmdList; -+ eHalStatus status; - - vos_mem_zero(&localList, sizeof(tDblLinkList)); - if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) -@@ -7178,15 +7186,21 @@ tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionI - while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) - { - pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); -- if (pCommand->u.scanCmd.callback) -+ -+ status = sme_AcquireGlobalLock( &pMac->sme ); -+ if ( HAL_STATUS_SUCCESS( status ) ) - { -- /* User scan request is pending, -+ if (pCommand->u.scanCmd.callback) -+ { -+ /* User scan request is pending, - * send response with status eCSR_SCAN_ABORT*/ -- pCommand->u.scanCmd.callback(pMac, -- pCommand->u.scanCmd.pContext, -- sessionId, -- pCommand->u.scanCmd.scanID, -- eCSR_SCAN_ABORT); -+ pCommand->u.scanCmd.callback(pMac, -+ pCommand->u.scanCmd.pContext, -+ sessionId, -+ pCommand->u.scanCmd.scanID, -+ eCSR_SCAN_ABORT); -+ } -+ sme_ReleaseGlobalLock( &pMac->sme ); - } - csrReleaseCommandScan( pMac, pCommand ); - } -@@ -8015,7 +8029,6 @@ eHalStatus csrProcessSetBGScanParam(tpAniSirGlobal pMac, tSmeCmd *pCommand) - return (status); - } - -- - eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac, tANI_U8 sessionId, - eCsrAbortReason reason) - { -@@ -8035,6 +8048,8 @@ eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac, tANI_U8 sessionId, - { - - pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); -+ pCommand->u.scanCmd.callback = NULL; -+ pCommand->u.scanCmd.pContext = NULL; - csrAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE); - } - csrLLUnlock(&pMac->scan.scanCmdPendingList); diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-sdio-qcom.rules b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-sdio-qcom.rules new file mode 100644 index 000000000..a69152b59 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-sdio-qcom.rules @@ -0,0 +1,2 @@ +# Load Qualcomm wireless module +SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/etc/udev/scripts/qualcomm.sh" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf index 313d88b5c..13852c0cd 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf @@ -1,4 +1,3 @@ -install wlan true # Load the wlan module with values for SDIO3.0. options wlan asyncintdelay=0x2 writecccr1=0xf2 writecccr1value=0xf \ writecccr2=0xf1 writecccr2value=0xa8 writecccr3=0xf0 \ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up deleted file mode 100644 index 89efc7e75..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh -#=============================================================================== -# -# qualcomm-pre-up -# -# Copyright (C) 2016 by Digi International Inc. -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published by -# the Free Software Foundation. -# -# -# !Description: Load Qualcomm' wireless driver -# -#=============================================================================== - -[ "${IFACE}" != "wlan0" ] && [ "${IFACE}" != "p2p0" ] && exit 0 - -# If the qualcomm driver is already loaded exit -grep -qws 'wlan' /proc/modules && exit 0 - -FIRMWARE_DIR="/lib/firmware" -MACFILE="${FIRMWARE_DIR}/wlan/wlan_mac.bin" -TMP_MACFILE="$(mktemp -t wlan_mac.XXXXXX)" - -# Read the MACs from DeviceTree. We can have up to four wireless interfaces -# The only required one is wlan0 that is mapped with device tree mac address -# without suffix. -for index in $(seq 0 3); do - DT_WLANx_MAC="/proc/device-tree/wireless/mac-address" - if [ "${index}" = "0" ]; then - # Set a default MAC for wlan0 - MAC_ADDR="00:04:F3:FF:FF:FB" - else - # Add the interface suffix for the device tree node - DT_WLANx_MAC=${DT_WLANx_MAC}${index} - MAC_ADDR="" - fi - - if [ -f "${DT_WLANx_MAC}" ]; then - MAC_ADDR="$(hexdump -ve '1/1 "%02X" ":"' ${DT_WLANx_MAC} | sed 's/:$//g')" - fi - - # Dump the MAC address in a file with the expected firmware format. - # example: Intf0MacAddress=0004f3fffffb - echo "Intf${index}MacAddress=${MAC_ADDR}" | sed s/://g >> ${TMP_MACFILE} -done - -# Override the MAC firmware file only if the MAC file has changed. -if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then - cp ${TMP_MACFILE} ${MACFILE} -fi -rm -f ${TMP_MACFILE} - -OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" -DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null)" -US_CODE="0x0" -WW_CODE="0x1" -JP_CODE="0x2" -# Check if the DTB_REGION_CODE is in the list of valid codes, -# if not use the OTP programmed value. -case "${DTB_REGION_CODE}" in - ${US_CODE}|${WW_CODE}|${JP_CODE}) - REGULATORY_DOMAIN=${DTB_REGION_CODE};; - *) - if [ -n "${DTB_REGION_CODE}" ]; then - logger -t qca6564 "[ERROR] Invalid region code in device tree, using OTP value" - fi - REGULATORY_DOMAIN=${OTP_REGION_CODE};; -esac - -BDATA_LINK="${FIRMWARE_DIR}/bdwlan30.bin" -UTFBDATA_LINK="${FIRMWARE_DIR}/utfbd30.bin" -# Create a symbolic links to the FW files for the specific country region. -BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_US.bin" -case "${REGULATORY_DOMAIN}" in - ${US_CODE}) - logger -t qca6564 "Setting US wireless region";; - ${WW_CODE}|${JP_CODE}) - logger -t qca6564 "Setting WW (world wide) wireless region" - BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_World.bin";; - "") - logger -t qca6564 "[WARN] region code not found, using US";; - *) - logger -t qca6564 "[WARN] Invalid region code, using US";; -esac - -# We don't want to rewrite NAND every time we boot so only -# change the links if they are wrong. -if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${BDATA_SOURCE}"; then - ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}" - ln -sf "${BDATA_SOURCE}" "${UTFBDATA_LINK}" -fi - -# Check the version of modprobe installed to compound the arguments. -if readlink -f $(which modprobe) | grep -qs kmod; then - MODPROBE_ARGS="-i" -fi -# Load the wireless module with the params defined in modprobe.d/qualcomm.conf -modprobe ${MODPROBE_ARGS} wlan - -# Validate that firmware was loaded by checking if the interface is present. -if [ -d "/sys/class/net/${IFACE}" ]; then - echo "Loading qca6564 module: [OK]" -else - echo "Loading qca6564 module: [FAILED]" - exit 1 -fi diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh new file mode 100644 index 000000000..71d81f3d5 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh @@ -0,0 +1,111 @@ +#!/bin/sh +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +# At this point of the boot (udev script), the system log (syslog) is not +# available yet, so use the kernel log buffer from userspace. +log() { + printf "<5>qca6564: $1\n" >/dev/kmsg +} + +# Do nothing if the module is already loaded +grep -qws 'wlan' /proc/modules && exit 0 + +FIRMWARE_DIR="/lib/firmware" +MACFILE="${FIRMWARE_DIR}/wlan/wlan_mac.bin" +TMP_MACFILE="$(mktemp -t wlan_mac.XXXXXX)" + +# Read the MACs from DeviceTree. We can have up to four wireless interfaces +# The only required one is wlan0 that is mapped with device tree mac address +# without suffix. +for index in $(seq 0 3); do + MAC_ADDR="$(hexdump -ve '1/1 "%02X"' /proc/device-tree/wireless/mac-address${index%0} 2>/dev/null)" + if [ "${index}" = "0" ] && { [ -z "${MAC_ADDR}" ] || [ "${MAC_ADDR}" = "00:00:00:00:00:00" ]; }; then + # Set a default MAC for wlan0 + MAC_ADDR="0004F3FFFFFB" + fi + + # Add the MAC address to the firmware file with the expected format + echo "Intf${index}MacAddress=${MAC_ADDR}" >> ${TMP_MACFILE} +done + +# Override the MAC firmware file only if the MAC file has changed. +if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then + cp ${TMP_MACFILE} ${MACFILE} +fi +rm -f "${TMP_MACFILE}" + +OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" +DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null)" +US_CODE="0x0" +WW_CODE="0x1" +JP_CODE="0x2" +# Check if the DTB_REGION_CODE is in the list of valid codes, +# if not use the OTP programmed value. +case "${DTB_REGION_CODE}" in + ${US_CODE} | ${WW_CODE} | ${JP_CODE}) + REGULATORY_DOMAIN="${DTB_REGION_CODE}";; + *) + if [ -n "${DTB_REGION_CODE}" ]; then + log "[WARN] Invalid region code in device tree, using OTP value" + fi + REGULATORY_DOMAIN="${OTP_REGION_CODE}";; +esac + + +# Create symbolic links to the proper FW files depending on the country region +# Use a sub-shell here to change to firmware directory +( + cd "${FIRMWARE_DIR}" + + BDATA_SOURCE="bdwlan30_US.bin" + case "${REGULATORY_DOMAIN}" in + ${US_CODE}) + log "Setting US wireless region";; + ${WW_CODE}|${JP_CODE}) + if [ -f "bdwlan30_World.bin" ]; then + log "Setting WW (world wide) wireless region" + BDATA_SOURCE="bdwlan30_World.bin" + else + log "[WARN] No WW (worldwide) board data file, using US" + fi + ;; + "") + log "[WARN] region code not found, using US";; + *) + log "[WARN] Invalid region code, using US";; + esac + + # We don't want to rewrite NAND every time we boot so only + # change the links if they are wrong. + BDATA_LINK="bdwlan30.bin" + UTFBDATA_LINK="utfbd30.bin" + if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${BDATA_SOURCE}"; then + ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}" + ln -sf "${BDATA_SOURCE}" "${UTFBDATA_LINK}" + fi +) + +# Load the wireless module with the params defined in modprobe.d/qualcomm.conf +modprobe wlan + +# Verify the interface is present +if [ -d "/sys/class/net/wlan0" ]; then + # Create 'wlan1' virtual interface + virtwlans.sh +else + log "[ERROR] Loading qca6564 module" +fi diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig new file mode 100644 index 000000000..3ffe94b7d --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig @@ -0,0 +1,339 @@ +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_KERNEL_LZO=y +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_FHANDLE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_CGROUPS=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_MEMCG_KMEM=y +CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_EMBEDDED=y +CONFIG_PERF_EVENTS=y +# CONFIG_SLUB_DEBUG is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_ARCH_MXC=y +CONFIG_SOC_IMX51=y +CONFIG_SOC_IMX53=y +CONFIG_SOC_IMX6Q=y +CONFIG_SOC_IMX6SL=y +CONFIG_SOC_IMX6SX=y +CONFIG_SOC_IMX6UL=y +CONFIG_SOC_IMX7D=y +CONFIG_SOC_VF610=y +CONFIG_PCI=y +CONFIG_PCI_MSI=y +CONFIG_PCI_IMX6=y +CONFIG_SMP=y +CONFIG_VMSPLIT_2G=y +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_AEABI=y +CONFIG_HIGHMEM=y +CONFIG_CMA=y +CONFIG_SECCOMP=y +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_ARM_IMX6Q_CPUFREQ=y +CONFIG_ARM_IMX7D_CPUFREQ=y +CONFIG_CPU_IDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_PM_DEBUG=y +CONFIG_PM_TEST_SUSPEND=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_SYN_COOKIES=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +CONFIG_IPV6=y +CONFIG_NETFILTER=y +CONFIG_BRIDGE=y +CONFIG_NET_SCHED=y +CONFIG_CAN=y +CONFIG_CAN_FLEXCAN=y +CONFIG_BT=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=y +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_CFG80211=y +CONFIG_CFG80211_CERTIFICATION_ONUS=y +CONFIG_CFG80211_WEXT=y +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_STANDALONE is not set +# CONFIG_FW_LOADER_USER_HELPER is not set +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_PERCENTAGE=40 +CONFIG_CMA_SIZE_SEL_PERCENTAGE=y +CONFIG_IMX_WEIM=y +CONFIG_CONNECTOR=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=65536 +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +# CONFIG_SCSI_PROC_FS is not set +CONFIG_BLK_DEV_SD=y +CONFIG_SCSI_CONSTANTS=y +CONFIG_SCSI_LOGGING=y +CONFIG_SCSI_SCAN_ASYNC=y +# CONFIG_SCSI_LOWLEVEL is not set +CONFIG_ATA=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_AHCI_IMX=y +CONFIG_PATA_IMX=y +CONFIG_MD=y +CONFIG_BLK_DEV_DM=y +CONFIG_DM_CRYPT=y +CONFIG_NETDEVICES=y +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_SMSC_PHY=y +CONFIG_MICREL_PHY=y +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_ASYNC=y +CONFIG_USB_USBNET=y +CONFIG_USB_NET_CDC_EEM=y +CONFIG_USB_NET_CDC_MBIM=y +CONFIG_USB_NET_QMI_WWAN=y +CONFIG_USB_SIERRA_NET=y +CONFIG_ATH_CARDS=y +CONFIG_ATH6KL=m +CONFIG_ATH6KL_SDIO=m +CONFIG_ATH6KL_DEBUG=y +CONFIG_ATH6KL_REGDOMAIN=y +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_IMX=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_FUSION_7_10=y +CONFIG_TOUCHSCREEN_MC13783=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_MMA8450=y +CONFIG_INPUT_DA9063_ONKEY=y +CONFIG_INPUT_ISL29023=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_DEVKMEM is not set +CONFIG_SERIAL_IMX=y +CONFIG_SERIAL_IMX_CONSOLE=y +CONFIG_SERIAL_FSL_LPUART=y +CONFIG_SERIAL_FSL_LPUART_CONSOLE=y +CONFIG_FSL_OTP=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +# CONFIG_I2C_HELPER_AUTO is not set +CONFIG_I2C_IMX=y +CONFIG_SPI=y +CONFIG_SPI_IMX=y +CONFIG_SPI_SPIDEV=y +CONFIG_SPI_SLAVE=y +CONFIG_SPI_SLAVE_TIME=y +CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_DA9063=y +CONFIG_POWER_SUPPLY=y +CONFIG_SENSORS_DA9063=y +CONFIG_SENSORS_MAG3110=y +CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y +CONFIG_IMX_THERMAL=y +CONFIG_DEVICE_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_IMX2_WDT=y +CONFIG_MFD_DA9052_I2C=y +CONFIG_MFD_DA9063=y +CONFIG_MFD_MC13XXX_SPI=y +CONFIG_MFD_MC13XXX_I2C=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_ANATOP=y +CONFIG_REGULATOR_DA9052=y +CONFIG_REGULATOR_DA9063=y +CONFIG_REGULATOR_MC13783=y +CONFIG_REGULATOR_MC13892=y +CONFIG_REGULATOR_PFUZE100=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +# CONFIG_USB_GSPCA is not set +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_VIDEO_MXC_OUTPUT=y +CONFIG_VIDEO_MXC_CAPTURE=y +CONFIG_MXC_CAMERA_OV5642=y +CONFIG_MXC_CAMERA_OV5640_MIPI=y +CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y +CONFIG_VIDEO_MXC_IPU_OUTPUT=y +CONFIG_VIDEO_MXC_PXP_V4L2=y +CONFIG_SOC_CAMERA=y +CONFIG_VIDEO_MX3=y +CONFIG_SOC_CAMERA_OV2640=y +# CONFIG_VGA_ARB is not set +CONFIG_DRM=y +CONFIG_DRM_VIVANTE=y +CONFIG_FB=y +CONFIG_FB_MXS=y +CONFIG_FB_MXC_SYNC_PANEL=y +CONFIG_FB_MXC_MIPI_DSI=y +CONFIG_FB_MXC_TRULY_WVGA_SYNC_PANEL=y +CONFIG_FB_MXC_LDB=y +CONFIG_FB_MXC_HDMI=y +CONFIG_FB_MXC_AD9389=y +CONFIG_LCD_CLASS_DEVICE=y +CONFIG_LCD_L4F00242T03=y +CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_PWM=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_LOGO=y +CONFIG_FB_LOGO_CENTERED=y +CONFIG_FB_LOGO_FORCE_SINGLE=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +# CONFIG_LOGO_LINUX_CLUT224 is not set +CONFIG_SOUND=y +CONFIG_SND=y +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_VERBOSE_PROCFS is not set +# CONFIG_SND_DRIVERS is not set +# CONFIG_SND_PCI is not set +# CONFIG_SND_ARM is not set +# CONFIG_SND_SPI is not set +# CONFIG_SND_USB is not set +CONFIG_SND_SOC=y +CONFIG_SND_IMX_SOC=y +CONFIG_SND_SOC_IMX_SGTL5000=y +CONFIG_SND_SOC_IMX_HDMI=y +CONFIG_HID_MULTITOUCH=y +CONFIG_USB=y +CONFIG_USB_OTG=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_ACM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_QUALCOMM=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +CONFIG_USB_SERIAL_OPTION=y +CONFIG_USB_MXS_PHY=y +CONFIG_USB_GADGET=y +CONFIG_USB_ETH=m +CONFIG_USB_MASS_STORAGE=m +CONFIG_USB_G_SERIAL=m +CONFIG_USB_CDC_COMPOSITE=m +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_ESDHC_IMX=y +CONFIG_MXC_IPU=y +CONFIG_MXC_MIPI_CSI2=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_DA9063=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_INTF_DEV_UIE_EMUL=y +CONFIG_RTC_DRV_DA9063=y +CONFIG_RTC_DRV_MC13XXX=y +CONFIG_RTC_DRV_MXC=y +CONFIG_RTC_DRV_SNVS=y +CONFIG_DMADEVICES=y +CONFIG_MXC_PXP_V2=y +CONFIG_IMX_SDMA=y +CONFIG_MXS_DMA=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_PWM=y +CONFIG_PWM_IMX=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_OVERLAY_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_DEFAULT="cp437" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_850=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_UTF8=y +CONFIG_DYNAMIC_DEBUG=y +CONFIG_DEBUG_FS=y +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_FTRACE is not set +# CONFIG_ARM_UNWIND is not set +CONFIG_SECURITYFS=y +# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set +CONFIG_CRYPTO_TEST=m +CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_FONTS=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig index 165bec2c8..42dce6c8a 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig @@ -1,11 +1,26 @@ CONFIG_KERNEL_LZO=y CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_CGROUPS=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_MEMCG_KMEM=y +CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y # CONFIG_RD_LZMA is not set @@ -32,6 +47,7 @@ CONFIG_PREEMPT=y CONFIG_AEABI=y CONFIG_HIGHMEM=y CONFIG_CMA=y +CONFIG_SECCOMP=y CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y @@ -155,6 +171,7 @@ CONFIG_TOUCHSCREEN_IMX6UL_TSC=y CONFIG_INPUT_MISC=y CONFIG_INPUT_MCA_CC6UL_PWRKEY=y # CONFIG_SERIO_SERPORT is not set +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y # CONFIG_LEGACY_PTYS is not set # CONFIG_DEVKMEM is not set CONFIG_SERIAL_IMX=y @@ -169,6 +186,9 @@ CONFIG_SPI=y CONFIG_SPI_GPIO=y CONFIG_SPI_IMX=y CONFIG_SPI_SPIDEV=y +CONFIG_SPI_SLAVE=y +CONFIG_SPI_SLAVE_TIME=y +CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_MCA_CC6UL=y CONFIG_POWER_SUPPLY=y @@ -293,6 +313,7 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_AUTOFS4_FS=y +CONFIG_OVERLAY_FS=y CONFIG_VFAT_FS=y CONFIG_TMPFS=y CONFIG_UBIFS_FS=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb index b2a62d6db..3718a6da4 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2016 Digi International +# Copyright (C) 2016, 2017 Digi International require recipes-kernel/linux/linux-dey.inc require recipes-kernel/linux/linux-dtb.inc @@ -6,4 +6,4 @@ require recipes-kernel/linux/linux-dtb.inc SRCBRANCH = "v4.1/dey-2.2/maint" SRCREV = "${AUTOREV}" -COMPATIBLE_MACHINE = "(ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/classes/aws-iot.bbclass b/meta-digi-dey/classes/aws-iot.bbclass new file mode 100644 index 000000000..259506024 --- /dev/null +++ b/meta-digi-dey/classes/aws-iot.bbclass @@ -0,0 +1,110 @@ +# Adds AWS IoT device SDK for embedded C configuration +# + +# Customer specific MQTT HOST +AWS_IOT_MQTT_HOST ?= "" + +# Default port for MQTT/S +AWS_IOT_MQTT_PORT ?= "8883" + +# Thing Name of the Shadow the device is associated with +AWS_IOT_MY_THING_NAME ?= "AWS-IoT-C-SDK" + +# Root CA file name +AWS_IOT_ROOT_CA_FILENAME ?= "rootCA.crt" + +# Device signed certificate file name +AWS_IOT_CERTIFICATE_FILENAME ?= "cert.pem" + +# Device private key filename +AWS_IOT_PRIVATE_KEY_FILENAME ?= "privkey.pem" + +# MQTT PubSub + +# Any time a message is sent out through the MQTT layer. The message is copied +# into this buffer anytime a publish is done. +# This will also be used in the case of Thing Shadow +AWS_IOT_MQTT_TX_BUF_LEN ?= "512" + +# Any message that comes into the device should be less than this buffer size. +# If a received message is bigger than this buffer size the message will be +# dropped +AWS_IOT_MQTT_RX_BUF_LEN ?= "512" + +# Maximum number of topic filters the MQTT client can handle at any given time. +# This should be increased appropriately when using Thing Shadow +AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS ?= "5" + +# Thing Shadow specific configs + +# At any given time we will wait for this many responses. +# This will correlate to the rate at which the shadow actions are requested +MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME ?= "10" + +# We could perform shadow action on any thing Name and this is maximum Thing +# Names we can act on at any given time +MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME ?= "10" + +# These are the max tokens that is expected to be in the Shadow JSON document. +# It includes the metadata that gets published +MAX_JSON_TOKEN_EXPECTED ?= "120" + +# The Thing Name should not be bigger than this value. Modify this if the Thing +# Name needs to be bigger +MAX_SIZE_OF_THING_NAME ?= "20" + +# Auto Reconnect specific config + +# Minimum time before the First reconnect attempt is made as part of the +# exponential back-off algorithm (milliseconds) +AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL ?= "1000" + +# Maximum time interval after which exponential back-off will stop attempting +# to reconnect (milliseconds) +AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ?= "128000" + +# Logging level control: error, warn, info, debug, trace. +AWS_IOT_LOGGING_LEVEL ?= "debug" + +def get_log_level(d): + levels = ['error', 'warn', 'info', 'debug', 'trace'] + log_flags = "" + + log_level = d.getVar('AWS_IOT_LOGGING_LEVEL', True) + if log_level == 'none': + return "" + if log_level not in levels: + log_level = "debug" + d.setVar('AWS_IOT_LOGGING_LEVEL', log_level) + + log_index = levels.index(log_level) + for i, val in enumerate(levels): + log_flags = log_flags + "-DENABLE_IOT_" + val.upper() + " " + if i == log_index: + break; + + return log_flags + +####################### +# AWS Greengrass Core # +####################### + +# +# Verisign root CA server certificate used to authenticate the AWS IoT server. +# +# https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem +# +AWS_GGCORE_ROOT_CA ?= "aws-root-ca.pem" + +# Greengrass core device certificate +AWS_GGCORE_CERTIFICATE ?= "gg-core.pem" + +# Greengrass core device private key +AWS_GGCORE_PRIVATE_KEY ?= "gg-core.key" + +# Greengrass core Thing ARN +AWS_GGCORE_THING_ARN ?= "" + +# AWS IoT endpoint (check your account) +# CLI: aws iot describe-endpoint +AWS_GGCORE_IOT_HOST ?= "" diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index f0750c6b3..2c5c10fe4 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -1,6 +1,6 @@ DISTRO = "dey" DISTRO_NAME = "Digi Embedded Yocto" -DISTRO_VERSION = "2.2-r1" +DISTRO_VERSION = "2.2-r2" DISTRO_CODENAME = "morty" SDK_VENDOR = "-deysdk" SDK_VERSION := "${@'${DISTRO_VERSION}'}" diff --git a/meta-digi-dey/conf/layer.conf b/meta-digi-dey/conf/layer.conf index f0737ec43..421d4d2f6 100644 --- a/meta-digi-dey/conf/layer.conf +++ b/meta-digi-dey/conf/layer.conf @@ -21,6 +21,9 @@ LAYERDEPENDS_digi-dey += "openembedded-layer networking-layer webserver qt5-laye DIGI_EULA_FILE = "${LAYERDIR}/DIGI_EULA" DIGI_OPEN_EULA_FILE = "${LAYERDIR}/DIGI_OPEN_EULA" +# Additional license directories +LICENSE_PATH += "${LAYERDIR}/custom-licenses" + # Digi mirror for packages vanished upstream DIGI_MIRROR ?= "ftp://ftp1.digi.com/support/digiembeddedyocto/mirror/" MIRRORS += "\ diff --git a/meta-digi-dey/custom-licenses/ATMEL_CRYPTOAUTHLIB_LICENSE b/meta-digi-dey/custom-licenses/ATMEL_CRYPTOAUTHLIB_LICENSE new file mode 100644 index 000000000..9e033a8a6 --- /dev/null +++ b/meta-digi-dey/custom-licenses/ATMEL_CRYPTOAUTHLIB_LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2015 Atmel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. The name of Atmel may not be used to endorse or promote products derived + from this software without specific prior written permission. + +4. This software may only be redistributed and used in connection with an + Atmel integrated circuit. + +THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE +EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/Makefile b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/Makefile new file mode 100644 index 000000000..6373338b7 --- /dev/null +++ b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/Makefile @@ -0,0 +1,31 @@ +# *************************************************************************** +# Copyright (c) 2017 Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 +# +# *************************************************************************** + +SUBDIRS := src + +all: $(SUBDIRS) + +.PHONY: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: clean install +clean install: + for a in $(SUBDIRS); do $(MAKE) -C $$a $@; done + diff --git a/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/Makefile.lib b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/Makefile.lib new file mode 100644 index 000000000..ff4ad1835 --- /dev/null +++ b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/Makefile.lib @@ -0,0 +1,79 @@ +# *************************************************************************** +# Copyright (c) 2017 Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 +# +# *************************************************************************** +# Use GNU C Compiler. +CC ?= gcc + +# Generated Library name. +NAME := awsiotsdk + +# Location of Source Code. +SRC = . + +#IoT client directory. +IOT_CLIENT_DIR = $(SRC)/.. + +PLATFORM_DIR = $(IOT_CLIENT_DIR)/platform/linux/mbedtls +PLATFORM_COMMON_DIR = $(IOT_CLIENT_DIR)/platform/linux/common +INSTALL_HEADERS_DIR = /usr/include/awsiotsdk + +CFLAGS += -I $(IOT_CLIENT_DIR)/include +CFLAGS += -I $(IOT_CLIENT_DIR)/external_libs/jsmn +CFLAGS += -I $(PLATFORM_COMMON_DIR) +CFLAGS += -I $(PLATFORM_DIR) +CFLAGS += -Wall -g +CFLAGS += $(LOG_FLAGS) +CFLAGS += $(shell pkg-config --cflags mbedtls) + +# Libraries to Link. +LIBS += $(shell pkg-config --libs --static mbedtls) + +# Linking Flags. +LDFLAGS += $(DFLAGS) + +# Target output to generate. +SRCS += $(wildcard $(SRC)/*.c) +SRCS += $(wildcard $(IOT_CLIENT_DIR)/external_libs/jsmn/*.c) +SRCS += $(wildcard $(PLATFORM_DIR)/*.c) +SRCS += $(wildcard $(PLATFORM_COMMON_DIR)/*.c) + +OBJS = $(SRCS:.c=.o) + +.PHONY: all +all: lib$(NAME).a + +lib$(NAME).a: $(OBJS) + $(AR) -rcs $@ $^ + +.PHONY: install +install: lib$(NAME).a + # Install library and pkg-config file. + install -d $(DESTDIR)/usr/lib/pkgconfig + install -m 0644 lib$(NAME).a $(DESTDIR)/usr/lib/ + install -m 0644 ../awsiotsdk.pc $(DESTDIR)/usr/lib/pkgconfig/ + # Install header files. + install -d $(DESTDIR)$(INSTALL_HEADERS_DIR) + install -m 0644 $(IOT_CLIENT_DIR)/include/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/ + install -m 0644 $(IOT_CLIENT_DIR)/external_libs/jsmn/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/ + install -m 0644 $(PLATFORM_COMMON_DIR)/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/ + install -m 0644 $(PLATFORM_DIR)/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/ + +.PHONY: clean +clean: + -rm -f lib$(NAME).a $(OBJS) + diff --git a/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/aws_iot_config.h.template b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/aws_iot_config.h.template new file mode 100644 index 000000000..a2375a657 --- /dev/null +++ b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/aws_iot_config.h.template @@ -0,0 +1,98 @@ +/* + * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * @file aws_iot_config.h + * @brief AWS IoT specific configuration file + */ + +#ifndef SRC_SHADOW_IOT_SHADOW_CONFIG_H_ +#define SRC_SHADOW_IOT_SHADOW_CONFIG_H_ + +/* Get from console */ +/* ================================================= */ +/* Customer specific MQTT HOST. The same will be used for Thing Shadow */ +#define AWS_IOT_MQTT_HOST "##AWS_IOT_MQTT_HOST##" +/* Default port for MQTT/S */ +#define AWS_IOT_MQTT_PORT ##AWS_IOT_MQTT_PORT## +/* Thing Name of the Shadow this device is associated with */ +#define AWS_IOT_MY_THING_NAME "##AWS_IOT_MY_THING_NAME##" +/* MQTT client ID should be unique for every device */ +#define AWS_IOT_MQTT_CLIENT_ID AWS_IOT_MY_THING_NAME +/* Root CA file name */ +#define AWS_IOT_ROOT_CA_FILENAME "##AWS_IOT_ROOT_CA_FILENAME##" +/* Device signed certificate file name */ +#define AWS_IOT_CERTIFICATE_FILENAME "##AWS_IOT_CERTIFICATE_FILENAME##" +/* Device private key filename */ +#define AWS_IOT_PRIVATE_KEY_FILENAME "##AWS_IOT_PRIVATE_KEY_FILENAME##" +/* ================================================= */ + +/* MQTT PubSub */ +/* ================================================= */ +/* Any time a message is sent out through the MQTT layer. The message is copied + * into this buffer anytime a publish is done. + * This will also be used in the case of Thing Shadow */ +#define AWS_IOT_MQTT_TX_BUF_LEN ##AWS_IOT_MQTT_TX_BUF_LEN## +/* Any message that comes into the device should be less than this buffer size. + * If a received message is bigger than this buffer size the message will be + * dropped. */ +#define AWS_IOT_MQTT_RX_BUF_LEN ##AWS_IOT_MQTT_RX_BUF_LEN## +/* Maximum number of topic filters the MQTT client can handle at any given time. + * This should be increased appropriately when using Thing Shadow */ +#define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS ##AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS## + +/* Thing Shadow specific configs */ +/* Maximum size of the Shadow buffer to store the received Shadow message */ +#define SHADOW_MAX_SIZE_OF_RX_BUFFER AWS_IOT_MQTT_RX_BUF_LEN + 1 +/* Maximum size of the Unique Client Id. + * For More info on the Client Id refer \ref response "Acknowledgments" */ +#define MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES 80 +/* This is size of the extra sequence number that will be appended to the + * Unique client Id */ +#define MAX_SIZE_CLIENT_ID_WITH_SEQUENCE MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + 10 +/* This is size of the the total clientToken key and value pair in the JSON */ +#define MAX_SIZE_CLIENT_TOKEN_CLIENT_SEQUENCE MAX_SIZE_CLIENT_ID_WITH_SEQUENCE + 20 +/* At any given time we will wait for this many responses. + * This will correlate to the rate at which the shadow actions are requested */ +#define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME ##MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME## +/* We could perform shadow action on any thing Name and this is maximum Thing + * Names we can act on at any given time */ +#define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME ##MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME## +/* These are the max tokens that is expected to be in the Shadow JSON document. + * It includes the metadata that gets published */ +#define MAX_JSON_TOKEN_EXPECTED ##MAX_JSON_TOKEN_EXPECTED## +/* All shadow actions have to be published or subscribed to a topic which is of + * the format $aws/things/{thingName}/shadow/update/accepted. + * This refers to the size of the topic without the Thing Name */ +#define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME 60 +/* The Thing Name should not be bigger than this value. Modify this if the + * Thing Name needs to be bigger */ +#define MAX_SIZE_OF_THING_NAME ##MAX_SIZE_OF_THING_NAME## +/* This size includes the length of topic with Thing Name */ +#define MAX_SHADOW_TOPIC_LENGTH_BYTES MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + MAX_SIZE_OF_THING_NAME +/* ================================================= */ + +/* Auto Reconnect specific config */ +/* ================================================= */ +/* Minimum time before the First reconnect attempt is made as part of the + * exponential back-off algorithm */ +#define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL ##AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL## +/* Maximum time interval after which exponential back-off will stop attempting + * to reconnect */ +#define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ##AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL## +/* ================================================= */ + +#endif /* SRC_SHADOW_IOT_SHADOW_CONFIG_H_ */ + diff --git a/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/awsiotsdk.pc b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/awsiotsdk.pc new file mode 100644 index 000000000..2c5037037 --- /dev/null +++ b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c-2.1.1/awsiotsdk.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: awsiotsdk +Description: SDK for connecting to AWS IoT from a device using embedded C +Version: 2.1.1 + +Requires.private: mbedtls +Libs: -L${libdir} -lawsiotsdk +Cflags: -I${includedir}/awsiotsdk -I${includedir} diff --git a/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c_2.1.1.bb b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c_2.1.1.bb new file mode 100644 index 000000000..a76e64115 --- /dev/null +++ b/meta-digi-dey/recipes-aws/awsiotsdk-c/awsiotsdk-c_2.1.1.bb @@ -0,0 +1,73 @@ +# Copyright (C) 2017 Digi International. + +SUMMARY = "SDK for connecting to AWS IoT from a device using embedded C" +HOMEPAGE = "https://github.com/aws/aws-iot-device-sdk-embedded-C" +SECTION = "base" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=acc7a1bf87c055789657b148939e4b40" + +DEPENDS = "mbedtls" + +SRC_URI = " \ + https://github.com/aws/aws-iot-device-sdk-embedded-C/archive/v${PV}.tar.gz;downloadfilename=${BP}.tar.gz \ + file://aws_iot_config.h.template \ + file://awsiotsdk.pc \ + file://Makefile \ + file://Makefile.lib \ +" + +SRC_URI[md5sum] = "2c415af16bbd68440b62d71a7e9775c5" +SRC_URI[sha256sum] = "74d434b3258654cea048b20eb52d4fc627f5c87e8727ce180a1d529e3285a97e" + +S = "${WORKDIR}/aws-iot-device-sdk-embedded-C-${PV}" + +inherit aws-iot pkgconfig + +EXTRA_OEMAKE += "'LOG_FLAGS=${@get_log_level(d)}'" + +do_configure() { + cp -f ${WORKDIR}/awsiotsdk.pc ${S} + + # Copy and update the configuration header file. + cp -f ${WORKDIR}/aws_iot_config.h.template ${S}/include/aws_iot_config.h + sed -i -e "s,##AWS_IOT_MQTT_HOST##,${AWS_IOT_MQTT_HOST},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MQTT_PORT##,${AWS_IOT_MQTT_PORT},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MY_THING_NAME##,${AWS_IOT_MY_THING_NAME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_ROOT_CA_FILENAME##,${AWS_IOT_ROOT_CA_FILENAME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_CERTIFICATE_FILENAME##,${AWS_IOT_CERTIFICATE_FILENAME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_PRIVATE_KEY_FILENAME##,${AWS_IOT_PRIVATE_KEY_FILENAME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MQTT_TX_BUF_LEN##,${AWS_IOT_MQTT_TX_BUF_LEN},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MQTT_RX_BUF_LEN##,${AWS_IOT_MQTT_RX_BUF_LEN},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS##,${AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME##,${MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME##,${MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##MAX_JSON_TOKEN_EXPECTED##,${MAX_JSON_TOKEN_EXPECTED},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##MAX_SIZE_OF_THING_NAME##,${MAX_SIZE_OF_THING_NAME},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL##,${AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL},g" "${S}/include/aws_iot_config.h" + sed -i -e "s,##AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL##,${AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL},g" "${S}/include/aws_iot_config.h" + + # Copy the Makefiles. + cp -f ${WORKDIR}/Makefile ${S} + cp -f ${WORKDIR}/Makefile.lib ${S}/src/Makefile +} + +do_install() { + oe_runmake DESTDIR=${D} install + + # Install certificates only if they exist. + if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_IOT_ROOT_CA_FILENAME}" ] && \ + [ -f "${AWS_IOT_CERTS_DIR}/${AWS_IOT_CERTIFICATE_FILENAME}" ] && \ + [ -f "${AWS_IOT_CERTS_DIR}/${AWS_IOT_PRIVATE_KEY_FILENAME}" ]; then + install -d ${D}${sysconfdir}/ssl/certs + install -m 0644 "${AWS_IOT_CERTS_DIR}/${AWS_IOT_ROOT_CA_FILENAME}" ${D}${sysconfdir}/ssl/certs/ + install -m 0644 "${AWS_IOT_CERTS_DIR}/${AWS_IOT_CERTIFICATE_FILENAME}" ${D}${sysconfdir}/ssl/certs/ + install -m 0644 "${AWS_IOT_CERTS_DIR}/${AWS_IOT_PRIVATE_KEY_FILENAME}" ${D}${sysconfdir}/ssl/certs/ + fi +} + +PACKAGES =+ "${PN}-cert" + +FILES_${PN}-cert = "${sysconfdir}/ssl/certs/" + +ALLOW_EMPTY_${PN} = "1" + diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch b/meta-digi-dey/recipes-aws/greengrass/greengrass/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch new file mode 100644 index 000000000..1a6f0046d --- /dev/null +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch @@ -0,0 +1,114 @@ +From: Javier Viguera +Date: Wed, 7 Jun 2017 20:44:56 +0200 +Subject: [PATCH] greengrassd: remove bashisms in launcher shell script + +So it runs properly in other Posix shells (like the one in Busybox) + +Signed-off-by: Javier Viguera +--- + greengrassd | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/greengrassd b/greengrassd +index cadaa6b0101e..e24422af2f3d 100755 +--- a/greengrassd ++++ b/greengrassd +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + ##########Environment Requirement for Greengrass Daemon########## + # by default, the daemon assumes it's going to be launched from a directory +@@ -38,19 +38,19 @@ setup() { + mkdir -p $GGC_ROOT_FS + + # Mask greengrass directory for containers +- mknod $GGC_ROOT_FS/greengrass c 1 3 &>/dev/null || true ++ mknod $GGC_ROOT_FS/greengrass c 1 3 >/dev/null 2>&1 || true + + } + + validatePlatformSecurity() { + +- if [[ -f $FS_SETTINGS/protected_hardlinks && +- -f $FS_SETTINGS/protected_symlinks ]]; then ++ if [ -f $FS_SETTINGS/protected_hardlinks ] && ++ [ -f $FS_SETTINGS/protected_symlinks ]; then + + PROT_HARDLINK_VAL=$(cat $FS_SETTINGS/protected_hardlinks) + PROT_SOFTLINK_VAL=$(cat $FS_SETTINGS/protected_symlinks) + +- if [[ "$PROT_HARDLINK_VAL" -ne 1 || "$PROT_SOFTLINK_VAL" -ne 1 ]]; then ++ if [ "$PROT_HARDLINK_VAL" -ne 1 ] || [ "$PROT_SOFTLINK_VAL" -ne 1 ]; then + echo "AWS Greengrass detected insecure OS configuration: No hardlink/softlink protection enabled." | tee -a $CRASH_LOG + exit 1 + fi +@@ -127,7 +127,7 @@ validateEnvironment() { + + start() { + setup +- if [[ $INSECURE -ne 1 ]]; then ++ if [ "${INSECURE}" != "1" ]; then + validatePlatformSecurity + fi + +@@ -139,7 +139,7 @@ start() { + then + pid=$! + # sleep 5 seconds to wait for daemon to start or exit +- for i in {1..5}; do ++ for i in $(seq 1 5); do + echo -n "." + sleep 1 + done +@@ -147,10 +147,10 @@ start() { + if [ -e "/proc/$pid" ] + then + echo "$pid" > $PID_FILE +- echo -e "\e[0;32mGreengrass daemon started with PID: $pid\e[0m" ++ printf "\e[0;32mGreengrass daemon started with PID: $pid\e[0m\n" + else + echo "Greengrass daemon $pid failed to start" +- echo -e "\e[0;31m$(cat $CRASH_LOG)\e[0m" ++ printf "\e[0;31m$(cat $CRASH_LOG)\e[0m\n" + exit 1 + fi + else +@@ -179,7 +179,7 @@ stop() { + # If the pid no longer exists, we're done, remove the pid file and exit. Otherwise, just increment the loop counter + if [ ! -e "/proc/$PID" ]; then + rm $PID_FILE +- echo -e "\nStopped greengrass daemon, exiting with success" ++ printf "\nStopped greengrass daemon, exiting with success\n" + break + else + total_sleep_seconds=$(($total_sleep_seconds+1)) +@@ -194,7 +194,7 @@ stop() { + + if [ $total_sleep_seconds -ge $MAX_DAEMON_KILL_WAIT_SECONDS ]; then + # If we are here, we never exited in the previous loop and the pid still exists. Exit with failure. +- echo -e "\nProcess with pid $PID still alive after timeout of $MAX_DAEMON_KILL_WAIT_SECONDS seconds. Unable to kill process, exiting with failure." ++ printf "\nProcess with pid $PID still alive after timeout of $MAX_DAEMON_KILL_WAIT_SECONDS seconds. Unable to kill process, exiting with failure.\n" + exit 1 + fi + fi +@@ -204,16 +204,16 @@ usage() { + echo "" + echo "Usage: $0 [FLAGS] {start|stop|restart}" + echo "" +- echo -e "[FLAGS]: -i, --insecure \t Run GGC in insecure mode without hardlink/softlink protection, (highly discouraged for production use)" ++ printf "[FLAGS]: -i, --insecure \t Run GGC in insecure mode without hardlink/softlink protection, (highly discouraged for production use)\n" + echo "" + exit 1 + } + +-if [[ $# -eq 0 ]]; then ++if [ $# -eq 0 ]; then + usage + fi + +-while [[ $# -gt 0 ]] ++while [ $# -gt 0 ] + do + key="$1" + case $key in diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init b/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init new file mode 100644 index 000000000..8af4aafde --- /dev/null +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Description: Wrapper bootscript for AWS Greengrass core +# + +GG_INSTALL_DIR="##GG_INSTALL_DIR##" +GG_LAUNCHER="${GG_INSTALL_DIR}/greengrassd" + +case "${1}" in + start | stop | restart) + ${GG_LAUNCHER} ${1} + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb new file mode 100644 index 000000000..af6c86b35 --- /dev/null +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.0.0.bb @@ -0,0 +1,201 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "AWS IoT Greengrass core" +HOMEPAGE = "https://aws.amazon.com/greengrass/" +# +# The package includes different licenses: +# +# [Apache-2.0] +# LICENSE/attributions/github_aws_aws_sdk_go_License.txt +# LICENSE/attributions/github_coreos_go_systemd_License.txt +# LICENSE/attributions/github_docker_docker_License.txt +# LICENSE/attributions/github_docker_go_units_License.txt +# LICENSE/attributions/github_go_ini_ini_License.txt +# LICENSE/attributions/github_jmespath_go_jmespath_License.txt +# LICENSE/attributions/github_opencontainers_runc_License.txt +# LICENSE/attributions/github_opencontainers_runtime_spec_License.txt +# LICENSE/attributions/github_pquerna_ffjson_License.txt +# LICENSE/attributions/github_vishvananda_netlink_License.txt +# [BSD-2-Clause] +# LICENSE/attributions/github_godbus_dbus_License.txt +# LICENSE/attributions/github_huin_gobinarytest_License.txt +# LICENSE/attributions/github_seccomp_libseccomp_golang_License.txt +# LICENSE/attributions/github_syndtr_gocapability_License.txt +# [BSD-3-Clause] +# LICENSE/attributions/github_golang_protobuf_License.txt +# LICENSE/attributions/github_jeffallen_mqtt_License.txt +# LICENSE/attributions/Golang_License.txt +# [MIT] +# LICENSE/attributions/github_huin_mqtt_License.txt +# LICENSE/attributions/github_mattn_go_sqlite3_License.txt +# LICENSE/attributions/github_nu7hatch_gouuid_License.txt +# LICENSE/attributions/github_Sirupsen_logrus_License.txt +# LICENSE/attributions/github_urfave_cli_License.txt +# LICENSE/attributions/github_yosssi_gmq_License.txt +# [PD] +# LICENSE/attributions/sqlite_org_License.txt +# [Proprietary] +# LICENSE/Greengrass AWS SW License (IoT additiona) vr6.txt +# +LICENSE = "Apache-2.0 | BSD-2-Clause | BSD-3-Clause | MIT | PD | Proprietary" +LIC_FILES_CHKSUM = " \ + file://LICENSE/attributions/github_aws_aws_sdk_go_License.txt;md5=d273d63619c9aeaf15cdaf76422c4f87 \ + file://LICENSE/attributions/github_coreos_go_systemd_License.txt;md5=715f3348ed8b9bf4fac3b08133384a4d \ + file://LICENSE/attributions/github_docker_docker_License.txt;md5=bba4ee48af378e39b452d742d29c710b \ + file://LICENSE/attributions/github_docker_go_units_License.txt;md5=bb99db20f1c48c2c4952c27c72855e36 \ + file://LICENSE/attributions/github_godbus_dbus_License.txt;md5=b03a62440372a9acf9692ad365932c87 \ + file://LICENSE/attributions/github_go_ini_ini_License.txt;md5=715f3348ed8b9bf4fac3b08133384a4d \ + file://LICENSE/attributions/github_golang_protobuf_License.txt;md5=16fe162f7848190010b6ec7bfaac030a \ + file://LICENSE/attributions/github_huin_gobinarytest_License.txt;md5=f2b3138d9d314bccf5297dea7e3e6d14 \ + file://LICENSE/attributions/github_huin_mqtt_License.txt;md5=12fd125064676697934b7d8c09bed0e8 \ + file://LICENSE/attributions/github_jeffallen_mqtt_License.txt;md5=b7269d52765d477e10f319c19d8a9d33 \ + file://LICENSE/attributions/github_jmespath_go_jmespath_License.txt;md5=640d33f0070c9dc3a194d2ed7db02974 \ + file://LICENSE/attributions/github_mattn_go_sqlite3_License.txt;md5=948f36a2300ac729e60416063190f664 \ + file://LICENSE/attributions/github_nu7hatch_gouuid_License.txt;md5=6b18748dcc29fda05fa5aaef44d517fd \ + file://LICENSE/attributions/github_opencontainers_runc_License.txt;md5=587c01b2dcc5dc3b4bed51b918c64731 \ + file://LICENSE/attributions/github_opencontainers_runtime_spec_License.txt;md5=ef95ed297310c3d09ba16c06d5e161a5 \ + file://LICENSE/attributions/github_pquerna_ffjson_License.txt;md5=d273d63619c9aeaf15cdaf76422c4f87 \ + file://LICENSE/attributions/github_seccomp_libseccomp_golang_License.txt;md5=9205c4c469bfb9d3a63f346539ee445b \ + file://LICENSE/attributions/github_Sirupsen_logrus_License.txt;md5=29baae91637760ae68feb57ca93e5a0a \ + file://LICENSE/attributions/github_syndtr_gocapability_License.txt;md5=321f58fa53a0b1bb9a887f14660d436b \ + file://LICENSE/attributions/github_urfave_cli_License.txt;md5=f1f14a2449300559aed90bedc36a71ed \ + file://LICENSE/attributions/github_vishvananda_netlink_License.txt;md5=c95fd0efd62139c155e956a448df8fd6 \ + file://LICENSE/attributions/github_yosssi_gmq_License.txt;md5=2509f45544da1ecce869ce2de1aa44dd \ + file://LICENSE/attributions/Golang_License.txt;md5=3d7ed06383c65a3161b36c6a0b0b98f5 \ + file://LICENSE/attributions/sqlite_org_License.txt;md5=380e2694a297aa32879ca2ae9c6c029b \ +" + +# Bitbake does not support spaces in filenames, but GG License does have spaces, +# so workaround the problem by renaming the file before using it. +GG_LIC_FILENAME = "Greengrass AWS SW License (IoT additiona) vr6.txt" +GG_LIC_FILENAME_NOSPACES = "${@d.getVar('GG_LIC_FILENAME', True).replace(' ','_')}" +LIC_FILES_CHKSUM += "file://LICENSE/${GG_LIC_FILENAME_NOSPACES};md5=7df5bf535d02b2f83c260250fe330b6c" + +SRC_URI = " \ + http:///not/exist/greengrass-linux-armv7l-${PV}.tar.gz \ + file://greengrass-init \ + file://0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch \ +" +SRC_URI[md5sum] = "893cf23f3e645d6cfe6975ea55b8b458" +SRC_URI[sha256sum] = "aa71facd21e515f6e98d4aaec873bb9bf9490552df3466ed57c0aef5cc8bef4a" + +GG_TARBALL_LOCAL_PATH ?= "" + +# The tarball is only available for downloading after registration, so provide +# a PREMIRROR to a local directory that can be configured in the project's +# local.conf file using GG_TARBALL_LOCAL_PATH variable. +python() { + gg_tarball_local_path = d.getVar('GG_TARBALL_LOCAL_PATH', True) + if gg_tarball_local_path: + premirrors = d.getVar('PREMIRRORS', True) + d.setVar('PREMIRRORS', "http:///not/exist/greengrass.* file://%s \\n %s" % (gg_tarball_local_path, premirrors)) +} + +S = "${WORKDIR}/${BPN}" + +inherit aws-iot update-rc.d useradd + +GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}" + +# Rename GG license file +do_unpack[postfuncs] += "rename_license" +rename_license() { + cd ${S}/LICENSE + mv "${GG_LIC_FILENAME}" "${GG_LIC_FILENAME_NOSPACES}" +} + +# Disable tasks not needed for the binary package +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}/${BPN} + tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - -C ${S} . \ + | tar --no-same-owner -xpf - -C ${D}/${BPN} + + # Install wrapper bootscript to launch Greengrass core on boot + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/init.d/greengrass + sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/init.d/greengrass + + # If certificates do exist, install them and update the config file + if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" ] && \ + [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_CERTIFICATE}" ] && \ + [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_PRIVATE_KEY}" ]; then + install -m 0644 "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" \ + "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_CERTIFICATE}" \ + "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_PRIVATE_KEY}" \ + ${D}/${BPN}/configuration/certs/ + sed -i -e "s,\[ROOT_CA_PEM_HERE],${AWS_GGCORE_ROOT_CA},g" \ + -e "s,\[CLOUD_PEM_CRT_HERE],${AWS_GGCORE_CERTIFICATE},g" \ + -e "s,\[CLOUD_PEM_KEY_HERE],${AWS_GGCORE_PRIVATE_KEY},g" \ + ${D}/${BPN}/configuration/config.json + fi + + # Configure the rest of GG Core parameters + [ -n "${AWS_GGCORE_THING_ARN}" ] && sed -i -e "s,\[THING_ARN_HERE],${AWS_GGCORE_THING_ARN},g" ${D}/${BPN}/configuration/config.json + if [ -n "${AWS_GGCORE_IOT_HOST}" ]; then + AWS_GGCORE_HOST_PREFIX="$(echo ${AWS_GGCORE_IOT_HOST} | sed -e 's,\([^.]\+\)\.iot.*,\1,g')" + AWS_GGCORE_REGION="$(echo ${AWS_GGCORE_IOT_HOST} | sed -e 's,.*.iot\.\([^.]\+\)\..*,\1,g')" + [ -n "${AWS_GGCORE_HOST_PREFIX}" ] && sed -i -e "s,\[HOST_PREFIX_HERE],${AWS_GGCORE_HOST_PREFIX},g" ${D}/${BPN}/configuration/config.json + [ -n "${AWS_GGCORE_REGION}" ] && sed -i -e "s,\[AWS_REGION_HERE],${AWS_GGCORE_REGION},g" ${D}/${BPN}/configuration/config.json + fi + + # Configure whether to use systemd or not + sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/configuration/config.json +} + +pkg_postinst_${PN}() { + # Enable protection for hardlinks and symlinks + if ! grep -qs 'protected_.*links' $D${sysconfdir}/sysctl.conf; then + cat >> $D${sysconfdir}/sysctl.conf <<-_EOF_ + # Greengrass: protect hardlinks/symlinks + fs.protected_hardlinks = 1 + fs.protected_symlinks = 1 + _EOF_ + fi + + # Customize '/etc/fstab' + if [ -f "$D${sysconfdir}/fstab" ]; then + # Disable TMPFS /var/volatile + sed -i -e '\#^tmpfs[[:blank:]]\+/var/volatile#s,^,#,g' $D${sysconfdir}/fstab + + # Mount a cgroup hierarchy with all available subsystems + if ! grep -qs '^cgroup' $D${sysconfdir}/fstab; then + cat >> $D${sysconfdir}/fstab <<-_EOF_ + # Greengrass: mount cgroups + cgroup /sys/fs/cgroup cgroup defaults 0 0 + _EOF_ + fi + fi + + # Disable '/etc/resolv.conf' symlink + if [ -f "$D${sysconfdir}/default/volatiles/00_core" ]; then + sed -i -e '/resolv.conf/d' $D${sysconfdir}/default/volatiles/00_core + cat >> $D${sysconfdir}/default/volatiles/00_core <<-_EOF_ + # Greengrass: create a real (no symlink) resolv.conf + f root root 0644 /etc/resolv.conf none + _EOF_ + fi +} + +FILES_${PN} = "/${BPN} ${sysconfdir}" + +CONFFILES_${PN} += "/${BPN}/configuration/config.json" + +INITSCRIPT_NAME = "greengrass" +INITSCRIPT_PARAMS = "defaults 80 20" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "-r ggc_group" +USERADD_PARAM_${PN} = "-r -M -N -g ggc_group -s /bin/false ggc_user" + +# +# Disable failing QA checks: +# +# Binary was already stripped +# No GNU_HASH in the elf binary +# +INSANE_SKIP_${PN} += "already-stripped ldflags" + +RDEPENDS_${PN} += "ca-certificates python-argparse python-json python-numbers sqlite3" diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/main.conf b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/main.conf new file mode 100644 index 000000000..c0908f0b2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/main.conf @@ -0,0 +1,12 @@ +[General] + +# Default adapter name +# Defaults to 'BlueZ X.YZ' +Name = cc6 + +#[Policy] + +# AutoEnable defines option to enable all controllers when they are found. +# This includes adapters present on start as well as adapters that are plugged +# in later on. Defaults to 'false'. +#AutoEnable=true diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch new file mode 100644 index 000000000..e5d76303a --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch @@ -0,0 +1,186 @@ +From: Alex Gonzalez +Date: Thu, 6 Apr 2017 09:27:09 +0200 +Subject: [PATCH] hciattach_rome: Respect the user indication for noflow + +When hciattach is called with noflow, it should not assume the hardware +supports hardware flow control. + +Basically, use 'flow' or 'noflow' on the hciattach command line arguments +to indicate whether to use or not hardware flow control. + +Signed-off-by: Alex Gonzalez +--- + tools/hciattach.c | 2 +- + tools/hciattach.h | 2 +- + tools/hciattach_rome.c | 50 +++++++++++++++++++++++++++++++++++--------------- + tools/hciattach_rome.h | 1 + + 4 files changed, 38 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index dda639cabca3..81d78ab3f69a 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -286,7 +286,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + static int qca(int fd, struct uart_t *u, struct termios *ti) + { + fprintf(stderr,"qca\n"); +- return qca_soc_init(fd, u->speed, u->bdaddr); ++ return qca_soc_init(fd, u->speed, u->bdaddr, ti); + } + + static int qualcomm(int fd, struct uart_t *u, struct termios *ti) +diff --git a/tools/hciattach.h b/tools/hciattach.h +index 49e59321fcac..3524e716c847 100644 +--- a/tools/hciattach.h ++++ b/tools/hciattach.h +@@ -64,7 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, + struct termios *ti); + int ath3k_post(int fd, int pm); + int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); +-int qca_soc_init(int fd, int speed, char *bdaddr); ++int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti); + int intel_init(int fd, int init_speed, int *speed, struct termios *ti); + int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, + const char *bdaddr); +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 59bdc16e4e8f..ee67bb068c09 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1565,7 +1565,8 @@ static void flow_control(int fd, int opt) + } + + +-int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) ++int rome_set_baudrate_req(int fd, int local_baud_rate, ++ int controller_baud_rate, int hwfc) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1575,6 +1576,12 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) + + memset(cmd, 0x0, HCI_MAX_CMD_SIZE); + ++ /* If not using hardware flow control limit baud rate to 115200 */ ++ if (!hwfc) { ++ local_baud_rate = USERIAL_BAUD_115200; ++ controller_baud_rate = BAUDRATE_115200; ++ } ++ + cmd_hdr = (void *) (cmd + 1); + cmd[0] = HCI_COMMAND_PKT; + cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); +@@ -1621,7 +1628,7 @@ error: + } + + +-int rome_hci_reset_req(int fd, char baud) ++int rome_hci_reset_req(int fd, char baud, int hwfc) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1641,8 +1648,9 @@ int rome_hci_reset_req(int fd, char baud) + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); + +- /* Flow off during baudrate change */ +- flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ /* If using hardware flow control, turn off during baudrate change */ ++ if (hwfc) ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); + + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); +@@ -1655,8 +1663,9 @@ int rome_hci_reset_req(int fd, char baud) + /* Change Local UART baudrate to high speed UART */ + userial_vendor_set_baud(baud); + +- /* Flow on after changing local uart baudrate */ +- flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ /* If using hardware flow control, turn on after changing local uart baudrate */ ++ if (hwfc) ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); + + /* Wait for command complete event */ + err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); +@@ -1778,7 +1787,7 @@ int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) + return -1; + } + +-int qca_soc_init(int fd, int speed, char *bdaddr) ++int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti) + { + int err = -1; + int size, local_baud_rate = 0, controller_baud_rate = 0; +@@ -1793,6 +1802,12 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + return -1; + } + #endif ++ ++ /* Assume we don't use hardware flow control unless user requested 'flow' */ ++ vnd_userial.hwfc = 0; ++ if (ti->c_cflag & ~CRTSCTS) ++ vnd_userial.hwfc = 1; ++ + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ + fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); +@@ -1838,11 +1853,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + goto error; + } + +- /* Change baud rate 115.2 kbps to 3Mbps*/ +- err = rome_hci_reset_req(fd, local_baud_rate); +- if ( err <0 ) { +- fprintf(stderr, "HCI Reset Failed !!\n"); +- goto error; ++ /* If using hw flow control, change baud rate 115.2 kbps to 3Mbps*/ ++ if (vnd_userial.hwfc) { ++ err = rome_hci_reset_req(fd, local_baud_rate, ++ vnd_userial.hwfc); ++ if ( err <0 ) { ++ fprintf(stderr, "HCI Reset Failed !!\n"); ++ goto error; ++ } + } + + fprintf(stderr, "HCI Reset is done\n"); +@@ -1888,7 +1906,8 @@ download: + if (local_baud_rate < 0 || controller_baud_rate < 0) + goto error; + +- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ err = rome_set_baudrate_req(fd, local_baud_rate, ++ controller_baud_rate, vnd_userial.hwfc); + if (err < 0) { + fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); + goto error; +@@ -1907,14 +1926,15 @@ download: + * Overriding the baud rate value in NVM file with the user + * requested baud rate, since default baud rate in NVM file is 3M. + */ +- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ err = rome_set_baudrate_req(fd, local_baud_rate, ++ controller_baud_rate, vnd_userial.hwfc); + if (err < 0) { + fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); + goto error; + } + + /* Perform HCI reset here*/ +- err = rome_hci_reset_req(fd, local_baud_rate); ++ err = rome_hci_reset_req(fd, local_baud_rate, vnd_userial.hwfc); + if ( err <0 ) { + fprintf(stderr, "HCI Reset Failed !!!\n"); + goto error; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 89f7db3bef86..760685ad7915 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -62,6 +62,7 @@ typedef struct + int fd; /* fd to Bluetooth device */ + struct termios termios; /* serial terminal of BT port */ + char port_name[256]; ++ int hwfc; + } vnd_userial_cb_t; + + /**** baud rates ****/ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch new file mode 100644 index 000000000..208f587a2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch @@ -0,0 +1,177 @@ +From: Alex Gonzalez +Date: Thu, 6 Apr 2017 14:37:57 +0200 +Subject: [PATCH] hciattach: If the user supplies a bdaddr, use it + +The QCA6564 has no non-volatile configuration file for the bluetooth +MAC, so use the one supplied on the command line. + +Signed-off-by: Alex Gonzalez +--- + tools/hciattach.c | 4 +-- + tools/hciattach_rome.c | 76 ++++++++++---------------------------------------- + 2 files changed, 17 insertions(+), 63 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 81d78ab3f69a..022bbe5fa6d5 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -285,7 +285,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + + static int qca(int fd, struct uart_t *u, struct termios *ti) + { +- fprintf(stderr,"qca\n"); ++ fprintf(stderr,"qca, bdaddr %s\n", u->bdaddr ? u->bdaddr : "Default"); + return qca_soc_init(fd, u->speed, u->bdaddr, ti); + } + +@@ -1363,7 +1363,7 @@ int main(int argc, char *argv[]) + fprintf(stderr, "Unknown device type or id\n"); + exit(1); + } +- ++ u->bdaddr = NULL; + break; + + case 2: +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index ee67bb068c09..854cfff707aa 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + #include + #include "hciattach_rome.h" + #include "hciattach.h" +@@ -911,7 +912,7 @@ int get_value_from_config(char *file_path,char *param) + return ret; + } + +-int rome_get_tlv_file(char *file_path) ++int rome_get_tlv_file(char *file_path, unsigned char * bdaddr) + { + FILE * pFile; + long fileSize; +@@ -921,7 +922,6 @@ int rome_get_tlv_file(char *file_path) + tlv_nvm_hdr *nvm_ptr; + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; +- unsigned char bdaddr[6]; + unsigned short pcm_value, ibs_value; + + fprintf(stderr, "File Open (%s)\n", file_path); +@@ -1008,12 +1008,15 @@ int rome_get_tlv_file(char *file_path) + nvm_byte_ptr+=sizeof(tlv_nvm_hdr); + + /* Write BD Address */ +- if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) { +- memcpy(nvm_byte_ptr, bdaddr, 6); +- fprintf(stderr, "Overriding default BD ADDR with user" +- " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", +- *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), +- *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); ++ if(nvm_ptr->tag_id == TAG_NUM_2 && bdaddr) { ++ bdaddr_t ba; ++ if (!str2ba(bdaddr, &ba)) { ++ memcpy(nvm_byte_ptr, &ba, 6); ++ fprintf(stderr, "Overriding default BD ADDR with user" ++ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", ++ *(nvm_byte_ptr+5), *(nvm_byte_ptr+4), *(nvm_byte_ptr+3), ++ *(nvm_byte_ptr+2), *(nvm_byte_ptr+1), *nvm_byte_ptr); ++ } + } + + if (nvm_ptr->tag_id == TAG_NUM_17) { +@@ -1209,14 +1212,14 @@ error: + return err; + } + +-int rome_download_tlv_file(int fd) ++int rome_download_tlv_file(int fd, char * bdaddr) + { + int tlv_size, err = -1; + + /* Rampatch TLV file Downloading */ + pdata_buffer = NULL; + +- if((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0) ++ if((tlv_size = rome_get_tlv_file(rampatch_file_path, bdaddr)) < 0) + goto error; + + if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) +@@ -1228,7 +1231,7 @@ int rome_download_tlv_file(int fd) + } + + /* NVM TLV file Downloading */ +- if((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0) ++ if((tlv_size = rome_get_tlv_file(nvm_file_path, bdaddr)) < 0) + goto error; + + if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) +@@ -1679,55 +1682,6 @@ error: + + } + +-int read_bd_address(unsigned char *bdaddr) +-{ +- int fd = -1; +- int readPtr = 0; +- unsigned char data[BD_ADDR_LEN]; +- +- /* Open the persist file for reading device address*/ +- fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY); +- if(fd < 0) +- { +- fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__); +- return -1; +- } +- +- /* Read the NVM Header : fp will be advanced by readPtr number of bytes */ +- readPtr = read(fd, data, PERSIST_HEADER_LEN); +- if (readPtr > 0) +- fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__, +- data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]); +- else { +- fprintf(stderr, "%s: Read from persist memory failed : Programming default" +- " BD ADDR\n"); +- close(fd); +- return -1; +- } +- +- /* Check for BD ADDR length before programming */ +- if(data[NVITEM_SIZE] != BD_ADDR_LEN) { +- fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n"); +- close(fd); +- return -1; +- } +- +- /* Read the BD ADDR info */ +- readPtr = read(fd, data, BD_ADDR_LEN); +- if (readPtr > 0) +- fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0], +- data[1], data[2], data[3], data[4], data[5]); +- else { +- fprintf(stderr, "%s: Read from persist memory failed : Programming default" +- " BD ADDR\n"); +- close(fd); +- return -1; +- } +- memcpy(bdaddr, data, BD_ADDR_LEN); +- close(fd); +- return 0; +-} +- + int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) + { + switch(speed) { +@@ -1915,7 +1869,7 @@ download: + } + + /* Donwload TLV files (rampatch, NVM) */ +- err = rome_download_tlv_file(fd); ++ err = rome_download_tlv_file(fd, bdaddr); + if (err < 0) { + fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); + goto error; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0024-hciattach-Add-verbosity-option.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0024-hciattach-Add-verbosity-option.patch new file mode 100644 index 000000000..d1e540a92 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0024-hciattach-Add-verbosity-option.patch @@ -0,0 +1,723 @@ +From: Alex Gonzalez +Date: Mon, 10 Apr 2017 12:44:00 +0200 +Subject: [PATCH] hciattach: Add verbosity option + +And reduce the verbosity of the hciattach_rome plugin. + +Signed-off-by: Alex Gonzalez +--- + lib/bluetooth.h | 3 + + tools/hciattach.c | 13 ++- + tools/hciattach_rome.c | 244 ++++++++++++++++++++++++------------------------- + 3 files changed, 132 insertions(+), 128 deletions(-) + +diff --git a/lib/bluetooth.h b/lib/bluetooth.h +index eb279260e009..38e3e6900744 100644 +--- a/lib/bluetooth.h ++++ b/lib/bluetooth.h +@@ -136,6 +136,9 @@ enum { + BT_CLOSED + }; + ++extern int verbose_on; ++#define hciprintf(fd, arg...) if (verbose_on) { fprintf(fd, ##arg);} else { do {} while (0);} ++ + /* Byte order conversions */ + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define htobs(d) (d) +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 022bbe5fa6d5..4aacdafeda7d 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -50,6 +50,8 @@ + + #include "hciattach.h" + ++int verbose_on = 0; ++ + struct uart_t { + char *type; + int m_id; +@@ -125,8 +127,6 @@ int read_hci_event(int fd, unsigned char* buf, int size) + fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); + return -1; + } +- else +- fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__); + + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ +@@ -285,7 +285,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + + static int qca(int fd, struct uart_t *u, struct termios *ti) + { +- fprintf(stderr,"qca, bdaddr %s\n", u->bdaddr ? u->bdaddr : "Default"); ++ fprintf(stderr,"qca, bdaddr %s, verbose %d\n", u->bdaddr ? u->bdaddr : "Default", verbose_on); + return qca_soc_init(fd, u->speed, u->bdaddr, ti); + } + +@@ -1258,7 +1258,7 @@ static void usage(void) + { + printf("hciattach - HCI UART driver initialization utility\n"); + printf("Usage:\n"); +- printf("\thciattach [-n] [-p] [-b] [-r] [-t timeout] [-s initial_speed]" ++ printf("\thciattach [-n] [-p] [-b] [-r] [-v] [-t timeout] [-s initial_speed]" + " [speed] [flow|noflow]" + " [sleep|nosleep] [bdaddr]\n"); + printf("\thciattach -l\n"); +@@ -1281,7 +1281,7 @@ int main(int argc, char *argv[]) + printpid = 0; + raw = 0; + +- while ((opt=getopt(argc, argv, "bnpt:s:lrf:")) != EOF) { ++ while ((opt=getopt(argc, argv, "bnpt:s:lrf:v")) != EOF) { + switch(opt) { + case 'b': + send_break = 1; +@@ -1319,6 +1319,9 @@ int main(int argc, char *argv[]) + fprintf(stderr, "Line_disp val : %d\n", line_disp); + break; + ++ case 'v': ++ verbose_on = 1; ++ break; + default: + usage(); + exit(1); +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 854cfff707aa..40983fc087c0 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -139,7 +139,7 @@ unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud) + void userial_vendor_set_baud(unsigned char userial_baud) + { + unsigned int tcio_baud; +- fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); ++ hciprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); + + if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) { + perror("Can't get port settings"); +@@ -201,7 +201,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) + break; + #endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) + case USERIAL_OP_FLOW_ON: +- fprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n "); ++ hciprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n "); + ti.c_cflag |= CRTSCTS; + + if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { +@@ -212,7 +212,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) + break; + + case USERIAL_OP_FLOW_OFF: +- fprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n "); ++ hciprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n "); + ti.c_cflag &= ~CRTSCTS; + if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { + fprintf(stderr, "Can't set port settings"); +@@ -233,51 +233,51 @@ int get_vs_hci_event(unsigned char *rsp) + int err = 0, soc_id =0; + unsigned char paramlen = 0; + +- if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) +- fprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__); +- else { ++ if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) { ++ hciprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__); ++ } else { + fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__); + err = -EIO; + goto failed; + } + +- fprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen = rsp[EVT_PLEN]); +- fprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]); +- fprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]); ++ paramlen = rsp[EVT_PLEN]; ++ hciprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen); ++ hciprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]); ++ hciprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]); + + /* Check the status of the operation */ + switch ( rsp[CMD_RSP_OFFSET] ) + { + case EDL_CMD_REQ_RES_EVT: +- fprintf(stderr, "%s: Command Request Response\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Command Request Response\n", __FUNCTION__); + switch(rsp[RSP_TYPE_OFFSET]) + { + case EDL_PATCH_VER_RES_EVT: + case EDL_APP_VER_RES_EVT: +- fprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n", +- (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | ++ hciprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n", ++ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | + rsp[PATCH_PROD_ID_OFFSET+2] << 16 | + rsp[PATCH_PROD_ID_OFFSET+1] << 8 | + rsp[PATCH_PROD_ID_OFFSET] )); + + /* Patch Version indicates FW patch version */ +- fprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n", +- (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | ++ hciprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n", ++ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | + rsp[PATCH_PATCH_VER_OFFSET] )); + + /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ +- fprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver = +- (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | +- rsp[PATCH_ROM_BUILD_VER_OFFSET] )); ++ rome_ver = (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_ROM_BUILD_VER_OFFSET] ); ++ hciprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver); + + /* In case rome 1.0/1.1, there is no SOC ID version available */ +- if (paramlen - 10) +- { +- fprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id = +- (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | +- rsp[PATCH_SOC_VER_OFFSET+2] << 16 | +- rsp[PATCH_SOC_VER_OFFSET+1] << 8 | +- rsp[PATCH_SOC_VER_OFFSET] )); ++ if (paramlen - 10) { ++ soc_id = (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | ++ rsp[PATCH_SOC_VER_OFFSET+2] << 16 | ++ rsp[PATCH_SOC_VER_OFFSET+1] << 8 | ++ rsp[PATCH_SOC_VER_OFFSET]); ++ hciprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id); + } + + /* Rome Chipset Version can be decided by Patch version and SOC version, +@@ -290,7 +290,7 @@ int get_vs_hci_event(unsigned char *rsp) + switch (err = rsp[CMD_STATUS_OFFSET]) + { + case HCI_CMD_SUCCESS: +- fprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__); + break; + case PATCH_LEN_ERROR: + fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH " +@@ -318,7 +318,7 @@ int get_vs_hci_event(unsigned char *rsp) + break; + + case NVM_ACCESS_CODE: +- fprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__); ++ hciprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__); + err = HCI_CMD_SUCCESS; + break; + case EDL_SET_BAUDRATE_RSP_EVT: +@@ -362,7 +362,7 @@ int wait_for_data(int fd, int maxTimeOut) + return -1; + } + else +- fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n", ++ hciprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n", + __FUNCTION__); + + return 1; +@@ -381,7 +381,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + return -1; + } + +- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", ++ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", + __FUNCTION__); + + /* Check whether data is available in TTY buffer before calling read() */ +@@ -425,7 +425,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + } + count++; + +- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]); ++ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]); + /* The next two bytes are the event code and parameter total length. */ + while (count < 3) { + r = read(fd, buf + count, 3 - count); +@@ -436,7 +436,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + count += r; + } + +- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]); ++ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]); + /* Now we read the parameters. */ + if (buf[2] < (size - 3)) + remain = buf[2]; +@@ -454,7 +454,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + if(get_vs_hci_event(buf) != HCI_CMD_SUCCESS) + return -1; + +- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count); ++ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count); + return count; + } + +@@ -477,7 +477,7 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) + fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); + goto failed; + } +- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); + } + + failed: +@@ -507,8 +507,8 @@ void frame_hci_cmd_pkt( + case EDL_PATCH_SET_REQ_CMD: + /* Copy the patch header info as CMD params */ + memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN); +- fprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); +- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ hciprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); ++ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", + segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); + break; + case EDL_PATCH_DLD_REQ_CMD: +@@ -522,36 +522,36 @@ void frame_hci_cmd_pkt( + cmd[9] = EXTRACT_BYTE(p_base_addr, 3); + memcpy(&cmd[10], (pdata_buffer + offset), size); + +- fprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", ++ hciprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", + __FUNCTION__, size); +- fprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" ++ hciprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" + "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2], + cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]); + break; + case EDL_PATCH_ATCH_REQ_CMD: +- fprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); +- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", +- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ hciprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); ++ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); + break; + case EDL_PATCH_RST_REQ_CMD: +- fprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); +- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", +- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ hciprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); ++ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); + break; + case EDL_PATCH_VER_REQ_CMD: +- fprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); +- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", +- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); +- break; ++ hciprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); ++ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; + case EDL_PATCH_TLV_REQ_CMD: +- fprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); + /* Parameter Total Length */ + cmd[3] = size +2; + + /* TLV Segment Length */ + cmd[5] = size; +- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", +- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); ++ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); + offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT); + memcpy(&cmd[6], (pdata_buffer + offset), size); + break; +@@ -601,14 +601,13 @@ void rome_extract_patch_header_info(unsigned char *buf) + rampatch_patch_info.patch_ctrl |= + (LSH(buf[index + P_CONTROL_OFFSET], (index * 8))); + +- fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); +- fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); +- fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); +- fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); +- fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); +- fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); +- fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); +- ++ hciprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); ++ hciprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); ++ hciprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); ++ hciprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); ++ hciprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); ++ hciprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); ++ hciprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); + } + + int rome_edl_set_patch_request(int fd) +@@ -636,7 +635,7 @@ int rome_edl_set_patch_request(int fd) + fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__); + error: + return err; + } +@@ -651,7 +650,7 @@ int rome_edl_patch_download_request(int fd) + + no_of_patch_segment = (rampatch_patch_info.patch_length / + MAX_DATA_PER_SEGMENT); +- fprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n", ++ hciprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n", + __FUNCTION__, no_of_patch_segment, + rampatch_patch_info.patch_base_addr); + +@@ -663,8 +662,7 @@ int rome_edl_patch_download_request(int fd) + * segments with a max. size of 239 bytes + */ + for (index = 1; index <= no_of_patch_segment; index++) { +- +- fprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index); ++ hciprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index); + + /* Frame the HCI CMD PKT to be sent to Controller*/ + frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, +@@ -690,8 +688,9 @@ int rome_edl_patch_download_request(int fd) + __FUNCTION__, index); + goto error; + } +- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", +- __FUNCTION__, index); ++ ++ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", ++ __FUNCTION__, index); + } + + /* Check if any pending patch data to be sent */ +@@ -725,8 +724,8 @@ int rome_edl_patch_download_request(int fd) + goto error; + } + +- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", +- __FUNCTION__, index); ++ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", ++ __FUNCTION__, index); + } + + error: +@@ -740,7 +739,7 @@ static int rome_download_rampatch(int fd) + fprintf(stderr, "%s:\n", __FUNCTION__); + + /* Get handle to the RAMPATCH binary file */ +- fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); ++ hciprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); + file = fopen(ROME_FW_PATH, "r"); + if (file == NULL) { + fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n", +@@ -749,7 +748,7 @@ static int rome_download_rampatch(int fd) + } + + /* Allocate memory for the patch headder info */ +- fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); + phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1); + if (phdr_buffer == NULL) { + fprintf(stderr, "%s: Failed to allocate memory for patch header\n", +@@ -760,7 +759,7 @@ static int rome_download_rampatch(int fd) + phdr_buffer[index] = 0x0; + + /* Read 28 bytes of patch header information */ +- fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); + index = 0; + do { + c = fgetc (file); +@@ -768,7 +767,7 @@ static int rome_download_rampatch(int fd) + } while (index != PATCH_HDR_LEN); + + /* Save the patch header info into local structure */ +- fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); + rome_extract_patch_header_info((unsigned char *)phdr_buffer); + + /* Set the patch header info onto the Controller */ +@@ -779,7 +778,7 @@ static int rome_download_rampatch(int fd) + } + + /* Allocate memory for the patch payload */ +- fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); + size = rampatch_patch_info.patch_length; + pdata_buffer = (unsigned char *) malloc(size+1); + if (pdata_buffer == NULL) { +@@ -791,7 +790,7 @@ static int rome_download_rampatch(int fd) + pdata_buffer[index] = 0x0; + + /* Read the patch data from Rampatch binary image */ +- fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); + index = 0; + do { + c = fgetc (file); +@@ -924,7 +923,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr) + unsigned char *nvm_byte_ptr; + unsigned short pcm_value, ibs_value; + +- fprintf(stderr, "File Open (%s)\n", file_path); ++ hciprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); + if (pFile==NULL) {; + fprintf(stderr, "%s File Open Fail\n", file_path); +@@ -967,30 +966,30 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr) + gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; + + if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ +- fprintf(stderr, "====================================================\n"); +- fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); +- fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | +- (ptlv_header->tlv_length2 << 8) | +- (ptlv_header->tlv_length3 << 16)); +- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); +- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); +- fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); +- fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); +- fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); +- fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); +- fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); +- fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); +- fprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); +- fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); +- fprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); +- fprintf(stderr, "====================================================\n"); +- ++ hciprintf(stderr, "====================================================\n"); ++ hciprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ hciprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ hciprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); ++ hciprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); ++ hciprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); ++ hciprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ hciprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); ++ hciprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); ++ hciprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); ++ hciprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); ++ hciprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); ++ hciprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); ++ hciprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); ++ hciprintf(stderr, "====================================================\n"); + } else if(ptlv_header->tlv_type == TLV_TYPE_NVM) { +- fprintf(stderr, "====================================================\n"); +- fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); +- fprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) | +- (ptlv_header->tlv_length2 << 8) | +- (ptlv_header->tlv_length3 << 16)); ++ nvm_length = (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16); ++ hciprintf(stderr, "====================================================\n"); ++ hciprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ hciprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length); + + if(nvm_length <= 0) + return readSize; +@@ -998,11 +997,11 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr) + for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0; + nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr) + { +- fprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); +- fprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len); +- fprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); +- fprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); +- ++ nvm_tag_len = nvm_ptr->tag_len; ++ hciprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); ++ hciprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len); ++ hciprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); ++ hciprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); + /* Increase nvm_index to NVM data */ + nvm_index+=sizeof(tlv_nvm_hdr); + nvm_byte_ptr+=sizeof(tlv_nvm_hdr); +@@ -1058,7 +1057,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr) + snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", + (char *)data_buf, *(nvm_byte_ptr + i)); + +- fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf); ++ hciprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf); + + /* Clear buffer */ + memset(data_buf, 0x0, PRINT_BUF_SIZE); +@@ -1068,7 +1067,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr) + nvm_byte_ptr +=nvm_ptr->tag_len; + } + +- fprintf(stderr, "====================================================\n"); ++ hciprintf(stderr, "====================================================\n"); + + } else { + fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); +@@ -1083,7 +1082,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc + unsigned char cmd[HCI_MAX_CMD_SIZE]; + unsigned char rsp[HCI_MAX_EVENT_SIZE]; + +- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt); ++ hciprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt); + + /* Frame the HCI CMD PKT to be sent to Controller*/ + frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); +@@ -1109,7 +1108,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc + } + } + +- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index); ++ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index); + return err; + } + +@@ -1123,7 +1122,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ + tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT); + +- fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", ++ hciprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", + __FUNCTION__,tlv_size, total_segment, remain_size); + + if (gTlv_type == TLV_TYPE_PATCH) { +@@ -1137,12 +1136,12 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + case ROME_SKIP_EVT_NONE: + wait_vsc_evt = TRUE; + wait_cc_evt = TRUE; +- fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); ++ hciprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); + break; + case ROME_SKIP_EVT_VSE_CC: + wait_vsc_evt = FALSE; + wait_cc_evt = FALSE; +- fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); ++ hciprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); + break; + /* Not handled for now */ + case ROME_SKIP_EVT_VSE: +@@ -1479,14 +1478,14 @@ int rome_1_0_nvm_tag_dnld(int fd) + }; + #endif + +- fprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION); ++ hciprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION); + + for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++) + { + /* Write BD Address */ + if(cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){ + memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6); +- fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", ++ hciprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", + cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1], + cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3], + cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]); +@@ -1598,7 +1597,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, + flow_control(fd, MSM_DISABLE_FLOW_CTRL); + + /* Send the HCI command packet to UART for transmission */ +- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; ++ hciprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; + err = write(fd, cmd, size); + if (err != size) { + fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); +@@ -1616,7 +1615,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, + goto error; + } + +- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); + + /* Wait for command complete event */ + err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); +@@ -1624,7 +1623,6 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, + fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s\n", __FUNCTION__); + error: + return err; + +@@ -1639,7 +1637,7 @@ int rome_hci_reset_req(int fd, char baud, int hwfc) + hci_command_hdr *cmd_hdr; + int flags; + +- fprintf(stderr, "%s: HCI RESET \n", __FUNCTION__); ++ hciprintf(stderr, "%s: HCI RESET \n", __FUNCTION__); + + memset(cmd, 0x0, HCI_MAX_CMD_SIZE); + +@@ -1656,7 +1654,7 @@ int rome_hci_reset_req(int fd, char baud, int hwfc) + flow_control(fd, MSM_DISABLE_FLOW_CTRL); + + /* Send the HCI command packet to UART for transmission */ +- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); ++ hciprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); + err = write(fd, cmd, size); + if (err != size) { + fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); +@@ -1768,28 +1766,28 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti) + goto error; + } + +- fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); ++ hciprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); + + switch (rome_ver){ + case ROME_VER_1_0: + { + /* Set and Download the RAMPATCH */ +- fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); + err = rome_download_rampatch(fd); + if (err < 0) { + fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__); ++ hciprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__); + + /* Attach the RAMPATCH */ +- fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); + err = rome_attach_rampatch(fd); + if (err < 0) { + fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__); ++ hciprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__); + + /* Send Reset */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); +@@ -1800,7 +1798,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti) + } + + /* NVM download */ +- fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); ++ hciprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); + err = rome_1_0_nvm_tag_dnld(fd); + if ( err <0 ) { + fprintf(stderr, "Downloading NVM Failed !!\n"); +@@ -1817,7 +1815,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti) + } + } + +- fprintf(stderr, "HCI Reset is done\n"); ++ hciprintf(stderr, "HCI Reset is done\n"); + } + break; + case ROME_VER_1_1: +@@ -1874,7 +1872,7 @@ download: + fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); ++ hciprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); + + /* + * Overriding the baud rate value in NVM file with the user +@@ -1893,7 +1891,7 @@ download: + fprintf(stderr, "HCI Reset Failed !!!\n"); + goto error; + } +- fprintf(stderr, "HCI Reset is done\n"); ++ hciprintf(stderr, "HCI Reset is done\n"); + + break; + case ROME_VER_UNKNOWN: diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init index b325cc9fa..925d4933f 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init @@ -67,66 +67,11 @@ bluetooth_init() { # Start the Bluetooth driver and bring up the interface HCIATTACH_LOG="/var/log/hciattach.log" - BT_CMD="HCIATTACH" - RETRIES="5" - while [ "${RETRIES}" -gt "0" ]; do - case "${BT_CMD}" in - HCIATTACH) - # Reset BT - killproc hciattach - powercycle_gpio "${BT_EN_QCA_GPIO_NR}" - if hciattach ttyBt qca ${BT_RATE:-3000000} ${BT_FLOW:-flow} >${HCIATTACH_LOG} 2>&1; then - BT_CMD="HCICONFIG_UP" - else - BT_ERROR="FAILED (hciattach)" - BT_CMD="BT_INIT_FAIL" - fi - ;; - HCICONFIG_UP) - if hciconfig hci0 up; then - BT_CMD="HCITOOL_SETMAC" - else - BT_ERROR="FAILED (hciconfig up)" - BT_CMD="BT_INIT_FAIL" - fi - ;; - HCITOOL_SETMAC) - # - # Set the MAC address (the interface needs to be up to send HCI commands) - # - # Convert it to the format accepted by 'hcitool' ("00:04:F3:11:22:33" -> "33 22 11 F3 04 00") - # - HCI_MACADDR="$(echo ${BT_MACADDR} | tr ':' '\n' | tac | tr '\n' ' ' | sed -e 's/ $//g')" - if hcitool -i hci0 cmd 3F 000B 01 02 06 ${HCI_MACADDR} >/dev/null; then - BT_CMD="HCITOOL_RESET" - else - BT_ERROR="FAILED (hcitool set MAC)" - BT_CMD="BT_INIT_FAIL" - fi - ;; - HCITOOL_RESET) - if hcitool -i hci0 cmd 03 0003 00 >/dev/null; then - BT_CMD="HCICONFIG_RESET" - else - BT_ERROR="FAILED (hcitool reset)" - BT_CMD="BT_INIT_FAIL" - fi - ;; - HCICONFIG_RESET) - if hciconfig hci0 reset; then - break - else - BT_ERROR="FAILED (hciconfig reset)" - BT_CMD="BT_INIT_FAIL" - fi - ;; - BT_INIT_FAIL) - RETRIES="$((RETRIES - 1))" - BT_CMD="HCIATTACH" - ;; - esac - done - [ "${RETRIES}" = "0" ] && error "${BT_ERROR}" + killproc hciattach + 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 + BT_ERROR="FAIL (hciattach)" + fi } # Source function library @@ -137,17 +82,16 @@ case "$1" in if [ -d "/proc/device-tree/bluetooth" ]; then echo -n "Starting bluetooth hardware: " bluetooth_init - echo "done." + echo "${BT_ERROR:-done.}" fi ;; stop) if [ -d "/sys/class/bluetooth/hci0" ]; then echo -n "Stopping bluetooth hardware: " - hciconfig hci0 down || BT_ERROR="FAILED (hciconfig down)" killproc hciattach # Power down bluetooth set_gpio_value "${BT_EN_QCA_GPIO_NR}" 0 - echo "${BT_ERROR:-done.}" + echo "done." fi ;; restart) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/main.conf b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/main.conf new file mode 100644 index 000000000..e3c0cacbc --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/main.conf @@ -0,0 +1,12 @@ +[General] + +# Default adapter name +# Defaults to 'BlueZ X.YZ' +Name = cc6ul + +[Policy] + +# AutoEnable defines option to enable all controllers when they are found. +# This includes adapters present on start as well as adapters that are plugged +# in later on. Defaults to 'false'. +AutoEnable=true diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend index 66270a361..2e7c7e210 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend @@ -4,6 +4,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" SRC_URI += " \ file://bluetooth-init \ + file://main.conf \ file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \ file://0002-hcitool-increase-the-shown-connection-limit-to-20.patch \ " @@ -28,6 +29,9 @@ SRC_URI_append_ccimx6ul = " \ file://0019-bluetooth-Fix-flow-control-operation.patch \ file://0020-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \ file://0021-Bluetooth-Fix-static-analysis-issues.patch \ + file://0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch \ + file://0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \ + file://0024-hciattach-Add-verbosity-option.patch \ " inherit update-rc.d @@ -37,10 +41,12 @@ PACKAGECONFIG_append = " experimental" do_install_append() { install -d ${D}${sysconfdir}/init.d/ install -m 0755 ${WORKDIR}/bluetooth-init ${D}${sysconfdir}/init.d/bluetooth-init + install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/bluetooth/ } PACKAGES =+ "${PN}-init" +FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf" FILES_${PN}-init = "${sysconfdir}/init.d/bluetooth-init" INITSCRIPT_PACKAGES += "${PN}-init" diff --git a/meta-digi-dey/recipes-connectivity/mbedtls/mbedtls-2.1.1/0001-mbedtls-library-add-pkg-config-file.patch b/meta-digi-dey/recipes-connectivity/mbedtls/mbedtls-2.1.1/0001-mbedtls-library-add-pkg-config-file.patch new file mode 100644 index 000000000..e6c74a08f --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/mbedtls/mbedtls-2.1.1/0001-mbedtls-library-add-pkg-config-file.patch @@ -0,0 +1,41 @@ +From: Tatiana Leon +Date: Fri, 28 Apr 2017 14:47:43 +0200 +Subject: [PATCH] mbedtls library: add pkg-config file + +Signed-off-by: Tatiana Leon +--- + CMakeLists.txt | 4 ++++ + mbedtls.pc.in | 12 ++++++++++++ + 2 files changed, 16 insertions(+) + create mode 100644 mbedtls.pc.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 094d906..b662eee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -124,3 +124,7 @@ if(ENABLE_TESTING) + ) + endif(UNIX) + endif() ++ ++SET(prefix ${CMAKE_INSTALL_PREFIX}) ++CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/mbedtls.pc.in ${CMAKE_BINARY_DIR}/mbedtls.pc @ONLY) ++INSTALL(FILES ${CMAKE_BINARY_DIR}/mbedtls.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +diff --git a/mbedtls.pc.in b/mbedtls.pc.in +new file mode 100644 +index 0000000..9eff4ac +--- /dev/null ++++ b/mbedtls.pc.in +@@ -0,0 +1,12 @@ ++prefix=@prefix@ ++exec_prefix=${prefix} ++libdir=${exec_prefix}/lib ++includedir=${prefix}/include ++ ++Name: mbedtls ++Description: Light-weight open source cryptographic and SSL/TLS library ++Version: 2.1.1 ++ ++Libs: -L${libdir} -lmbedtls -lmbedcrypto -lmbedx509 ++Cflags: -I${includedir}/mbedtls ++ diff --git a/meta-digi-dey/recipes-connectivity/mbedtls/mbedtls_2.1.1.bb b/meta-digi-dey/recipes-connectivity/mbedtls/mbedtls_2.1.1.bb new file mode 100644 index 000000000..624d256f1 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/mbedtls/mbedtls_2.1.1.bb @@ -0,0 +1,47 @@ +# Copyright (C) 2017 Digi International. + +SUMMARY = "An open source, portable, easy to use, readable and flexible SSL \ +library" +DESCRIPTION = "mbedtls is a lean open source crypto library \ +for providing SSL and TLS support in your programs. It offers \ +an intuitive API and documented header files, so you can actually \ +understand what the code does. It features: \ + \ + - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES, ARC4, \ + Camellia and XTEA \ + - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5 \ + - Entropy pool and random generators, like CTR-DRBG and HMAC-DRBG \ + - Public key algorithms, like RSA, Elliptic Curves, Diffie-Hellman, \ + ECDSA and ECDH \ + - SSL v3 and TLS 1.0, 1.1 and 1.2 \ + - Abstraction layers for ciphers, hashes, public key operations, \ + platform abstraction and threading \ +" + +HOMEPAGE = "https://tls.mbed.org/" +SECTION = "libdevel" +BUGTRACKER = "https://github.com/ARMmbed/mbedtls/issues" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=302d50a6369f5f22efdb674db908167a" + +SRC_URI = " \ + https://github.com/ARMmbed/mbedtls/archive/${PN}-${PV}.tar.gz \ + file://0001-mbedtls-library-add-pkg-config-file.patch \ +" +SRC_URI[md5sum] = "6f5d3e7154ce4e04bcb9b299f614775f" +SRC_URI[sha256sum] = "ae458a4987f36819bdf1d39519212f4063780fe448d4155878fccf4e782a715f" + +S = "${WORKDIR}/${PN}-${PN}-${PV}" + +inherit cmake + +EXTRA_OECMAKE = " \ + -DENABLE_PROGRAMS:BOOL=OFF \ + -DENABLE_TESTING:BOOL=OFF \ + -DUSE_STATIC_MBEDTLS_LIBRARY:BOOL=ON \ + -DUSE_SHARED_MBEDTLS_LIBRARY:BOOL=ON \ + -DLIB_INSTALL_DIR:STRING=${libdir} \ + -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ +" + +ALLOW_EMPTY_${PN} = "1" diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules index 9fc89ca41..6c23a015f 100644 --- a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules +++ b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules @@ -5,6 +5,7 @@ ACTION!="add|change|move", GOTO="mm_digi_xbee_cellular_modem_end" # ConnectCore 6 SBC DEVPATH=="/devices/soc0/soc.0/2100000.aips-bus/21f4000.serial/tty/ttymxc4", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1" +DEVPATH=="/devices/soc0/soc/2100000.aips-bus/21f4000.serial/tty/ttymxc4", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1" # ConnectCore 6UL SBC Pro DEVPATH=="/devices/platform/soc/2100000.aips-bus/21e8000.serial/tty/ttymxc1", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1" diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/cellularifupdown b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/cellularifupdown deleted file mode 100644 index 15e993c8d..000000000 --- a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/cellularifupdown +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -RETRIES=12 -POLLING_WAIT=5 - -# Run only for cellular network interfaces -[ -z "${IF_APN}" ] && exit 0 - -background_connect() { - # The XBee Cellular needs more time to settle down before MM is able - # to detect it. As the XBee is connected to a 'ttymxc' serial port, - # we check those ports to conditionally delay the launch of MM. - if echo "${IF_PORT}" | grep -qs ttymxc; then - sleep 25 - fi - - # Ensure ModemManager is running - killall -0 ModemManager 2>/dev/null || ModemManager --log-file=/var/log/modemmanager.log & - - # Wait for modem detection - while [ "${RETRIES}" -gt "0" ]; do - mmcli -m 0 > /dev/null 2>&1 && break - sleep ${POLLING_WAIT} - RETRIES="$((RETRIES - 1))" - done - - # Abort if no modem detected - if [ "$RETRIES" -eq "0" ]; then - logger -s -p error -t modemmanager "No modem detected"; - exit - fi - - ARGS="apn=${IF_APN}" - [ -n "${IF_PIN}" ] && ARGS="${ARGS},pin=${IF_PIN}" - - [ -n "${IF_USER}" ] && ARGS="${ARGS},user=${IF_USER}" - [ -n "${IF_PASSWORD}" ] && ARGS="${ARGS},password=${IF_PASSWORD}" - [ -n "${IF_PORT}" ] && ARGS="${ARGS},number=*99#" - - # Enable the modem and connect to provider - mmcli -m 0 --simple-connect=${ARGS} > /dev/null 2>&1 - - # For serial modems, pppd creates the network interface - # Otherwise, get an IP with udhcpc - if [ -n "${IF_PORT}" ]; then - pppd ${IF_PORT} call mm_cellular > /dev/null 2>&1 - else - udhcpc -q -i ${IFACE} >/dev/null - fi - - ifconfig ${IFACE} up -} - - -if [ "$MODE" = "start" ]; then - background_connect & -elif [ "$MODE" = "stop" ]; then - # If a call number was used, destroy the network interface - [ -n "${IF_PORT}" ] && poff mm_cellular - - ifconfig ${IFACE} down - - # Disconnect and disable the modem - mmcli -m 0 -d > /dev/null 2>&1 -fi diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend index 1a67116d7..b1d763aea 100644 --- a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend @@ -3,7 +3,6 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI += " \ - file://cellularifupdown \ file://78-mm-digi-xbee-cellular.rules \ " @@ -13,11 +12,6 @@ SRC_URI += " \ PACKAGECONFIG_remove = " polkit" do_install_append() { - # Install ifupdown script for cellular interfaces - install -d ${D}${sysconfdir}/network/if-pre-up.d/ ${D}${sysconfdir}/network/if-post-down.d/ - install -m 0755 ${WORKDIR}/cellularifupdown ${D}${sysconfdir}/network/if-pre-up.d/ - ln -sf ../if-pre-up.d/cellularifupdown ${D}${sysconfdir}/network/if-post-down.d/cellularifupdown - # Install udev rules for XBee cellular install -d ${D}${nonarch_base_libdir}/udev/rules.d install -m 0644 ${WORKDIR}/78-mm-digi-xbee-cellular.rules ${D}${nonarch_base_libdir}/udev/rules.d/ diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf new file mode 100644 index 000000000..6739bb39f --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf @@ -0,0 +1,9 @@ +[main] +plugins=ifupdown,keyfile +no-auto-default=type:ethernet + +[ifupdown] +managed=false + +[keyfile] +unmanaged-devices=interface-name:p2p0;interface-name:wlan1 diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/networkmanager-init b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/networkmanager-init new file mode 100644 index 000000000..67ef4e86d --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/networkmanager-init @@ -0,0 +1,28 @@ +#!/bin/sh + +DAEMON="/usr/sbin/NetworkManager" +PIDFILE="/var/run/NetworkManager/NetworkManager.pid" +DESC="NetworkManager" + +case "${1}" in + start) + mkdir -p /var/run/NetworkManager + echo -n "Starting ${DESC}: " + ${DAEMON} + echo "done" + ;; + stop) + echo -n "Stopping ${DESC}: " + start-stop-daemon -K -o -q -p ${PIDFILE} + echo "done" + ;; + restart) + ${0} stop + sleep 1 + ${0} start + ;; + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.cellular b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.cellular new file mode 100644 index 000000000..f052a2fbc --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.cellular @@ -0,0 +1,13 @@ +[connection] +id=cellular +type=gsm + +[gsm] +apn=##CELLULAR_APN## +number=*99# +password=##CELLULAR_PASSWORD## +pin=##CELLULAR_PIN## +username=##CELLULAR_USER## + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth0.dhcp b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth0.dhcp new file mode 100644 index 000000000..3889a91be --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth0.dhcp @@ -0,0 +1,10 @@ +[connection] +id=eth0 +type=ethernet +interface-name=eth0 + +[ipv4] +method=auto + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth0.static b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth0.static new file mode 100644 index 000000000..191f5120c --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth0.static @@ -0,0 +1,12 @@ +[connection] +id=eth0 +type=ethernet +interface-name=eth0 + +[ipv4] +address1=##ETH0_STATIC_CIDR##,##ETH0_STATIC_GATEWAY## +dns=##ETH0_STATIC_DNS##; +method=manual + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth1.dhcp b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth1.dhcp new file mode 100644 index 000000000..ef4fdab26 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth1.dhcp @@ -0,0 +1,10 @@ +[connection] +id=eth1 +type=ethernet +interface-name=eth1 + +[ipv4] +method=auto + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth1.static b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth1.static new file mode 100644 index 000000000..c2b0c8fb0 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.eth1.static @@ -0,0 +1,12 @@ +[connection] +id=eth1 +type=ethernet +interface-name=eth1 + +[ipv4] +address1=##ETH1_STATIC_CIDR##,##ETH1_STATIC_GATEWAY## +dns=##ETH1_STATIC_DNS##; +method=manual + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.wlan0.dhcp b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.wlan0.dhcp new file mode 100644 index 000000000..4083247a1 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.wlan0.dhcp @@ -0,0 +1,13 @@ +[connection] +id=wlan0 +type=wifi +interface-name=wlan0 + +[wifi] +ssid="" + +[ipv4] +method=auto + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.wlan0.static b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.wlan0.static new file mode 100644 index 000000000..ccf79ba73 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/nm.wlan0.static @@ -0,0 +1,15 @@ +[connection] +id=wlan0 +type=wifi +interface-name=wlan0 + +[wifi] +ssid="" + +[ipv4] +address1=##WLAN0_STATIC_CIDR##,##WLAN0_STATIC_GATEWAY## +dns=##WLAN0_STATIC_DNS##; +method=manual + +[ipv6] +method=ignore diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_1.0.12.bbappend b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_1.0.12.bbappend new file mode 100644 index 000000000..0ce3aa24c --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_1.0.12.bbappend @@ -0,0 +1,90 @@ +# Copyright (C) 2017, Digi International Inc. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRC_URI += " \ + file://NetworkManager.conf \ + file://networkmanager-init \ + file://nm.cellular \ + file://nm.eth0.dhcp \ + file://nm.eth0.static \ + file://nm.eth1.dhcp \ + file://nm.eth1.static \ + file://nm.wlan0.dhcp \ + file://nm.wlan0.static \ +" + +# 'polkit' and 'consolekit' require 'x11' distro feature, so disable them for non-X11 distros +DEPENDS_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'polkit', d)}" +PACKAGECONFIG_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'consolekit', d)}" +EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '--enable-polkit=disabled', d)}" + +PACKAGECONFIG_remove = "dnsmasq netconfig" +PACKAGECONFIG_append = " concheck modemmanager ppp" + +# +# NetworkManager only accepts IP addresses in CIDR format +# +def ipaddr_to_cidr(iface, d): + ipaddr = d.getVar('%s_STATIC_IP' % iface.upper(), True) + netmask = d.getVar('%s_STATIC_NETMASK' % iface.upper(), True) + binary_str = '' + for byte in netmask.split('.'): + binary_str += bin(int(byte))[2:].zfill(8) + return ipaddr + '/' + str(len(binary_str.rstrip('0'))) + +ETH0_STATIC_CIDR = "${@ipaddr_to_cidr('eth0', d)}" +ETH1_STATIC_CIDR = "${@ipaddr_to_cidr('eth1', d)}" +WLAN0_STATIC_CIDR = "${@ipaddr_to_cidr('wlan0', d)}" + +inherit update-rc.d + +do_install_append() { + install -d ${D}${sysconfdir}/init.d ${D}${sysconfdir}/NetworkManager + install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager/ + install -m 0755 ${WORKDIR}/networkmanager-init ${D}${sysconfdir}/init.d/networkmanager + + # + # Connections config files + # + install -d ${D}${sysconfdir}/NetworkManager/system-connections/ + + # Ethernet + install -m 0600 ${WORKDIR}/nm.eth0.${ETH0_MODE} ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0 + sed -i -e "s,##ETH0_STATIC_CIDR##,${ETH0_STATIC_CIDR},g" \ + -e "s,##ETH0_STATIC_GATEWAY##,${ETH0_STATIC_GATEWAY},g" \ + -e "s,##ETH0_STATIC_DNS##,${ETH0_STATIC_DNS},g" \ + ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0 + + # Ethernet (second interface) + install -m 0600 ${WORKDIR}/nm.eth1.${ETH1_MODE} ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth1 + sed -i -e "s,##ETH1_STATIC_CIDR##,${ETH1_STATIC_CIDR},g" \ + -e "s,##ETH1_STATIC_GATEWAY##,${ETH1_STATIC_GATEWAY},g" \ + -e "s,##ETH1_STATIC_DNS##,${ETH1_STATIC_DNS},g" \ + ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth1 + + # Wireless (only IP settings; connection settings need to be provided at runtime) + install -m 0600 ${WORKDIR}/nm.wlan0.${WLAN0_MODE} ${D}${sysconfdir}/NetworkManager/system-connections/nm.wlan0 + sed -i -e "s,##WLAN0_STATIC_CIDR##,${WLAN0_STATIC_CIDR},g" \ + -e "s,##WLAN0_STATIC_GATEWAY##,${WLAN0_STATIC_GATEWAY},g" \ + -e "s,##WLAN0_STATIC_DNS##,${WLAN0_STATIC_DNS},g" \ + ${D}${sysconfdir}/NetworkManager/system-connections/nm.wlan0 + + # Cellular + if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ]; then + install -m 0600 ${WORKDIR}/nm.cellular ${D}${sysconfdir}/NetworkManager/system-connections/nm.cellular + [ -z "${CELLULAR_APN}" ] && sed -i -e "/##CELLULAR_APN##/d" ${D}${sysconfdir}/NetworkManager/system-connections/nm.cellular + [ -z "${CELLULAR_PIN}" ] && sed -i -e "/##CELLULAR_PIN##/d" ${D}${sysconfdir}/NetworkManager/system-connections/nm.cellular + [ -z "${CELLULAR_USER}" ] && sed -i -e "/##CELLULAR_USER##/d" ${D}${sysconfdir}/NetworkManager/system-connections/nm.cellular + [ -z "${CELLULAR_PASSWORD}" ] && sed -i -e "/##CELLULAR_PASSWORD##/d" ${D}${sysconfdir}/NetworkManager/system-connections/nm.cellular + sed -i -e "s,##CELLULAR_APN##,${CELLULAR_APN},g" \ + -e "s,##CELLULAR_PIN##,${CELLULAR_PIN},g" \ + -e "s,##CELLULAR_USER##,${CELLULAR_USER},g" \ + -e "s,##CELLULAR_PASSWORD##,${CELLULAR_PASSWORD},g" \ + ${D}${sysconfdir}/NetworkManager/system-connections/nm.cellular + fi +} + +# NetworkManager needs to be started after DBUS +INITSCRIPT_NAME = "networkmanager" +INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 80 0 6 1 ." diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/0001-wpa_supplicant-enable-control-socket-interface-when-.patch b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/0001-wpa_supplicant-enable-control-socket-interface-when-.patch new file mode 100644 index 000000000..2956bf002 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/0001-wpa_supplicant-enable-control-socket-interface-when-.patch @@ -0,0 +1,37 @@ +From: Javier Viguera +Date: Tue, 16 May 2017 18:30:31 +0200 +Subject: [PATCH] wpa_supplicant: enable control socket interface when executed + by D-Bus + +Otherwise trying to use the "wpa_cli" fails with: + +Failed to connect to non-global ctrl_ifname + +Signed-off-by: Javier Viguera +--- + wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in | 2 +- + wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in b/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in +index a75918f9380b..9cce6331d92e 100644 +--- a/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in ++++ b/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in +@@ -1,5 +1,5 @@ + [D-BUS Service] + Name=fi.epitest.hostap.WPASupplicant +-Exec=@BINDIR@/wpa_supplicant -u ++Exec=@BINDIR@/wpa_supplicant -u -O /var/run/wpa_supplicant + User=root + SystemdService=wpa_supplicant.service +diff --git a/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in b/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in +index d97ff392175d..98b72cf32481 100644 +--- a/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in ++++ b/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in +@@ -1,5 +1,5 @@ + [D-BUS Service] + Name=fi.w1.wpa_supplicant1 +-Exec=@BINDIR@/wpa_supplicant -u ++Exec=@BINDIR@/wpa_supplicant -u -O /var/run/wpa_supplicant + User=root + SystemdService=wpa_supplicant.service diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend index 28bb0c349..bee53d088 100644 --- a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend @@ -1,10 +1,11 @@ -# Copyright (C) 2013 Digi International. +# Copyright (C) 2013-2017 Digi International. FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" PACKAGECONFIG ?= "openssl" -SRC_URI_append_ccimx6ul = "file://wpa_supplicant_p2p.conf" +SRC_URI += "file://0001-wpa_supplicant-enable-control-socket-interface-when-.patch" +SRC_URI_append_ccimx6ul = " file://wpa_supplicant_p2p.conf" do_install_append_ccimx6ul() { install -m 600 ${WORKDIR}/wpa_supplicant_p2p.conf ${D}${sysconfdir}/wpa_supplicant_p2p.conf diff --git a/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend b/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend index 669a22313..609e18220 100644 --- a/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend +++ b/meta-digi-dey/recipes-core/base-files/base-files_3.0.14.bbappend @@ -16,3 +16,5 @@ do_install_append_ccimx6() { install -d ${D}${sysconfdir}/${IMAGE_PKGTYPE}-postinsts install -m 0755 ${WORKDIR}/resize-ext4fs.sh ${D}${sysconfdir}/${IMAGE_PKGTYPE}-postinsts/ } + +CONFFILES_${PN} += "${sysconfdir}/sysctl.conf" diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend index ceded7b74..140645eea 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend @@ -31,27 +31,41 @@ usage() { } suspend_interfaces() { - # Suspend wireless interface - if grep -qs '^wlan0' /var/run/ifstate; then - ifdown wlan0 && up_wlan_on_resume="1" && sleep 0.5 && rmmod ath6kl_sdio + # Suspend wireless interfaces + 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 + ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" + done + grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core fi # Suspend bluetooth interface - hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" - ${BT_DAEMON} stop >/dev/null - ${BT_INIT} stop >/dev/null + if [ -d "/proc/device-tree/bluetooth" ]; then + hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" + ${BT_DAEMON} stop >/dev/null + ${BT_INIT} stop >/dev/null + fi } resume_interfaces() { - # Resume wireless interface - if ! grep -qs '^wlan0' /var/run/ifstate; then - [ -n "${up_wlan_on_resume}" ] && modprobe ath6kl_sdio && sleep 0.5 && ifup wlan0 + # Resume wireless interfaces + if [ -d "/proc/device-tree/wireless" ]; then + # Trigger wireless module loading event, and wait until the interface exists + 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 + + # Bring up the interfaces that were bring down on suspend + for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do + grep -qs "^${i}" /var/run/ifstate || ifup "${i}" + done fi # Resume bluetooth interface - if [ -n "${up_bt_on_resume}" ]; then - ${BT_INIT} start >/dev/null - ${BT_DAEMON} start >/dev/null + if [ -d "/proc/device-tree/bluetooth" ]; then + if [ -n "${up_bt_on_resume}" ]; then + ${BT_INIT} start >/dev/null + ${BT_DAEMON} start >/dev/null + fi fi } diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend index 33086f979..a74f24d35 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend @@ -31,30 +31,41 @@ usage() { } suspend_interfaces() { - # Suspend wireless interface - if grep -qs '^wlan0' /var/run/ifstate; then - ifdown wlan0 && up_wlan_on_resume="1" - fi - if grep -qs '^wlan' /proc/modules; then - rmmod wlan + # Suspend wireless interfaces + 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 + ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" + done + grep -qs '^wlan' /proc/modules && rmmod wlan fi # Suspend bluetooth interface - hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" - ${BT_DAEMON} stop >/dev/null - ${BT_INIT} stop >/dev/null + if [ -d "/proc/device-tree/bluetooth" ]; then + hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" + ${BT_DAEMON} stop >/dev/null + ${BT_INIT} stop >/dev/null + fi } resume_interfaces() { - # Resume wireless interface - if ! grep -qs '^wlan0' /var/run/ifstate; then - [ -n "${up_wlan_on_resume}" ] && ifup wlan0 + # Resume wireless interfaces + if [ -d "/proc/device-tree/wireless" ]; then + # Trigger wireless module loading event, and wait until the interface exists + 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 + + # Bring up the interfaces that were bring down on suspend + for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do + grep -qs "^${i}" /var/run/ifstate || ifup "${i}" + done fi # Resume bluetooth interface - if [ -n "${up_bt_on_resume}" ]; then - ${BT_INIT} start >/dev/null - ${BT_DAEMON} start >/dev/null + if [ -d "/proc/device-tree/bluetooth" ]; then + if [ -n "${up_bt_on_resume}" ]; then + ${BT_INIT} start >/dev/null + ${BT_DAEMON} start >/dev/null + fi fi } diff --git a/meta-digi-dey/recipes-core/images/dey-image-aws.bb b/meta-digi-dey/recipes-core/images/dey-image-aws.bb new file mode 100644 index 000000000..088863a28 --- /dev/null +++ b/meta-digi-dey/recipes-core/images/dey-image-aws.bb @@ -0,0 +1,34 @@ +# Copyright (C) 2017, Digi International Inc. + +DESCRIPTION = "DEY image including Amazon Web Services packages" +LICENSE = "MIT" + +AWS_PACKAGES ?= " \ + awsiotsdk-demo \ + greengrass \ +" + +IMAGE_INSTALL = " \ + packagegroup-dey-core \ + ${AWS_PACKAGES} \ + ${CORE_IMAGE_EXTRA_INSTALL} \ + ${ROOTFS_PKGMANAGE_BOOTSTRAP} \ +" + +IMAGE_FEATURES += " \ + dey-network \ + package-management \ + ssh-server-dropbear \ + ${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', 'dey-bluetooth', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'dey-wireless', '', d)} \ +" + +IMAGE_LINGUAS = "" + +inherit core-image +inherit dey-image + +IMAGE_ROOTFS_SIZE = "8192" + +# Do not install udev-cache +BAD_RECOMMENDATIONS += "udev-cache" diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/interfaces.wlan0.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/interfaces.wlan0.dhcp deleted file mode 100644 index c31b678e1..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/interfaces.wlan0.dhcp +++ /dev/null @@ -1,7 +0,0 @@ - -auto wlan0 -iface wlan0 inet dhcp - udhcpc_opts -S -b >/dev/null & - wpa-driver ##WPA_DRIVER## - wpa-conf /etc/wpa_supplicant.conf - post-up /bin/virtwlans.sh diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/interfaces.wlan0.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/interfaces.wlan0.static deleted file mode 100644 index f49d9fd82..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/interfaces.wlan0.static +++ /dev/null @@ -1,10 +0,0 @@ - -auto wlan0 -iface wlan0 inet static - address ##WLAN0_STATIC_IP## - netmask ##WLAN0_STATIC_NETMASK## - gateway ##WLAN0_STATIC_GATEWAY## - dns-nameservers ##WLAN0_STATIC_DNS## - wpa-driver ##WPA_DRIVER## - wpa-conf /etc/wpa_supplicant.conf - post-up /bin/virtwlans.sh diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.cellular b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.cellular deleted file mode 100644 index 1afe87e86..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.cellular +++ /dev/null @@ -1,9 +0,0 @@ - -# Cellular interface -#auto ##CELLULAR_INTERFACE## -iface ##CELLULAR_INTERFACE## inet manual - port - apn - pin - user - password diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth0.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth0.dhcp deleted file mode 100644 index dd290cc5f..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth0.dhcp +++ /dev/null @@ -1,4 +0,0 @@ - -auto eth0 -iface eth0 inet dhcp - udhcpc_opts -S -b >/dev/null & diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth0.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth0.static deleted file mode 100644 index 70e73c131..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth0.static +++ /dev/null @@ -1,7 +0,0 @@ - -auto eth0 -iface eth0 inet static - address ##ETH0_STATIC_IP## - netmask ##ETH0_STATIC_NETMASK## - gateway ##ETH0_STATIC_GATEWAY## - dns-nameservers ##ETH0_STATIC_DNS## diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth1.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth1.dhcp deleted file mode 100644 index 201900537..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth1.dhcp +++ /dev/null @@ -1,4 +0,0 @@ - -auto eth1 -iface eth1 inet dhcp - udhcpc_opts -S -b >/dev/null & diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth1.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth1.static deleted file mode 100644 index 538d46cf6..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.eth1.static +++ /dev/null @@ -1,7 +0,0 @@ - -auto eth1 -iface eth1 inet static - address ##ETH1_STATIC_IP## - netmask ##ETH1_STATIC_NETMASK## - gateway ##ETH1_STATIC_GATEWAY## - dns-nameservers ##ETH1_STATIC_DNS## diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan0.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan0.dhcp deleted file mode 100644 index 60d3f4750..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan0.dhcp +++ /dev/null @@ -1,8 +0,0 @@ - -auto wlan0 -iface wlan0 inet dhcp - udhcpc_opts -S -b >/dev/null & - wpa-driver ##WPA_DRIVER## - wpa-conf /etc/wpa_supplicant.conf - # post-up /etc/init.d/hostapd start - # pre-down /etc/init.d/hostapd stop diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan0.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan0.static deleted file mode 100644 index ddb10dd87..000000000 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan0.static +++ /dev/null @@ -1,11 +0,0 @@ - -auto wlan0 -iface wlan0 inet static - address ##WLAN0_STATIC_IP## - netmask ##WLAN0_STATIC_NETMASK## - gateway ##WLAN0_STATIC_GATEWAY## - dns-nameservers ##WLAN0_STATIC_DNS## - wpa-driver ##WPA_DRIVER## - wpa-conf /etc/wpa_supplicant.conf - # post-up /etc/init.d/hostapd start - # pre-down /etc/init.d/hostapd stop diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/resolv b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/resolv index ecc0b4070..b11f148c9 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/resolv +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/resolv @@ -18,7 +18,10 @@ # Only for static method [ "${METHOD}" != "static" ] && exit 0 -RESOLVCONF="$(readlink /etc/resolv.conf)" +RESOLVCONF="/etc/resolv.conf" + +# For symlinks reset to the destination file +[ -h "${RESOLVCONF}" ] && RESOLVCONF="$(readlink ${RESOLVCONF})" NAMESERVERS="" for NS in ${IF_DNS_NAMESERVER} ${IF_DNS_NAMESERVERS}; do diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend index 99a1c3890..60cd13e5d 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend @@ -7,14 +7,7 @@ INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 80 0 6 1 ." SRC_URI_append = " \ file://interfaces.br0.example \ - file://interfaces.eth0.static \ - file://interfaces.eth0.dhcp \ - file://interfaces.eth1.static \ - file://interfaces.eth1.dhcp \ - file://interfaces.wlan0.static \ - file://interfaces.wlan0.dhcp \ file://interfaces.p2p \ - file://interfaces.cellular \ file://resolv \ " @@ -30,12 +23,7 @@ do_install_append() { # Install DNS servers handler install -m 0755 ${WORKDIR}/resolv ${D}${sysconfdir}/network/if-up.d/resolv - # Create 'interfaces' file dynamically - cat ${WORKDIR}/interfaces.eth0.${ETH0_MODE} >> ${D}${sysconfdir}/network/interfaces - [ -n "${HAVE_SECOND_ETH}" ] && cat ${WORKDIR}/interfaces.eth1.${ETH1_MODE} >> ${D}${sysconfdir}/network/interfaces - if [ -n "${HAVE_WIFI}" ]; then - cat ${WORKDIR}/interfaces.wlan0.${WLAN0_MODE} >> ${D}${sysconfdir}/network/interfaces if [ -n "${WLAN_P2P_INTERFACE}" ]; then cat ${WORKDIR}/interfaces.p2p >> ${D}${sysconfdir}/network/interfaces [ -n "${WLAN_P2P_AUTO}" ] && sed -i -e 's/^#auto ##WLAN_P2P_INTERFACE##/auto ##WLAN_P2P_INTERFACE##/g' ${D}${sysconfdir}/network/interfaces @@ -45,73 +33,12 @@ do_install_append() { cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces # Remove config entries if corresponding variable is not defined - [ -z "${ETH0_STATIC_DNS}" ] && sed -i -e "/##ETH0_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH0_STATIC_GATEWAY}" ] && sed -i -e "/##ETH0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH0_STATIC_IP}" ] && sed -i -e "/##ETH0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH0_STATIC_NETMASK}" ] && sed -i -e "/##ETH0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH1_STATIC_DNS}" ] && sed -i -e "/##ETH1_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH1_STATIC_GATEWAY}" ] && sed -i -e "/##ETH1_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH1_STATIC_IP}" ] && sed -i -e "/##ETH1_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${ETH1_STATIC_NETMASK}" ] && sed -i -e "/##ETH1_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${WLAN0_STATIC_DNS}" ] && sed -i -e "/##WLAN0_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${WLAN0_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${WLAN0_STATIC_IP}" ] && sed -i -e "/##WLAN0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces - [ -z "${WLAN0_STATIC_NETMASK}" ] && sed -i -e "/##WLAN0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces [ -z "${P2P0_STATIC_DNS}" ] && sed -i -e "/##P2P0_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces [ -z "${P2P0_STATIC_GATEWAY}" ] && sed -i -e "/##P2P0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces [ -z "${P2P0_STATIC_IP}" ] && sed -i -e "/##P2P0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces [ -z "${P2P0_STATIC_NETMASK}" ] && sed -i -e "/##P2P0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces - # Cellular interface - if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then - cat ${WORKDIR}/interfaces.cellular >> ${D}${sysconfdir}/network/interfaces - [ -n "${CELLULAR_AUTO}" ] && sed -i -e 's/^#auto ##CELLULAR_INTERFACE##/auto ##CELLULAR_INTERFACE##/g' ${D}${sysconfdir}/network/interfaces - sed -i -e 's,##CELLULAR_INTERFACE##,${CELLULAR_INTERFACE},g' ${D}${sysconfdir}/network/interfaces - - if [ -n "${CELLULAR_APN}" ]; then - sed -i -e 's/^\([[:blank:]]*\)apn/\1apn ${CELLULAR_APN}/g' ${D}${sysconfdir}/network/interfaces - else - sed -i -e '/^[[:blank:]]*apn/d' ${D}${sysconfdir}/network/interfaces - fi - - if [ -n "${CELLULAR_PIN}" ]; then - sed -i -e 's/^\([[:blank:]]*\)pin/\1pin ${CELLULAR_PIN}/g' ${D}${sysconfdir}/network/interfaces - else - sed -i -e '/^[[:blank:]]*pin/d' ${D}${sysconfdir}/network/interfaces - fi - - if [ -n "${CELLULAR_PORT}" ]; then - sed -i -e 's/^\([[:blank:]]*\)port/\1port ${CELLULAR_PORT}/g' ${D}${sysconfdir}/network/interfaces - else - sed -i -e '/^[[:blank:]]*port/d' ${D}${sysconfdir}/network/interfaces - fi - - if [ -n "${CELLULAR_USER}" ]; then - sed -i -e 's/^\([[:blank:]]*\)user/\1user ${CELLULAR_USER}/g' ${D}${sysconfdir}/network/interfaces - else - sed -i -e '/^[[:blank:]]*user/d' ${D}${sysconfdir}/network/interfaces - fi - - if [ -n "${CELLULAR_PASSWORD}" ]; then - sed -i -e 's/^\([[:blank:]]*\)password/\1password ${CELLULAR_PASSWORD}/g' ${D}${sysconfdir}/network/interfaces - else - sed -i -e '/^[[:blank:]]*password/d' ${D}${sysconfdir}/network/interfaces - fi - fi - # Replace interface parameters - sed -i -e "s,##ETH0_STATIC_IP##,${ETH0_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH0_STATIC_NETMASK##,${ETH0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH0_STATIC_GATEWAY##,${ETH0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH0_STATIC_DNS##,${ETH0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH1_STATIC_IP##,${ETH1_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH1_STATIC_NETMASK##,${ETH1_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH1_STATIC_GATEWAY##,${ETH1_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##ETH1_STATIC_DNS##,${ETH1_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##WLAN0_STATIC_IP##,${WLAN0_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##WLAN0_STATIC_NETMASK##,${WLAN0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##WLAN0_STATIC_GATEWAY##,${WLAN0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces - sed -i -e "s,##WLAN0_STATIC_DNS##,${WLAN0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces sed -i -e "s,##P2P0_STATIC_IP##,${P2P0_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces sed -i -e "s,##P2P0_STATIC_NETMASK##,${P2P0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces sed -i -e "s,##P2P0_STATIC_GATEWAY##,${P2P0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces diff --git a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb index 34a0425bf..2a4613cc1 100644 --- a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb +++ b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb @@ -1,5 +1,5 @@ # -# Copyright (C) 2012 Digi International. +# Copyright (C) 2012-2017 Digi International. # SUMMARY = "Core packagegroup for DEY image" @@ -26,6 +26,7 @@ VIRTUAL-RUNTIME_passwd_manager ?= "shadow" VIRTUAL-RUNTIME_touchscreen ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'tslib-calibrate tslib-tests', d)}" RDEPENDS_${PN} = "\ + awsiotsdk-c \ base-files \ base-passwd \ busybox \ @@ -38,6 +39,7 @@ RDEPENDS_${PN} = "\ init-ifupdown \ modutils-initscripts \ netbase \ + networkmanager \ os-release \ recovery-utils \ sysinfo \ diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init index 07bdf4439..5f70a0e3d 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init @@ -372,6 +372,9 @@ fi # Give some time for the devices to settle down sleep 2 +# Run all shell scripts in postinstall folder +run-parts /etc/*-postinsts + # Setup fw_printenv. mkdir -p /var/lock diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb deleted file mode 100644 index ad6b63fcb..000000000 --- a/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (C) 2016 Digi International. - -SUMMARY = "Trustfence command line tool" -SECTION = "console/tools" -LICENSE = "CLOSED" - -SRC_URI = "${DIGI_PKG_SRC}/${BP}.tar.gz" - -SRC_URI[md5sum] = "dfbe0f7a5c2d16c5abafae14eb33d592" -SRC_URI[sha256sum] = "e335fc7080fb35ad198319c06ec31c77d9d2fe63219b9adc1ffc1e686e1534ae" - -inherit bin_package diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.1.bb b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.1.bb new file mode 100644 index 000000000..9db3d9c98 --- /dev/null +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.1.bb @@ -0,0 +1,12 @@ +# Copyright (C) 2016, 2017 Digi International. + +SUMMARY = "Trustfence command line tool" +SECTION = "console/tools" +LICENSE = "CLOSED" + +SRC_URI = "${DIGI_PKG_SRC}/${BP}.tar.gz" + +SRC_URI[md5sum] = "31385122bed83d420f92efddd8975e99" +SRC_URI[sha256sum] = "e5e9157837be8e26141708e06a881ef872dd94aa06451668959845c4d4d19efc" + +inherit bin_package diff --git a/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb b/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb new file mode 100644 index 000000000..9e2e7c12c --- /dev/null +++ b/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb @@ -0,0 +1,30 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "Atmel CryptoAuthentication Library" +SECTION = "libs" +LICENSE = "ATMEL_CRYPTOAUTHLIB_LICENSE" +LIC_FILES_CHKSUM = "file://lib/atca_cfgs.h;beginline=8;endline=40;md5=073d05cb7a4312aaff0af9186e4fa93e" + +SRCBRANCH = "master" +SRCREV = "${AUTOREV}" + +GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_MTK_GIT}linux/atmel-cryptoauth-openssl-engine.git;protocol=ssh', '${DIGI_GITHUB_GIT}/atmel-cryptoauth-openssl-engine.git', d)}" + +SRC_URI = "${GIT_URI};branch=${SRCBRANCH}" + +S = "${WORKDIR}/git/engine_atecc/cryptoauthlib" + +I2C_BUS = "" +I2C_BUS_ccimx6ul = "0" + +I2C_SPEED = "" +I2C_SPEED_ccimx6ul = "100000" + +CFLAGS += "-DATCA_HAL_I2C_BUS=${I2C_BUS} -DATCA_HAL_I2C_SPEED=${I2C_SPEED}" + +do_install() { + oe_runmake DESTDIR=${D} install +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(ccimx6ul)" \ No newline at end of file diff --git a/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb b/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb new file mode 100644 index 000000000..26364cb58 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb @@ -0,0 +1,51 @@ +# Copyright (C) 2017 Digi International. + +SUMMARY = "AWS IoT device SDK Demo" +DESCRIPTION = "Demo application for AWS IoT device SDK" +SECTION = "base" +LICENSE = "ISC" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" + +DEPENDS = "awsiotsdk-c confuse" + +AWS_USER_LED ?= "" +AWS_USER_LED_ccimx6ulstarter ?= "75" +AWS_USER_LED_ccimx6ulsbc ?= "488" +AWS_USER_LED_ccimx6sbc ?= "34" + +SRCBRANCH = "master" +SRCREV = "${AUTOREV}" + +CC_STASH = "${DIGI_MTK_GIT}dey/dey-examples.git;protocol=ssh" +CC_GITHUB = "${DIGI_GITHUB_GIT}/dey-examples.git;protocol=git" + +CC_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${CC_STASH}', '${CC_GITHUB}', d)}" + +SRC_URI = "${CC_GIT_URI};branch=${SRCBRANCH}" + +S = "${WORKDIR}/git/awsiot-sample" + +inherit aws-iot pkgconfig + +EXTRA_OEMAKE += "'LOG_FLAGS=${@get_log_level(d)}'" + +do_configure() { + # Update the configuration header file. + sed -i -e "s,\(thing_name = \)\"\",\1\"${AWS_IOT_MY_THING_NAME}\",g" \ + -e "s,\(host = \)\"\",\1\"${AWS_IOT_MQTT_HOST}\",g" \ + -e "s,8883,${AWS_IOT_MQTT_PORT},g" \ + -e "s,\([\"']\)rootCA.crt\([\"']\),\1${AWS_IOT_ROOT_CA_FILENAME}\2,g" \ + -e "s,\([\"']\)cert.pem\([\"']\),\1${AWS_IOT_CERTIFICATE_FILENAME}\2,g" \ + -e "s,\([\"']\)privkey.pem\([\"']\),\1${AWS_IOT_PRIVATE_KEY_FILENAME}\2,g" \ + -e "s,\(user_led = \)-1,\1${AWS_USER_LED},g" \ + "${S}/cfg_files/awsiotsdk.conf" +} + +do_install() { + oe_runmake DESTDIR=${D} install +} + +RRECOMMENDS_${PN} += "awsiotsdk-c-cert" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-adc-cmp.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-adc-cmp.bb new file mode 100644 index 000000000..18c1f9946 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-adc-cmp.bb @@ -0,0 +1,18 @@ +# Copyright (C) 2017 Digi International. + +SUMMARY = "DEY examples: Analog Comparator test application" +SECTION = "examples" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://adc_cmp_sample" + +S = "${WORKDIR}/adc_cmp_sample" + +do_install() { + install -d ${D}${bindir} + install -m 0755 adc_cmp_sample ${D}${bindir} +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb new file mode 100644 index 000000000..e1700995b --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb @@ -0,0 +1,28 @@ +# Copyright (C) 2017 Digi International. + +SUMMARY = "DEY examples: Cryptochip example application" +SECTION = "examples" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +DEPENDS = "cryptoauthlib" + +SRCBRANCH = "master" +SRCREV = "${AUTOREV}" + +CC_STASH = "${DIGI_MTK_GIT}dey/dey-examples.git;protocol=ssh" +CC_GITHUB = "${DIGI_GITHUB_GIT}/dey-examples.git;protocol=git" + +CC_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${CC_STASH}', '${CC_GITHUB}', d)}" + +SRC_URI = "${CC_GIT_URI};branch=${SRCBRANCH}" + +S = "${WORKDIR}/git/cryptochip-get-random" + +do_install() { + oe_runmake DESTDIR=${D} install +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(ccimx6ul)" + diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/ccimx6/opengles/Makefile b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/ccimx6/opengles/Makefile index ea8c73bbc..96f8d2942 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/ccimx6/opengles/Makefile +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/ccimx6/opengles/Makefile @@ -15,13 +15,16 @@ endif all: $(BINARIES) -es11_example: fsl_egl.o fslutil.o glu3.o - $(CC) $(CFLAGS) $^ -lm -lEGL -lGLESv1_CM $(X11LIBS) $@.c -o $@ +es11_example: es11_example.o fsl_egl.o fslutil.o glu3.o + $(CC) $(LDFLAGS) $^ -lm -lEGL -lGLESv1_CM $(X11LIBS) -o $@ -es20_example: fsl_egl.o fslutil.o - $(CC) $(CFLAGS) $^ -lm -lEGL -lGLESv2 $(X11LIBS) $@.c -o $@ +es20_example: es20_example.o fsl_egl.o fslutil.o + $(CC) $(LDFLAGS) $^ -lm -lEGL -lGLESv2 $(X11LIBS) -o $@ install: $(BINARIES) -mkdir -p $(DEST_DIR)/opt/dey-examples-opengles install -m 0755 $^ $(DEST_DIR)/opt/dey-examples-opengles install -m 0644 texture.bmp $(DEST_DIR)/opt/dey-examples-opengles + +clean: + -rm -f *.o $(BINARIES) diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/Makefile new file mode 100644 index 000000000..7c6ef556f --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/Makefile @@ -0,0 +1,30 @@ +# *************************************************************************** +# Copyright (c) 2017 Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 +# +# *************************************************************************** + +CFLAGS = -Wall -g -D_GNU_SOURCE + +all: adc_cmp_sample + +adc_cmp_sample: adc_cmp_sample.o iio_utils.o + +%.o: %.c iio_utils.h + +.PHONY: clean +clean: + rm -f *.o adc_cmp_sample diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/adc_cmp_sample.c b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/adc_cmp_sample.c new file mode 100644 index 000000000..bf83f2ec2 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/adc_cmp_sample.c @@ -0,0 +1,458 @@ +/* + * ConnectCore 6UL Analog Comparator sample application. + * + * Copyright (c) 2017 Digi International Inc. + * All rights reserved. + * + * Based on iio_event_monitor.c from the tools/iio directory, of the linux + * kernel. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "iio_utils.h" + +#define BUFFER_LEN 20 + +#define FULL_USAGE \ + "Usage:\n" \ + "adc_cmp_sample -c channel [options]\n\n" \ + "Options:\n" \ + " -c : channel number to read from\n" \ + " -h : Threshold_high higher limit of the comparator window\n" \ + " -l : Threshold_low lower limit of the comparator window\n" \ + " -e : edges enabled: 'rising', 'falling' or 'both'\n" \ + " -v : use V for output and thresholds instead of raw values.\n"\ + " -? : help\n\n" + +typedef struct cmp { + char *sysfs_dir; + unsigned int channel; + double voltage_scale; + bool raw; +} cmp_t; + +static void show_usage() +{ + fprintf(stdout, "%s", FULL_USAGE); +} + +static int read_adc_sample_sysfs(cmp_t *cmp, long int *val) +{ + int fd = -1; + int ret; + char buffer[BUFFER_LEN]; + char *path = NULL; + + ret = asprintf(&path, "%s/in_voltage%u_raw", + cmp->sysfs_dir, cmp->channel); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto exit; + } + + fd = open(path, O_RDONLY); + if (fd < 0) { + fprintf(stdout, "%s: failed to open %s\n", + __func__, path); + ret = fd; + goto exit; + } + + ret = read(fd, buffer, BUFFER_LEN); + if (ret < 0) { + fprintf(stdout, "%s: failed to read ADC sample from %s (%d)\n", + __func__, path, ret); + goto exit; + } + + if (ret == 0) { + fprintf(stdout, "%s: no data available in %s\n", + __func__, path); + ret = -ENODATA; + goto exit; + } + + *val = strtol(buffer, NULL, 10); + ret = 0; + +exit: + free(path); + close(fd); + return ret; +} + +static int read_cmp_out_sysfs(cmp_t *cmp, int *val) +{ + int fd = -1; + int ret; + char buffer[BUFFER_LEN]; + char *path = NULL; + + ret = asprintf(&path, "%s/in_voltage%u_cmp_out", + cmp->sysfs_dir, cmp->channel); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto exit; + } + + fd = open(path, O_RDONLY); + if (fd < 0) { + fprintf(stdout, "%s: failed to open %s\n", + __func__, path); + ret = fd; + goto exit; + } + + ret = read(fd, buffer, BUFFER_LEN); + if (ret < 0) { + fprintf(stdout, + "%s: failed to read Comparator Output from %s (%d)\n", + __func__, path, ret); + goto exit; + } else if (ret == 0) { + fprintf(stdout, "%s: no data available in %s\n", + __func__, path); + ret = -ENODATA; + goto exit; + } + + *val = strtol(buffer, NULL, 10); + ret = 0; + +exit: + free(path); + close(fd); + + return ret; +} + +static void process_event(cmp_t *cmp, struct iio_event_data *event) +{ + enum iio_event_direction dir = IIO_EVENT_CODE_EXTRACT_DIR(event->id); + int channel = IIO_EVENT_CODE_EXTRACT_CHAN(event->id); + const char *dir_str; + long sample_val; + int cmp_out; + int ret; + + switch (dir) { + case IIO_EV_DIR_EITHER: + dir_str = "Both"; + break; + case IIO_EV_DIR_RISING: + dir_str = "Rising"; + break; + case IIO_EV_DIR_FALLING: + dir_str = "Falling"; + break; + default: + dir_str = "Unknown"; + break; + } + + ret = read_adc_sample_sysfs(cmp, &sample_val); + if (ret) { + fprintf(stdout, "Failed to read ADC value\n"); + return; + } + + ret = read_cmp_out_sysfs(cmp, &cmp_out); + if (ret) { + fprintf(stdout, "Failed to read CMP Out\n"); + return; + } + + fprintf(stdout, "\n\nGot a Comparator event!\n"); + fprintf(stdout, "\tTime: %lld\n", event->timestamp); + fprintf(stdout, "\tChannel: %d\n", channel); + fprintf(stdout, "\tCMP Out: %d\n", (unsigned int)cmp_out); + fprintf(stdout, "\tEdge: %s\n", dir_str); + + if (cmp->raw) + fprintf(stdout, "\tADC Value: 0x%04x\n", + (unsigned int)sample_val); + else + fprintf(stdout, "\tADC Value: %.2f V\n", + sample_val * cmp->voltage_scale / 1000); +} + +static int read_voltage_scale(cmp_t *cmp) +{ + int fd, ret; + char buffer[BUFFER_LEN]; + char *temp; + + if (cmp->raw) + return 0; + + /* Read the voltage scale from the sysfs */ + ret = asprintf(&temp, "%s/in_voltage_scale", cmp->sysfs_dir); + if (ret < 0) { + fprintf(stdout, "%s: failed to allocate memory\n", __func__); + return -ENOMEM; + } + + fd = open(temp, O_RDONLY); + if (fd < 0) { + fprintf(stdout, "%s: failed to open %s\n", __func__, temp); + ret = fd; + goto free_temp; + } + + ret = read(fd, buffer, BUFFER_LEN); + if (ret < 0) { + fprintf(stdout, + "%s: failed to read voltage scale from %s (%d)\n", + __func__, temp, ret); + goto close_fd; + } else if (ret == 0) { + fprintf(stdout, + "%s: no data available in %s\n", __func__, temp); + ret = -ENODATA; + goto close_fd; + } + + cmp->voltage_scale = atof(buffer); + +close_fd: + close(fd); +free_temp: + free(temp); + return ret; +} + +static int write_in_path(const char *path, const char *str) +{ + int fd = -1; + int ret; + + fd = open(path, O_RDWR); + if (fd < 0) { + fprintf(stdout, "%s: failed to open %s\n", + __func__, path); + ret = fd; + goto exit; + } + + ret = write(fd, str, strlen(str)); + if (ret < 0) { + fprintf(stdout, "%s: failed to write data to %s (%d)\n", + __func__, path, ret); + goto exit; + } + +exit: + close(fd); + return ret; +} + +static int configure_comparator(cmp_t *cmp, uint16_t th_l, uint16_t th_h, + char *edge) +{ + char *path; + char buffer[BUFFER_LEN]; + int ret; + + /* Allocate a few bytes more, since it's reused several times */ + path = malloc(strlen(cmp->sysfs_dir) + strlen("/in_voltageX_cmp_thr_l") + + 15); + if (!path) { + fprintf(stdout, "Failed to allocate memory\n"); + goto exit; + } + + /* Configure Threshold LOW */ + sprintf(path, "%s/in_voltage%u_cmp_thr_l", + cmp->sysfs_dir, cmp->channel); + sprintf(buffer, "%d", th_l); + + ret = write_in_path(path, buffer); + if (ret < 0) + goto exit; + + /* Configure Threshold HIGH */ + sprintf(path, "%s/in_voltage%u_cmp_thr_h", + cmp->sysfs_dir, cmp->channel); + sprintf(buffer, "%d", th_h); + + ret = write_in_path(path, buffer); + if (ret < 0) + goto exit; + + ret = write_in_path(path, buffer); + if (ret < 0) + goto exit; + + /* Configure Edge */ + sprintf(path, "%s/in_voltage%u_cmp_edge", + cmp->sysfs_dir, cmp->channel); + + ret = write_in_path(path, edge); + if (ret < 0) + goto exit; +exit: + free(path); + + return ret; +} + +int main(int argc, char **argv) +{ + int ret, opt; + int fd = -1; + int event_fd = -1; + char *chrdev_path = NULL; + char *edge = NULL; + int dev_num; + double threshold_low = 0; + double threshold_high = 0xFFFF; + cmp_t cmp = { + .sysfs_dir = NULL, + .raw = true, + }; + struct iio_event_data event; + + if (argc <= 3) { + show_usage(); + return EXIT_FAILURE; + } + + while ((opt = getopt(argc, argv, "c:h:l:e:v?")) > 0) { + switch (opt) { + case 'c': + cmp.channel = strtoul(optarg, NULL, 10); + break; + case 'h': + threshold_high = atof(optarg); + break; + case 'l': + threshold_low = atof(optarg); + break; + case 'e': + if (!strcmp(optarg, "rising") && + !strcmp(optarg, "falling") && + !strcmp(optarg, "both")) { + fprintf(stdout, + "Invalid edge (%s)\n", + optarg); + goto exit; + } + edge = strdup(optarg); + if (!edge) { + fprintf(stdout, "Failed to allocate memory\n"); + goto exit; + } + break; + case 'v': + cmp.raw = false; + break; + case '?': + show_usage(); + return EXIT_SUCCESS; + default: + show_usage(); + return EXIT_FAILURE; + } + } + + if (!edge) { + edge = strdup("both"); + if (!edge) { + fprintf(stdout, "Failed to allocate memory\n"); + goto exit; + } + } + + dev_num = find_type_by_name("mca-cc6ul-adc", "iio:device"); + if (dev_num < 0) { + fprintf(stdout, + "Failed to find iio:device for mca-cc6ul-adc\n"); + ret = -ENODEV; + goto exit; + } + + ret = asprintf(&chrdev_path, "/dev/iio:device%d", dev_num); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto exit; + } + + ret = asprintf(&cmp.sysfs_dir, "/sys/bus/iio/devices/iio:device%d", + dev_num); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto exit; + } + + if (!cmp.raw) { + ret = read_voltage_scale(&cmp); + if (ret < 0) + goto exit; + threshold_high = threshold_high * 1000 / cmp.voltage_scale; + threshold_low = threshold_low * 1000 / cmp.voltage_scale; + } + + ret = configure_comparator(&cmp, threshold_low, threshold_high, edge); + if (ret < 0) + goto exit; + + + fd = open(chrdev_path, 0); + if (fd < 0) { + fprintf(stdout, "Failed to open %s\n", chrdev_path); + ret = fd; + goto exit; + } + + ret = ioctl(fd, IIO_GET_EVENT_FD_IOCTL, &event_fd); + + close(fd); + if (ret < 0 || event_fd < 0) { + fprintf(stdout, "Failed to retrieve event fd\n"); + ret = fd; + goto exit; + } + + fprintf(stdout, "Waiting for events:\n"); + + while (true) { + ret = read(event_fd, &event, sizeof(event)); + if (ret < 0) { + if (errno == EAGAIN) { + fprintf(stdout, "No events... continue\n"); + continue; + } else { + perror("Failed to read event from device"); + ret = -errno; + break; + } + } + process_event(&cmp, &event); + } + +exit: + free(cmp.sysfs_dir); + free(chrdev_path); + free(edge); + close(event_fd); + + return ret; +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/iio_utils.c b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/iio_utils.c new file mode 100644 index 000000000..6f6452167 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/iio_utils.c @@ -0,0 +1,669 @@ +/* IIO - useful set of util functionality + * + * Copyright (c) 2008 Jonathan Cameron + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ +#ifndef _IIO_UTILS_H +#define _IIO_UTILS_H + +#include +#include +#include +#include +#include +#include +#include +#include "iio_utils.h" + +const char *iio_dir = "/sys/bus/iio/devices/"; + +static char * const iio_direction[] = { + "in", + "out", +}; + +/** + * iioutils_break_up_name() - extract generic name from full channel name + * @full_name: the full channel name + * @generic_name: the output generic channel name + **/ +int iioutils_break_up_name(const char *full_name, + char **generic_name) +{ + char *current; + char *w, *r; + char *working, *prefix = ""; + int i; + + for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++) + if (!strncmp(full_name, iio_direction[i], + strlen(iio_direction[i]))) { + prefix = iio_direction[i]; + break; + } + + current = strdup(full_name + strlen(prefix) + 1); + working = strtok(current, "_\0"); + + w = working; + r = working; + + while (*r != '\0') { + if (!isdigit(*r)) { + *w = *r; + w++; + } + r++; + } + *w = '\0'; + asprintf(generic_name, "%s_%s", prefix, working); + free(current); + + return 0; +} + +/** + * iioutils_get_type() - find and process _type attribute data + * @is_signed: output whether channel is signed + * @bytes: output how many bytes the channel storage occupies + * @mask: output a bit mask for the raw data + * @be: big endian + * @device_dir: the iio device directory + * @name: the channel name + * @generic_name: the channel type name + **/ +int iioutils_get_type(unsigned *is_signed, + unsigned *bytes, + unsigned *bits_used, + unsigned *shift, + uint64_t *mask, + unsigned *be, + const char *device_dir, + const char *name, + const char *generic_name) +{ + FILE *sysfsfp; + int ret; + DIR *dp; + char *scan_el_dir, *builtname, *builtname_generic, *filename = 0; + char signchar, endianchar; + unsigned padint; + const struct dirent *ent; + + ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + ret = asprintf(&builtname, FORMAT_TYPE_FILE, name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_scan_el_dir; + } + ret = asprintf(&builtname_generic, FORMAT_TYPE_FILE, generic_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_builtname; + } + + dp = opendir(scan_el_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_builtname_generic; + } + while (ent = readdir(dp), ent != NULL) + /* + * Do we allow devices to override a generic name with + * a specific one? + */ + if ((strcmp(builtname, ent->d_name) == 0) || + (strcmp(builtname_generic, ent->d_name) == 0)) { + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_closedir; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", filename); + ret = -errno; + goto error_free_filename; + } + + ret = fscanf(sysfsfp, + "%ce:%c%u/%u>>%u", + &endianchar, + &signchar, + bits_used, + &padint, shift); + if (ret < 0) { + printf("failed to pass scan type description\n"); + ret = -errno; + goto error_close_sysfsfp; + } + *be = (endianchar == 'b'); + *bytes = padint / 8; + if (*bits_used == 64) + *mask = ~0; + else + *mask = (1 << *bits_used) - 1; + if (signchar == 's') + *is_signed = 1; + else + *is_signed = 0; + fclose(sysfsfp); + free(filename); + + filename = 0; + sysfsfp = 0; + } +error_close_sysfsfp: + if (sysfsfp) + fclose(sysfsfp); +error_free_filename: + if (filename) + free(filename); +error_closedir: + closedir(dp); +error_free_builtname_generic: + free(builtname_generic); +error_free_builtname: + free(builtname); +error_free_scan_el_dir: + free(scan_el_dir); +error_ret: + return ret; +} + +int iioutils_get_param_float(float *output, + const char *param_name, + const char *device_dir, + const char *name, + const char *generic_name) +{ + FILE *sysfsfp; + int ret; + DIR *dp; + char *builtname, *builtname_generic; + char *filename = NULL; + const struct dirent *ent; + + ret = asprintf(&builtname, "%s_%s", name, param_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + ret = asprintf(&builtname_generic, + "%s_%s", generic_name, param_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_builtname; + } + dp = opendir(device_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_builtname_generic; + } + while (ent = readdir(dp), ent != NULL) + if ((strcmp(builtname, ent->d_name) == 0) || + (strcmp(builtname_generic, ent->d_name) == 0)) { + ret = asprintf(&filename, + "%s/%s", device_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_closedir; + } + sysfsfp = fopen(filename, "r"); + if (!sysfsfp) { + ret = -errno; + goto error_free_filename; + } + fscanf(sysfsfp, "%f", output); + break; + } +error_free_filename: + if (filename) + free(filename); +error_closedir: + closedir(dp); +error_free_builtname_generic: + free(builtname_generic); +error_free_builtname: + free(builtname); +error_ret: + return ret; +} + +/** + * bsort_channel_array_by_index() - reorder so that the array is in index order + * + **/ + +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, + int cnt) +{ + + struct iio_channel_info temp; + int x, y; + + for (x = 0; x < cnt; x++) + for (y = 0; y < (cnt - 1); y++) + if ((*ci_array)[y].index > (*ci_array)[y+1].index) { + temp = (*ci_array)[y + 1]; + (*ci_array)[y + 1] = (*ci_array)[y]; + (*ci_array)[y] = temp; + } +} + +/** + * build_channel_array() - function to figure out what channels are present + * @device_dir: the IIO device directory in sysfs + * @ + **/ +int build_channel_array(const char *device_dir, + struct iio_channel_info **ci_array, + int *counter) +{ + DIR *dp; + FILE *sysfsfp; + int count, i; + struct iio_channel_info *current; + int ret; + const struct dirent *ent; + char *scan_el_dir; + char *filename; + + *counter = 0; + ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + dp = opendir(scan_el_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_name; + } + while (ent = readdir(dp), ent != NULL) + if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), + "_en") == 0) { + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_close_dir; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + ret = -errno; + free(filename); + goto error_close_dir; + } + fscanf(sysfsfp, "%i", &ret); + if (ret == 1) + (*counter)++; + fclose(sysfsfp); + free(filename); + } + *ci_array = malloc(sizeof(**ci_array) * (*counter)); + if (*ci_array == NULL) { + ret = -ENOMEM; + goto error_close_dir; + } + seekdir(dp, 0); + count = 0; + while (ent = readdir(dp), ent != NULL) { + if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), + "_en") == 0) { + int current_enabled = 0; + + current = &(*ci_array)[count++]; + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + /* decrement count to avoid freeing name */ + count--; + goto error_cleanup_array; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + free(filename); + ret = -errno; + goto error_cleanup_array; + } + fscanf(sysfsfp, "%i", ¤t_enabled); + fclose(sysfsfp); + + if (!current_enabled) { + free(filename); + count--; + continue; + } + + current->scale = 1.0; + current->offset = 0; + current->name = strndup(ent->d_name, + strlen(ent->d_name) - + strlen("_en")); + if (current->name == NULL) { + free(filename); + ret = -ENOMEM; + goto error_cleanup_array; + } + /* Get the generic and specific name elements */ + ret = iioutils_break_up_name(current->name, + ¤t->generic_name); + if (ret) { + free(filename); + goto error_cleanup_array; + } + ret = asprintf(&filename, + "%s/%s_index", + scan_el_dir, + current->name); + if (ret < 0) { + free(filename); + ret = -ENOMEM; + goto error_cleanup_array; + } + sysfsfp = fopen(filename, "r"); + fscanf(sysfsfp, "%u", ¤t->index); + fclose(sysfsfp); + free(filename); + /* Find the scale */ + ret = iioutils_get_param_float(¤t->scale, + "scale", + device_dir, + current->name, + current->generic_name); + if (ret < 0) + goto error_cleanup_array; + ret = iioutils_get_param_float(¤t->offset, + "offset", + device_dir, + current->name, + current->generic_name); + if (ret < 0) + goto error_cleanup_array; + ret = iioutils_get_type(¤t->is_signed, + ¤t->bytes, + ¤t->bits_used, + ¤t->shift, + ¤t->mask, + ¤t->be, + device_dir, + current->name, + current->generic_name); + } + } + + closedir(dp); + /* reorder so that the array is in index order */ + bsort_channel_array_by_index(ci_array, *counter); + + return 0; + +error_cleanup_array: + for (i = count - 1; i >= 0; i--) + free((*ci_array)[i].name); + free(*ci_array); +error_close_dir: + closedir(dp); +error_free_name: + free(scan_el_dir); +error_ret: + return ret; +} + +/** + * find_type_by_name() - function to match top level types by name + * @name: top level type instance name + * @type: the type of top level instance being sort + * + * Typical types this is used for are device and trigger. + **/ +int find_type_by_name(const char *name, const char *type) +{ + const struct dirent *ent; + int number, numstrlen; + + FILE *nameFile; + DIR *dp; + char thisname[IIO_MAX_NAME_LENGTH]; + char *filename; + + dp = opendir(iio_dir); + if (dp == NULL) { + printf("No industrialio devices available\n"); + return -ENODEV; + } + + while (ent = readdir(dp), ent != NULL) { + if (strcmp(ent->d_name, ".") != 0 && + strcmp(ent->d_name, "..") != 0 && + strlen(ent->d_name) > strlen(type) && + strncmp(ent->d_name, type, strlen(type)) == 0) { + numstrlen = sscanf(ent->d_name + strlen(type), + "%d", + &number); + /* verify the next character is not a colon */ + if (strncmp(ent->d_name + strlen(type) + numstrlen, + ":", + 1) != 0) { + filename = malloc(strlen(iio_dir) + + strlen(type) + + numstrlen + + 6); + if (filename == NULL) { + closedir(dp); + return -ENOMEM; + } + sprintf(filename, "%s%s%d/name", + iio_dir, + type, + number); + nameFile = fopen(filename, "r"); + if (!nameFile) { + free(filename); + continue; + } + free(filename); + fscanf(nameFile, "%s", thisname); + fclose(nameFile); + if (strcmp(name, thisname) == 0) { + closedir(dp); + return number; + } + } + } + } + closedir(dp); + return -ENODEV; +} + +int _write_sysfs_int(char *filename, char *basedir, int val, int verify) +{ + int ret = 0; + FILE *sysfsfp; + int test; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) + return -ENOMEM; + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "w"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", temp); + ret = -errno; + goto error_free; + } + fprintf(sysfsfp, "%d", val); + fclose(sysfsfp); + if (verify) { + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", temp); + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%d", &test); + fclose(sysfsfp); + if (test != val) { + printf("Possible failure in int write %d to %s%s\n", + val, + basedir, + filename); + ret = -1; + } + } +error_free: + free(temp); + return ret; +} + +int write_sysfs_int(char *filename, char *basedir, int val) +{ + return _write_sysfs_int(filename, basedir, val, 0); +} + +int write_sysfs_int_and_verify(char *filename, char *basedir, int val) +{ + return _write_sysfs_int(filename, basedir, val, 1); +} + +int _write_sysfs_string(char *filename, char *basedir, char *val, int verify) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed\n"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "w"); + if (sysfsfp == NULL) { + printf("Could not open %s\n", temp); + ret = -errno; + goto error_free; + } + fprintf(sysfsfp, "%s", val); + fclose(sysfsfp); + if (verify) { + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + printf("could not open file to verify\n"); + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%s", temp); + fclose(sysfsfp); + if (strcmp(temp, val) != 0) { + printf("Possible failure in string write of %s " + "Should be %s " + "written to %s\%s\n", + temp, + val, + basedir, + filename); + ret = -1; + } + } +error_free: + free(temp); + + return ret; +} + +/** + * write_sysfs_string_and_verify() - string write, readback and verify + * @filename: name of file to write to + * @basedir: the sysfs directory in which the file is to be found + * @val: the string to write + **/ +int write_sysfs_string_and_verify(char *filename, char *basedir, char *val) +{ + return _write_sysfs_string(filename, basedir, val, 1); +} + +int write_sysfs_string(char *filename, char *basedir, char *val) +{ + return _write_sysfs_string(filename, basedir, val, 0); +} + +int read_sysfs_posint(char *filename, char *basedir) +{ + int ret; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%d\n", &ret); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +int read_sysfs_float(char *filename, char *basedir, float *val) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%f\n", val); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +int read_sysfs_string(const char *filename, const char *basedir, char *str) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%s\n", str); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +#endif /* _IIO_UTILS_H */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/iio_utils.h b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/iio_utils.h new file mode 100644 index 000000000..1bc837b2d --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_cmp_sample/iio_utils.h @@ -0,0 +1,71 @@ +#ifndef _IIO_UTILS_H_ +#define _IIO_UTILS_H_ + +/* IIO - useful set of util functionality + * + * Copyright (c) 2008 Jonathan Cameron + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include + +/* Made up value to limit allocation sizes */ +#define IIO_MAX_NAME_LENGTH 30 + +#define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" +#define FORMAT_TYPE_FILE "%s_type" + +extern const char *iio_dir; + +/** + * struct iio_channel_info - information about a given channel + * @name: channel name + * @generic_name: general name for channel type + * @scale: scale factor to be applied for conversion to si units + * @offset: offset to be applied for conversion to si units + * @index: the channel index in the buffer output + * @bytes: number of bytes occupied in buffer output + * @mask: a bit mask for the raw output + * @is_signed: is the raw value stored signed + * @enabled: is this channel enabled + **/ +struct iio_channel_info { + char *name; + char *generic_name; + float scale; + float offset; + unsigned index; + unsigned bytes; + unsigned bits_used; + unsigned shift; + uint64_t mask; + unsigned be; + unsigned is_signed; + unsigned location; +}; + +int iioutils_break_up_name(const char *full_name, char **generic_name); +int iioutils_get_type(unsigned *is_signed, unsigned *bytes, + unsigned *bits_used, unsigned *shift, + uint64_t *mask, unsigned *be, + const char *device_dir, const char *name, + const char *generic_name); +int iioutils_get_param_float(float *output, const char *param_name, + const char *device_dir, const char *name, + const char *generic_name); +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt); +int build_channel_array(const char *device_dir, + struct iio_channel_info **ci_array, int *counter); +int find_type_by_name(const char *name, const char *type); +int write_sysfs_int(char *filename, char *basedir, int val); +int write_sysfs_int_and_verify(char *filename, char *basedir, int val); +int write_sysfs_string_and_verify(char *filename, char *basedir, char *val); +int write_sysfs_string(char *filename, char *basedir, char *val); +int read_sysfs_posint(char *filename, char *basedir); +int read_sysfs_float(char *filename, char *basedir, float *val); +int read_sysfs_string(const char *filename, const char *basedir, char *str); + +#endif /* _IIO_UTILS_H_ */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c index 1dc8ebbab..6848db0d2 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c @@ -196,7 +196,7 @@ int main(int argc, char **argv) int ret, opt, i; if (argc <= 2) { - show_usage(0); + show_usage(1); return EXIT_FAILURE; } diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/spidev_test/spidev_test.c b/meta-digi-dey/recipes-digi/dey-examples/files/spidev_test/spidev_test.c index 44eaa3173..8c590cd11 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/spidev_test/spidev_test.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/spidev_test/spidev_test.c @@ -15,9 +15,13 @@ #include #include #include +#include #include #include +#include #include +#include +#include #include #include @@ -30,62 +34,163 @@ static void pabort(const char *s) } static const char *device = "/dev/spidev1.1"; -static uint8_t mode; +static uint32_t mode; static uint8_t bits = 8; +static char *input_file; +static char *output_file; static uint32_t speed = 500000; static uint16_t delay; +static int verbose; +static int transfer_size; +static int iterations; +static int interval = 5; /* interval in seconds for showing transfer rate */ -static void transfer(int fd) +uint8_t default_tx[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x95, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x0D, +}; + +uint8_t default_rx[ARRAY_SIZE(default_tx)] = {0, }; +char *input_tx; + +static void hex_dump(const void *src, size_t length, size_t line_size, + char *prefix) +{ + int i = 0; + const unsigned char *address = src; + const unsigned char *line = address; + unsigned char c; + + printf("%s | ", prefix); + while (length-- > 0) { + printf("%02X ", *address++); + if (!(++i % line_size) || (length == 0 && i % line_size)) { + if (length == 0) { + while (i++ % line_size) + printf("__ "); + } + printf(" | "); /* right close */ + while (line < address) { + c = *line++; + printf("%c", (c < 33 || c == 255) ? 0x2E : c); + } + printf("\n"); + if (length > 0) + printf("%s | ", prefix); + } + } +} + +/* + * Unescape - process hexadecimal escape character + * converts shell input "\x23" -> 0x23 + */ +static int unescape(char *_dst, char *_src, size_t len) +{ + int ret = 0; + int match; + char *src = _src; + char *dst = _dst; + unsigned int ch; + + while (*src) { + if (*src == '\\' && *(src+1) == 'x') { + match = sscanf(src + 2, "%2x", &ch); + if (!match) + pabort("malformed input string"); + + src += 4; + *dst++ = (unsigned char)ch; + } else { + *dst++ = *src++; + } + ret++; + } + return ret; +} + +static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len) { int ret; - uint8_t tx[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x95, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD, - 0xF0, 0x0D, - }; - uint8_t rx[ARRAY_SIZE(tx)] = {0, }; + int out_fd; struct spi_ioc_transfer tr = { .tx_buf = (unsigned long)tx, .rx_buf = (unsigned long)rx, - .len = ARRAY_SIZE(tx), + .len = len, .delay_usecs = delay, .speed_hz = speed, .bits_per_word = bits, }; + if (mode & SPI_TX_QUAD) + tr.tx_nbits = 4; + else if (mode & SPI_TX_DUAL) + tr.tx_nbits = 2; + if (mode & SPI_RX_QUAD) + tr.rx_nbits = 4; + else if (mode & SPI_RX_DUAL) + tr.rx_nbits = 2; + if (!(mode & SPI_LOOP)) { + if (mode & (SPI_TX_QUAD | SPI_TX_DUAL)) + tr.rx_buf = 0; + else if (mode & (SPI_RX_QUAD | SPI_RX_DUAL)) + tr.tx_buf = 0; + } + ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); - if (ret < 0) + if (ret < 1) pabort("can't send spi message"); - for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { - if (!(ret % 6)) - puts(""); - printf("%.2X ", rx[ret]); + if (verbose) + hex_dump(tx, len, 32, "TX"); + + if (output_file) { + out_fd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (out_fd < 0) + pabort("could not open output file"); + + ret = write(out_fd, rx, len); + if (ret != len) + pabort("not all bytes written to output file"); + + close(out_fd); } - puts(""); + + if (verbose) + hex_dump(rx, len, 32, "RX"); } -void print_usage(const char *prog) +static void print_usage(const char *prog) { - printf("Usage: %s [-DsbdlHOLC3]\n", prog); + printf("Usage: %s [-DsbdlHOLC3vpNR24SI]\n", prog); puts(" -D --device device to use (default /dev/spidev1.1)\n" " -s --speed max speed (Hz)\n" " -d --delay delay (usec)\n" - " -b --bpw bits per word \n" + " -b --bpw bits per word\n" + " -i --input input data from a file (e.g. \"test.bin\")\n" + " -o --output output data to a file (e.g. \"results.bin\")\n" " -l --loop loopback\n" " -H --cpha clock phase\n" " -O --cpol clock polarity\n" " -L --lsb least significant bit first\n" " -C --cs-high chip select active high\n" - " -3 --3wire SI/SO signals shared\n"); + " -3 --3wire SI/SO signals shared\n" + " -v --verbose Verbose (show tx buffer)\n" + " -p Send data (e.g. \"1234\\xde\\xad\")\n" + " -N --no-cs no chip select\n" + " -R --ready slave pulls low to pause\n" + " -2 --dual dual transfer\n" + " -4 --quad quad transfer\n" + " -S --size transfer size\n" + " -I --iter iterations\n"); exit(1); } -void parse_opts(int argc, char *argv[]) +static void parse_opts(int argc, char *argv[]) { while (1) { static const struct option lopts[] = { @@ -93,6 +198,8 @@ void parse_opts(int argc, char *argv[]) { "speed", 1, 0, 's' }, { "delay", 1, 0, 'd' }, { "bpw", 1, 0, 'b' }, + { "input", 1, 0, 'i' }, + { "output", 1, 0, 'o' }, { "loop", 0, 0, 'l' }, { "cpha", 0, 0, 'H' }, { "cpol", 0, 0, 'O' }, @@ -101,11 +208,17 @@ void parse_opts(int argc, char *argv[]) { "3wire", 0, 0, '3' }, { "no-cs", 0, 0, 'N' }, { "ready", 0, 0, 'R' }, + { "dual", 0, 0, '2' }, + { "verbose", 0, 0, 'v' }, + { "quad", 0, 0, '4' }, + { "size", 1, 0, 'S' }, + { "iter", 1, 0, 'I' }, { NULL, 0, 0, 0 }, }; int c; - c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR", lopts, NULL); + c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3NR24p:vS:I:", + lopts, NULL); if (c == -1) break; @@ -123,6 +236,12 @@ void parse_opts(int argc, char *argv[]) case 'b': bits = atoi(optarg); break; + case 'i': + input_file = optarg; + break; + case 'o': + output_file = optarg; + break; case 'l': mode |= SPI_LOOP; break; @@ -144,14 +263,142 @@ void parse_opts(int argc, char *argv[]) case 'N': mode |= SPI_NO_CS; break; + case 'v': + verbose = 1; + break; case 'R': mode |= SPI_READY; break; + case 'p': + input_tx = optarg; + break; + case '2': + mode |= SPI_TX_DUAL; + break; + case '4': + mode |= SPI_TX_QUAD; + break; + case 'S': + transfer_size = atoi(optarg); + break; + case 'I': + iterations = atoi(optarg); + break; default: print_usage(argv[0]); break; } } + if (mode & SPI_LOOP) { + if (mode & SPI_TX_DUAL) + mode |= SPI_RX_DUAL; + if (mode & SPI_TX_QUAD) + mode |= SPI_RX_QUAD; + } +} + +static void transfer_escaped_string(int fd, char *str) +{ + size_t size = strlen(str); + uint8_t *tx; + uint8_t *rx; + + tx = malloc(size); + if (!tx) + pabort("can't allocate tx buffer"); + + rx = malloc(size); + if (!rx) + pabort("can't allocate rx buffer"); + + size = unescape((char *)tx, str, size); + transfer(fd, tx, rx, size); + free(rx); + free(tx); +} + +static void transfer_file(int fd, char *filename) +{ + ssize_t bytes; + struct stat sb; + int tx_fd; + uint8_t *tx; + uint8_t *rx; + + if (stat(filename, &sb) == -1) + pabort("can't stat input file"); + + tx_fd = open(filename, O_RDONLY); + if (tx_fd < 0) + pabort("can't open input file"); + + tx = malloc(sb.st_size); + if (!tx) + pabort("can't allocate tx buffer"); + + rx = malloc(sb.st_size); + if (!rx) + pabort("can't allocate rx buffer"); + + bytes = read(tx_fd, tx, sb.st_size); + if (bytes != sb.st_size) + pabort("failed to read input file"); + + transfer(fd, tx, rx, sb.st_size); + free(rx); + free(tx); + close(tx_fd); +} + +static uint64_t _read_count; +static uint64_t _write_count; + +static void show_transfer_rate(void) +{ + static uint64_t prev_read_count, prev_write_count; + double rx_rate, tx_rate; + + rx_rate = ((_read_count - prev_read_count) * 8) / (interval*1000.0); + tx_rate = ((_write_count - prev_write_count) * 8) / (interval*1000.0); + + printf("rate: tx %.1fkbps, rx %.1fkbps\n", rx_rate, tx_rate); + + prev_read_count = _read_count; + prev_write_count = _write_count; +} + +static void transfer_buf(int fd, int len) +{ + uint8_t *tx; + uint8_t *rx; + int i; + + tx = malloc(len); + if (!tx) + pabort("can't allocate tx buffer"); + for (i = 0; i < len; i++) + tx[i] = random(); + + rx = malloc(len); + if (!rx) + pabort("can't allocate rx buffer"); + + transfer(fd, tx, rx, len); + + _write_count += len; + _read_count += len; + + if (mode & SPI_LOOP) { + if (memcmp(tx, rx, len)) { + fprintf(stderr, "transfer error !\n"); + hex_dump(tx, len, 32, "TX"); + hex_dump(rx, len, 32, "RX"); + exit(1); + } + } + + free(rx); + free(tx); } int main(int argc, char *argv[]) @@ -168,11 +415,11 @@ int main(int argc, char *argv[]) /* * spi mode */ - ret = ioctl(fd, SPI_IOC_WR_MODE, &mode); + ret = ioctl(fd, SPI_IOC_WR_MODE32, &mode); if (ret == -1) pabort("can't set spi mode"); - ret = ioctl(fd, SPI_IOC_RD_MODE, &mode); + ret = ioctl(fd, SPI_IOC_RD_MODE32, &mode); if (ret == -1) pabort("can't get spi mode"); @@ -198,11 +445,37 @@ int main(int argc, char *argv[]) if (ret == -1) pabort("can't get max speed hz"); - printf("spi mode: %d\n", mode); + printf("spi mode: 0x%x\n", mode); printf("bits per word: %d\n", bits); printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000); - transfer(fd); + if (input_tx && input_file) + pabort("only one of -p and --input may be selected"); + + if (input_tx) + transfer_escaped_string(fd, input_tx); + else if (input_file) + transfer_file(fd, input_file); + else if (transfer_size) { + struct timespec last_stat; + + clock_gettime(CLOCK_MONOTONIC, &last_stat); + + while (iterations-- > 0) { + struct timespec current; + + transfer_buf(fd, transfer_size); + + clock_gettime(CLOCK_MONOTONIC, ¤t); + if (current.tv_sec - last_stat.tv_sec > interval) { + show_transfer_rate(); + last_stat = current; + } + } + printf("total: tx %.1fKB, rx %.1fKB\n", + _write_count/1024.0, _read_count/1024.0); + } else + transfer(fd, default_tx, default_rx, sizeof(default_tx)); close(fd); diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/tamper_sample/tamper_sample.c b/meta-digi-dey/recipes-digi/dey-examples/files/tamper_sample/tamper_sample.c index d3e2dc17d..834ed4895 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/tamper_sample/tamper_sample.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/tamper_sample/tamper_sample.c @@ -86,27 +86,25 @@ static void tamper_event_actions(mca_tamper_t *tdata) static void tamper_event_ack(mca_tamper_t *tdata) { int ret; - char *tamper_sysfs_dir; + char tamper_sysfs_dir[sizeof("/sys/bus/iio/devices/iio:deviceX")]; - ret = asprintf(&tamper_sysfs_dir, - "/sys/bus/iio/devices/iio:device%d", - tdata->dev_num); + ret = sprintf(tamper_sysfs_dir, + "/sys/bus/iio/devices/iio:device%d", tdata->dev_num); if (ret < 0) { fprintf(stdout, "Failed to build event ack file name\n"); return; } /* Finally, acknowledge the event */ - ret = write_sysfs_int("tamper_events", tamper_sysfs_dir, 2); - if (ret < 0) { + ret = write_sysfs_string("tamper_events", tamper_sysfs_dir, "ack"); + if (ret < 0) fprintf(stdout, "Failed to acknowledge tamper%d event\n", tdata->iface); - } } -static void process_tamper_event(mca_tamper_t *tdata) +static void process_tamper_event(mca_tamper_t *tdata, bool check_event) { - if (!event_is_tamper(&tdata->event)) { + if (check_event && !event_is_tamper(&tdata->event)) { fprintf(stdout, "Unknown event: time: %lld, id: %llx\n", tdata->event.timestamp, tdata->event.id); return; @@ -117,6 +115,48 @@ static void process_tamper_event(mca_tamper_t *tdata) tamper_event_ack(tdata); } +static int check_tamper_event(mca_tamper_t *tdata) +{ + int ret; + char tamper_sysfs_dir[sizeof("/sys/bus/iio/devices/iio:deviceX")]; + char str[50]; + + ret = sprintf(tamper_sysfs_dir, + "/sys/bus/iio/devices/iio:device%d", tdata->dev_num); + if (ret < 0) { + fprintf(stdout, "Failed to build event file name\n"); + return -1; + } + + ret = read_sysfs_string("tamper_events", tamper_sysfs_dir, str); + if (ret < 0) { + fprintf(stdout, "Failed to read tamper%d event\n", + tdata->iface); + return -1; + } + + if (!strncmp(str, "none", strlen("none"))) { + /* Continue to wait for tamper event to happen */ + return 0; + } else if (!strncmp(str, "signaled+acked", strlen("signaled+acked"))) { + fprintf(stdout, "Tamper event already acknowledged, not taking actions\n"); + return 1; + } else if (!strncmp(str, "signaled", strlen("signaled"))) { + tdata->event.timestamp = read_sysfs_posint("timestamp", + tamper_sysfs_dir); + if (tdata->event.timestamp < 0) + fprintf(stdout, "Failed to read timestamp for tamper%d!\n", + tdata->iface); + + fprintf(stdout, "Tamper event was already signaled.\n"); + process_tamper_event(tdata, false); + return 1; + } + + fprintf(stdout, "Unkown status for tamper%d: '%s'\n", tdata->iface, str); + return -1; +} + int main(int argc, char **argv) { mca_tamper_t *tdata = &tamper_data; @@ -169,6 +209,10 @@ int main(int argc, char **argv) goto error_ret2; } + ret = check_tamper_event(tdata); + if (ret) + goto error_ret3; + fd = open(tdata->chrdev_name, 0); if (fd < 0) { fprintf(stdout, "Failed to open %s\n", tdata->chrdev_name); @@ -201,7 +245,7 @@ int main(int argc, char **argv) } } - process_tamper_event(tdata); + process_tamper_event(tdata, true); } close(tdata->event_fd); diff --git a/meta-digi-dey/recipes-digi/memwatch/memwatch/memwatch.c b/meta-digi-dey/recipes-digi/memwatch/memwatch/memwatch.c index 82c206b81..f532a3407 100644 --- a/meta-digi-dey/recipes-digi/memwatch/memwatch/memwatch.c +++ b/meta-digi-dey/recipes-digi/memwatch/memwatch/memwatch.c @@ -1,7 +1,7 @@ /* * memwatch.c: Program to read/write from/to memory. * - * Copyright (C) 2006 by Digi International Inc. + * Copyright (C) 2006-2017 by Digi International Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify it @@ -243,10 +243,11 @@ int main( int argc, char** argv ) } if( ( verbose < VERB_PRNT_ADDR ) && ( j % 16 == 0 ) ) { - printf( "\n0x%08lx: ", address + j ); + if (j > 0) + printf("\n"); + printf( "0x%08lx: ", address + j ); } print_hex_formated( rd_val, access ); - } else { if( filename != NULL ) { if( ( ret = read( fd_file, &wr_val, access ) ) != access ) { @@ -263,6 +264,7 @@ int main( int argc, char** argv ) } virt_addr += access; } + printf("\n"); if( munmap( map_base, MAP_SIZE ) == -1 ) { fprintf( stderr, "Error unmapping memory\n" ); diff --git a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb index e854834b6..77bbc682b 100644 --- a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb +++ b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013 Digi International. +# Copyright (C) 2013-2017 Digi International. SUMMARY = "DEY examples packagegroup" @@ -24,6 +24,7 @@ RDEPENDS_${PN}_append_ccardimx28 = "\ " RDEPENDS_${PN}_append_ccimx6 = "\ + awsiotsdk-demo \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ dey-examples-can \ @@ -34,9 +35,11 @@ RDEPENDS_${PN}_append_ccimx6 = "\ " RDEPENDS_${PN}_append_ccimx6ul = "\ + awsiotsdk-demo \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ dey-examples-adc \ + dey-examples-adc-cmp \ dey-examples-can \ dey-examples-cloudconnector \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ diff --git a/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb b/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb index bd81b2b07..37082d2e9 100644 --- a/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb +++ b/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb @@ -1,57 +1,3 @@ # Copyright (C) 2016, 2017 Digi International Inc. -SUMMARY = "Generate update package for SWUpdate" -SECTION = "base" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" -SRC_URI = "file://sw-description" -SRC_URI_append_ccimx6 = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), 'file://preinstall_swu.sh', '')}" -SRC_URI_append_ccimx6ul = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', 'file://preinstall_swu.sh')}" - -inherit swupdate - -IMAGE_DEPENDS = "core-image-base" - -SWUPDATE_IMAGES = "core-image-base" - -SOFTWARE_VERSION ?= "0.0.1" - -BOOTFS_EXT ?= ".boot.vfat" -BOOTFS_EXT_ccimx6ul ?= ".boot.ubifs" -ROOTFS_EXT ?= ".ext4" -ROOTFS_EXT_ccimx6ul ?= ".ubifs" - -BOOT_DEV_NAME ?= "/dev/mmcblk0p1" -BOOT_DEV_NAME_ccimx6ul ?= "linux" -ROOTFS_DEV_NAME ?= "/dev/mmcblk0p3" -ROOTFS_DEV_NAME_ccimx6ul ?= "rootfs" -ROOTFS_ENC_DEV = "/dev/mapper/cryptroot" -ROOTFS_ENC_DEV_ccimx6ul = "${ROOTFS_DEV_NAME}" -ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${ROOTFS_ENC_DEV}', '${ROOTFS_DEV_NAME}')}" -PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );" -PREINST_SCRIPT_DESC = "" -PREINST_SCRIPT_DESC_ccimx6sbc = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}" -PREINST_SCRIPT_DESC_ccimx6ul = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', '${PREINST_SCRIPT_TEMPLATE}')}" - -python () { - img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True) - d.setVarFlag("SWUPDATE_IMAGES_FSTYPES", "core-image-base", img_fstypes) -} - -python do_swuimage_prepend() { - import glob - - if (d.getVar('TRUSTFENCE_SIGN', True) == "1"): - d.setVar('SWUPDATE_PRIVATE_KEY', glob.glob(d.getVar('SWUPDATE_PRIVATE_KEY_TEMPLATE', True))[0]) -} - -do_unpack[postfuncs] += "fill_description" - -fill_description() { - sed -i -e "s,##BOOTIMG_NAME##,core-image-base-${MACHINE}${BOOTFS_EXT},g" "${WORKDIR}/sw-description" - sed -i -e "s,##BOOT_DEV##,${BOOT_DEV_NAME},g" "${WORKDIR}/sw-description" - sed -i -e "s,##ROOTIMG_NAME##,core-image-base-${MACHINE}${ROOTFS_EXT},g" "${WORKDIR}/sw-description" - sed -i -e "s,##ROOTFS_DEV##,${ROOTFS_DEV_NAME_FINAL},g" "${WORKDIR}/sw-description" - sed -i -e "s,##SW_VERSION##,${SOFTWARE_VERSION},g" "${WORKDIR}/sw-description" - sed -i -e "s/##PREINSTALL_SCRIPT##/${PREINST_SCRIPT_DESC}/g" "${WORKDIR}/sw-description" -} +require swu.inc diff --git a/meta-digi-dey/recipes-digi/swu-images/dey-image-aws-swu.bb b/meta-digi-dey/recipes-digi/swu-images/dey-image-aws-swu.bb new file mode 100644 index 000000000..3483f5fe3 --- /dev/null +++ b/meta-digi-dey/recipes-digi/swu-images/dey-image-aws-swu.bb @@ -0,0 +1,3 @@ +# Copyright (C) 2017 Digi International Inc. + +require swu.inc diff --git a/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb b/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb index e79e9cebb..e6c4ab755 100644 --- a/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb +++ b/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb @@ -1,57 +1,5 @@ # Copyright (C) 2016, 2017 Digi International Inc. -SUMMARY = "Generate update package for SWUpdate" -SECTION = "base" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" -SRC_URI = "file://sw-description" -SRC_URI_append_ccimx6 = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), 'file://preinstall_swu.sh', '')}" -SRC_URI_append_ccimx6ul = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', 'file://preinstall_swu.sh')}" +require swu.inc -inherit swupdate - -IMAGE_DEPENDS = "dey-image-qt" - -SWUPDATE_IMAGES = "dey-image-qt-${GRAPHICAL_BACKEND}" - -SOFTWARE_VERSION ?= "0.0.1" - -BOOTFS_EXT ?= ".boot.vfat" -BOOTFS_EXT_ccimx6ul ?= ".boot.ubifs" -ROOTFS_EXT ?= ".ext4" -ROOTFS_EXT_ccimx6ul ?= ".ubifs" - -BOOT_DEV_NAME ?= "/dev/mmcblk0p1" -BOOT_DEV_NAME_ccimx6ul ?= "linux" -ROOTFS_DEV_NAME ?= "/dev/mmcblk0p3" -ROOTFS_DEV_NAME_ccimx6ul ?= "rootfs" -ROOTFS_ENC_DEV = "/dev/mapper/cryptroot" -ROOTFS_ENC_DEV_ccimx6ul = "${ROOTFS_DEV_NAME}" -ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${ROOTFS_ENC_DEV}', '${ROOTFS_DEV_NAME}')}" -PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );" -PREINST_SCRIPT_DESC = "" -PREINST_SCRIPT_DESC_ccimx6sbc = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}" -PREINST_SCRIPT_DESC_ccimx6ul = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', '${PREINST_SCRIPT_TEMPLATE}')}" - -python () { - img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True) - d.setVarFlag("SWUPDATE_IMAGES_FSTYPES", "dey-image-qt-" + d.getVar('GRAPHICAL_BACKEND', True), img_fstypes) -} - -python do_swuimage_prepend() { - import glob - - if (d.getVar('TRUSTFENCE_SIGN', True) == "1"): - d.setVar('SWUPDATE_PRIVATE_KEY', glob.glob(d.getVar('SWUPDATE_PRIVATE_KEY_TEMPLATE', True))[0]) -} - -do_unpack[postfuncs] += "fill_description" - -fill_description() { - sed -i -e "s,##BOOTIMG_NAME##,dey-image-qt-${GRAPHICAL_BACKEND}-${MACHINE}${BOOTFS_EXT},g" "${WORKDIR}/sw-description" - sed -i -e "s,##BOOT_DEV##,${BOOT_DEV_NAME},g" "${WORKDIR}/sw-description" - sed -i -e "s,##ROOTIMG_NAME##,dey-image-qt-${GRAPHICAL_BACKEND}-${MACHINE}${ROOTFS_EXT},g" "${WORKDIR}/sw-description" - sed -i -e "s,##ROOTFS_DEV##,${ROOTFS_DEV_NAME_FINAL},g" "${WORKDIR}/sw-description" - sed -i -e "s,##SW_VERSION##,${SOFTWARE_VERSION},g" "${WORKDIR}/sw-description" - sed -i -e "s/##PREINSTALL_SCRIPT##/${PREINST_SCRIPT_DESC}/g" "${WORKDIR}/sw-description" -} +IMG_NAME = "${@get_baseimg_pn(d)}-${GRAPHICAL_BACKEND}" diff --git a/meta-digi-dey/recipes-digi/swu-images/swu.inc b/meta-digi-dey/recipes-digi/swu-images/swu.inc new file mode 100644 index 000000000..d88e78df2 --- /dev/null +++ b/meta-digi-dey/recipes-digi/swu-images/swu.inc @@ -0,0 +1,63 @@ +# Copyright (C) 2016, 2017 Digi International Inc. +SUMMARY = "Generate update package for SWUpdate" +SECTION = "base" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://sw-description" +SRC_URI_append_ccimx6 = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), 'file://preinstall_swu.sh', '')}" +SRC_URI_append_ccimx6ul = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', 'file://preinstall_swu.sh')}" + +inherit swupdate + +IMAGE_DEPENDS = "${@get_baseimg_pn(d)}" + +IMG_NAME = "${IMAGE_DEPENDS}" + +SWUPDATE_IMAGES = "${IMG_NAME}" + +SOFTWARE_VERSION ?= "0.0.1" + +BOOTFS_EXT ?= ".boot.vfat" +BOOTFS_EXT_ccimx6ul ?= ".boot.ubifs" +ROOTFS_EXT ?= ".ext4" +ROOTFS_EXT_ccimx6ul ?= ".ubifs" + +BOOT_DEV_NAME ?= "/dev/mmcblk0p1" +BOOT_DEV_NAME_ccimx6ul ?= "linux" +ROOTFS_DEV_NAME ?= "/dev/mmcblk0p3" +ROOTFS_DEV_NAME_ccimx6ul ?= "rootfs" +ROOTFS_ENC_DEV = "/dev/mapper/cryptroot" +ROOTFS_ENC_DEV_ccimx6ul = "${ROOTFS_DEV_NAME}" +ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${ROOTFS_ENC_DEV}', '${ROOTFS_DEV_NAME}')}" +PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );" +PREINST_SCRIPT_DESC = "" +PREINST_SCRIPT_DESC_ccimx6sbc = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}" +PREINST_SCRIPT_DESC_ccimx6ul = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', '${PREINST_SCRIPT_TEMPLATE}')}" + +python () { + img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True) + d.setVarFlag("SWUPDATE_IMAGES_FSTYPES", d.getVar('IMG_NAME', True), img_fstypes) +} + +python do_swuimage_prepend() { + import glob + + if (d.getVar('TRUSTFENCE_SIGN', True) == "1"): + d.setVar('SWUPDATE_PRIVATE_KEY', glob.glob(d.getVar('SWUPDATE_PRIVATE_KEY_TEMPLATE', True))[0]) +} + +def get_baseimg_pn(d): + file_name = d.getVar('PN', True) + return file_name[:file_name.find("-swu")] + +do_unpack[postfuncs] += "fill_description" + +fill_description() { + sed -i -e "s,##BOOTIMG_NAME##,${IMG_NAME}-${MACHINE}${BOOTFS_EXT},g" "${WORKDIR}/sw-description" + sed -i -e "s,##BOOT_DEV##,${BOOT_DEV_NAME},g" "${WORKDIR}/sw-description" + sed -i -e "s,##ROOTIMG_NAME##,${IMG_NAME}-${MACHINE}${ROOTFS_EXT},g" "${WORKDIR}/sw-description" + sed -i -e "s,##ROOTFS_DEV##,${ROOTFS_DEV_NAME_FINAL},g" "${WORKDIR}/sw-description" + sed -i -e "s,##SW_VERSION##,${SOFTWARE_VERSION},g" "${WORKDIR}/sw-description" + sed -i -e "s/##PREINSTALL_SCRIPT##/${PREINST_SCRIPT_DESC}/g" "${WORKDIR}/sw-description" +} diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo index b45afa83f..0ad16d112 100755 --- a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo @@ -296,6 +296,7 @@ printf "\n\n" echo "|| U-Boot | ${UBOOT_VERSION}" echo "|| Firmware | ${DISTRO}-${DEY_VERSION}-$(cat /etc/version)" echo "|| Kernel | $(uname -a)" + echo "|| meta-digi | $(sed -ne '/^meta-digi-dey/s,.*= \(.*\)$,\1,g;T;p' /etc/build)" [ -n "${MCA_VERSION}" ] && echo "|| Kinetis | ${MCA_VERSION}" [ -n "${IOEXP_VERSION}" ] && echo "|| I/O Expander | ${IOEXP_VERSION}" printf "\n\n" diff --git a/scripts/dey-aws-tool.sh b/scripts/dey-aws-tool.sh new file mode 100755 index 000000000..7afacd052 --- /dev/null +++ b/scripts/dey-aws-tool.sh @@ -0,0 +1,141 @@ +#!/bin/sh +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Description: AWS CLI wrapper to be used in DEY +# + +SCRIPTNAME="$(basename ${0})" + +USAGE=" +AWS CLI wrapper to facilitate integration with Digi Embedded Yocto + +Usage: ${SCRIPTNAME} [OPTIONS] + + -c, --create-certs Create Root CA and Greengrass Core device certificates under + -t, --thing-name Name of the Greengrass Core Thing. The script will register this Thing in your account if it is not already. +" + +error() { + printf "%s\n" "${1}" + exit 1 +} + +do_create_certs() { + GG_ROOTCA_KEY="${GG_CERTS_DIR}/root-ca.key" + GG_ROOTCA_PEM="${GG_CERTS_DIR}/root-ca.pem" + GG_ROOTCA_VERIF_KEY="${GG_CERTS_DIR}/root-ca-verif.key" + GG_ROOTCA_VERIF_CSR="${GG_CERTS_DIR}/root-ca-verif.csr" + GG_ROOTCA_VERIF_PEM="${GG_CERTS_DIR}/root-ca-verif.pem" + GG_CORE_KEY="${GG_CERTS_DIR}/gg-core.key" + GG_CORE_CSR="${GG_CERTS_DIR}/gg-core.csr" + GG_CORE_PEM="${GG_CERTS_DIR}/gg-core.pem" + + # Verify that no certificate artifact exists in the certs directory + if [ -f "${GG_ROOTCA_KEY}" ] || \ + [ -f "${GG_ROOTCA_PEM}" ] || \ + [ -f "${GG_ROOTCA_PEM}" ] || \ + [ -f "${GG_ROOTCA_VERIF_KEY}" ] || \ + [ -f "${GG_ROOTCA_VERIF_CSR}" ] || \ + [ -f "${GG_ROOTCA_VERIF_PEM}" ] || \ + [ -f "${GG_CORE_KEY}" ] || \ + [ -f "${GG_CORE_CSR}" ] || \ + [ -f "${GG_CORE_PEM}" ]; then + error "[ERROR] Certificates directory contains artifacts from previous execution" + fi + + mkdir -p "${GG_CERTS_DIR}" + + # Get AWS root CA certificate + printf "[INFO] Downloading AWS root CA certificate.\n" + AWS_ROOT_CA_URL="https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem" + [ -f "${GG_CERTS_DIR}/aws-root-ca.pem" ] || wget -t 2 -T 30 -q --passive-ftp --no-check-certificate -O "${GG_CERTS_DIR}/aws-root-ca.pem" "${AWS_ROOT_CA_URL}" + + # + # Create a self-signed CA certificate (if it doesn't exit) + # + printf "[INFO] Creating Greengrass Core CA certificate and key.\n" + GG_ROOTCA_SUBJ="/C=US/ST=Minnesota/L=Minnetonka/O=Digi International Inc./OU=Digi Enginnering/CN=AWS IoT CA Certificate" + openssl genrsa -out "${GG_ROOTCA_KEY}" 2048 2>/dev/null + openssl req -x509 -new -nodes -key "${GG_ROOTCA_KEY}" -sha256 -days 1024 -out "${GG_ROOTCA_PEM}" -subj "${GG_ROOTCA_SUBJ}" + + # + # Create verification certificate (needed to register the CA certificate) + # + printf "[INFO] Creating verification certificate.\n" + if ! REG_CODE="$(aws iot get-registration-code --query registrationCode 2>/dev/null)"; then + error "[ERROR] Unable to get registration code" + fi + GG_ROOTCA_VERIF_SUBJ="/C=US/ST=Minnesota/L=Minnetonka/O=Digi International Inc./OU=Digi Enginnering/CN=${REG_CODE}" + openssl genrsa -out "${GG_ROOTCA_VERIF_KEY}" 2048 2>/dev/null + openssl req -new -key "${GG_ROOTCA_VERIF_KEY}" -out "${GG_ROOTCA_VERIF_CSR}" -subj "${GG_ROOTCA_VERIF_SUBJ}" + openssl x509 -req -in "${GG_ROOTCA_VERIF_CSR}" -CA "${GG_ROOTCA_PEM}" -CAkey "${GG_ROOTCA_KEY}" -CAcreateserial -out "${GG_ROOTCA_VERIF_PEM}" -days 1024 -sha256 2>/dev/null + + # + # Create Greengrass Core device certificate + # + printf "[INFO] Creating Greengrass Core device certificate.\n" + GG_CORE_SUBJ="/C=US/ST=Minnesota/L=Minnetonka/O=Digi International Inc./OU=Digi Enginnering/CN=AWS IoT Device Certificate" + openssl genrsa -out "${GG_CORE_KEY}" 2048 2>/dev/null + openssl req -new -key "${GG_CORE_KEY}" -out "${GG_CORE_CSR}" -subj "${GG_CORE_SUBJ}" + openssl x509 -req -in "${GG_CORE_CSR}" -CA "${GG_ROOTCA_PEM}" -CAkey "${GG_ROOTCA_KEY}" -CAcreateserial -out "${GG_CORE_PEM}" -days 1024 -sha256 2>/dev/null +} + +do_register_thing() { + printf "[INFO] Registering Greengrass Core Thing.\n" + if ! AWS_GGCORE_THING_ARN="$(aws iot create-thing --thing-name ${GG_THING_NAME} --query thingArn 2>/dev/null)"; then + error "[ERROR] Unable to create Greengrass Core Thing" + fi +} + +# Use GNU 'getopt' to parse command line options +SHORT_OPTS="hc:t:" +LONG_OPTS="help,create-certs:,thing-name:" +CMDLINE_OPTS=$(getopt -o ${SHORT_OPTS} -l ${LONG_OPTS} -- "$@") || error "${USAGE}" + +eval set -- "${CMDLINE_OPTS}" + +while true; do + case "$1" in + -h|--help) printf "%s\n" "${USAGE}"; exit 0;; + -c|--create-certs) GG_CERTS_DIR="${2}"; shift;; + -t|--thing-name) GG_THING_NAME="${2}"; shift;; + --) shift; break;; + esac + shift +done + +# Sanity checks: AWS CLI needs to be installed and configured +if ! aws configure get aws_access_key_id >/dev/null 2>&1; then + error "[ERROR] AWS CLI needs to be installed and configured" +fi + +AWS_GGCORE_IOT_HOST="$(aws iot describe-endpoint 2>/dev/null)" + +[ -n "${GG_CERTS_DIR}" ] && do_create_certs +[ -n "${GG_THING_NAME}" ] && do_register_thing + +# Print AWS IoT configuration for DEY projects +cat <<-_EOF_ + + For Greengrass enabled images, add the following configuration to your project: + + AWS_IOT_CERTS_DIR = "${GG_CERTS_DIR:-}" + AWS_GGCORE_IOT_HOST = "${AWS_GGCORE_IOT_HOST:-}" + AWS_GGCORE_THING_ARN = "${AWS_GGCORE_THING_ARN:-}" + + Please verify variables' value is correct. + +_EOF_ diff --git a/sdk/config/ccimx6sbc/conf-notes.txt b/sdk/config/ccimx6sbc/conf-notes.txt index d8fa34f70..ed1cd5158 100644 --- a/sdk/config/ccimx6sbc/conf-notes.txt +++ b/sdk/config/ccimx6sbc/conf-notes.txt @@ -10,3 +10,9 @@ Digi Embedded Yocto provides the following image recipes: DISTRO_FEATURES_remove = "x11" + * dey-image-aws: console-only image supporting Amazon Web Services IoT + + This image includes the AWS Greengrass Core and an AWS IoT platform + example application. For more information on AWS support in Digi + Embedded Yocto see the online documentation. + diff --git a/sdk/config/ccimx6ulsbc/conf-notes.txt b/sdk/config/ccimx6ulsbc/conf-notes.txt index c6c1bf9fb..027ac1216 100644 --- a/sdk/config/ccimx6ulsbc/conf-notes.txt +++ b/sdk/config/ccimx6ulsbc/conf-notes.txt @@ -15,3 +15,9 @@ Digi Embedded Yocto provides the following image recipes: Expansion of native core-image-base by including all the support for the target device hardware like firmware files, rootfs customizations, etc. + * dey-image-aws: console-only image supporting Amazon Web Services IoT + + This image includes the AWS Greengrass Core and an AWS IoT platform + example application. For more information on AWS support in Digi + Embedded Yocto see the online documentation. + diff --git a/sdk/config/ccimx6ulstarter/conf-notes.txt b/sdk/config/ccimx6ulstarter/conf-notes.txt index 811825d35..a08fe9e99 100644 --- a/sdk/config/ccimx6ulstarter/conf-notes.txt +++ b/sdk/config/ccimx6ulstarter/conf-notes.txt @@ -5,3 +5,9 @@ Digi Embedded Yocto provides the following image recipes: Expansion of native core-image-base by including all the support for the target device hardware like firmware files, rootfs customizations, etc. + * dey-image-aws: console-only image supporting Amazon Web Services IoT + + This image includes the AWS Greengrass Core and an AWS IoT platform + example application. For more information on AWS support in Digi + Embedded Yocto see the online documentation. + diff --git a/sdk/mkproject.sh b/sdk/mkproject.sh index 325c247fb..576e7cc7d 100755 --- a/sdk/mkproject.sh +++ b/sdk/mkproject.sh @@ -35,8 +35,15 @@ MKP_SETUP_ENVIRONMENT='#!/bin/bash if [ "${BASH_SOURCE}" = "${0}" ]; then printf "\\n[ERROR]: This script needs to be sourced\\n\\n" else + DEY_INSTALLDIR="%s" cd $(dirname ${BASH_SOURCE}) - . %s/sources/poky/oe-init-build-env . + . ${DEY_INSTALLDIR}/sources/poky/oe-init-build-env . + + # Add our own scripts directory to the PATH + PATH="$(echo $PATH | sed -e "s,:\?${DEY_INSTALLDIR}/sources/meta-digi/scripts,,g;s,^:,,g")" + export PATH="${DEY_INSTALLDIR}/sources/meta-digi/scripts:$PATH" + + unset DEY_INSTALLDIR fi ' @@ -123,6 +130,10 @@ do_mkproject() { source ${MKP_SCRIPTPATH}/sources/poky/oe-init-build-env . unset TEMPLATECONF + # Add our own scripts directory to the PATH + PATH="$(echo $PATH | sed -e "s,:\?${MKP_SCRIPTPATH}/sources/meta-digi/scripts,,g;s,^:,,g")" + export PATH="${MKP_SCRIPTPATH}/sources/meta-digi/scripts:$PATH" + # New project if [ -z "${MKP_OLD_PROJECT}" ]; then # Customize project