diff options
Diffstat (limited to 'recipes-core')
37 files changed, 1102 insertions, 14 deletions
diff --git a/recipes-core/annex-client/annex-client-from-src.bb b/recipes-core/annex-client/annex-client-from-src.bb new file mode 100644 index 0000000..3534f23 --- /dev/null +++ b/recipes-core/annex-client/annex-client-from-src.bb @@ -0,0 +1,28 @@ +DESCRIPTION = "Provides the Multi-Tech MDM client" +SECTION = "remote-management" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +PROVIDES = "annex-client-from-src" +DEPENDS = "jsoncpp curl protobuf cyrus-sasl protobuf-native annex-proto mts-io" + +# IMPORTANT: if you change PR, you'll also want to change the url in annex-client.bb +PR = "r1" +SRCREV = "b954c83e155f95ecd68c14a890f9455331e19878" + +SRC_URI = "git://git@${MTS_INTERNAL_GIT}/multitech/annex-client.git;protocol=ssh;branch=master" + +S = "${WORKDIR}/git" + +do_compile() { + echo "directory: `pwd`" + mkdir -p annex_pb + cp ${STAGING_DIR_NATIVE}/annex.proto annex_pb/ + make all CFLAGS+="-DMLINUX_BUILD" +} + +# IMPORTANT NOTE: +# this recipe is only used for the annex-client Jenkin's job to build IPK. +# annex-client.bb is used to install the binary in an image +do_install() { + oe_runmake install DESTDIR=${D} SUBDIRS="src" +} diff --git a/recipes-core/annex-client/annex-client.bb b/recipes-core/annex-client/annex-client.bb new file mode 100644 index 0000000..83dd602 --- /dev/null +++ b/recipes-core/annex-client/annex-client.bb @@ -0,0 +1,53 @@ +DESCRIPTION = "Provides the Multi-Tech MDM client" +SECTION = "remote-management" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +PROVIDES = "annex-client" + +# NOTE: annex-client binary is built with Jenkin's job using annex-client-from-src.bb +# To update this, manually copy ipk from Jenkin's job to .net/downloads/ +PR = "r3" +ANNEX_PR = "r1" +SRC_URI = "http://multitech.net/downloads/annex-client-from-src_1.0-${ANNEX_PR}.0_${TUNE_PKGARCH}.ipk \ + file://annex-client.init \ + file://monitor-annexcd \ + file://call_home \ + file://call_home.init \ + file://config.json.sample \ + file://push_api_mdm_connected \ + file://push_api_mdm_status \ +" + +SRC_URI[md5sum] = "e180f4e569fbba2f5b9d524b5a9e944e" +SRC_URI[sha256sum] = "1e93c65005c630cf211615dc143eb64f177591efcdbed6952142c7bac0e95988" + +#inherit update-rc.d +# +#INITSCRIPT_NAME = "annex-client" +#INITSCRIPT_PARAMS = "defaults 95 1" +S = "${WORKDIR}" + +DHQ_DIR="/opt/devicehq" + +do_install() { + install -d ${D}${sbindir} + install -m 755 sbin/annexcd ${D}${sbindir} + + install -d ${D}/etc/ssl/certs + install -m 644 etc/ssl/certs/rootCA.pem ${D}/etc/ssl/certs + + install -d ${D}${base_sbindir} + install -m 755 ${WORKDIR}/monitor-annexcd ${D}${base_sbindir} + install -m 755 ${WORKDIR}/call_home ${D}${base_sbindir} + install -m 755 ${WORKDIR}/push_api_mdm_connected ${D}${base_sbindir} + install -m 755 ${WORKDIR}/push_api_mdm_status ${D}${base_sbindir} + + install -d ${D}${sysconfdir}/init.d + install -m 755 ${WORKDIR}/annex-client.init ${D}${sysconfdir}/init.d/annex-client + install -m 755 ${WORKDIR}/call_home.init ${D}${sysconfdir}/init.d/call_home + + install -d ${D}${DHQ_DIR} + install -m 644 ${WORKDIR}/config.json.sample ${D}${DHQ_DIR} +} + +FILES_${PN} += "${DHQ_DIR}" diff --git a/recipes-core/annex-client/annex-client/annex-client.init b/recipes-core/annex-client/annex-client/annex-client.init new file mode 100644 index 0000000..4a5dc4b --- /dev/null +++ b/recipes-core/annex-client/annex-client/annex-client.init @@ -0,0 +1,43 @@ +#!/bin/bash + +MONITOR="/sbin/monitor-annexcd" +CLIENT="annexcd" + +start() { + if [[ $(pidof -x $MONITOR) ]]; then + echo "RM client is already running" + else + echo "Starting RM client" + $MONITOR & + fi +} + +stop() { + MONITOR_PID=$(pidof -x $MONITOR) + CLIENT_PID=$(pidof $CLIENT) + if [[ $MONITOR_PID ]]; then + echo "Stopping RM client" + kill $MONITOR_PID $CLIENT_PID + else + echo "RM client is not running" + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: /etc/init.d/annex-client {start|stop|restart}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-core/annex-client/annex-client/call_home b/recipes-core/annex-client/annex-client/call_home new file mode 100755 index 0000000..64887ec --- /dev/null +++ b/recipes-core/annex-client/annex-client/call_home @@ -0,0 +1,192 @@ +#!/bin/bash +#Attempt to gain a WAN connection for MDM Registration to query for this device's MDM account ID +#PREREQ: Firewall allows outgoing DHCP requests and MDM Client connection + +CONFIG_FILE="/var/config/devicehq/config.json" +STATUS_FILE="/var/config/devicehq/status.json" + +if [ ! -f $CONFIG_FILE ]; then + logger -t callhome "Config file missing!" + logger -t callhome "Do: mkdir /var/config/devicehq" + logger -t callhome "Then: cp /opt/devicehq/config.json.sample /var/config/devicehq/config.json" + exit 1 +fi + +JSON=$(cat $CONFIG_FILE) +ENABLED=$( echo $JSON | jsparser -p /enabled ) +KEY=$( echo $JSON | jsparser -p /accountKey ) +MDM_URL=$( echo $JSON | jsparser -p /deviceHqUrl ) + +if [ "$ENABLED" != "true" ]; then + logger -t callhome "Not calling home because DeviceHQ is disabled in /var/config/devicehq/config..json." + exit 1 +fi + +UUID=$(mts-io-sysfs show uuid) +DEVID=$(mts-io-sysfs show device-id) + + +MDM_REG_URL="$MDM_URL/api/v1/register-device" +TMPFILE="/var/run/callhome" +DONE=false +FORCE=false +WAN_AVAILABLE=true +MAX_ATTEMPTS=0 #Infinite +INTERVAL_SECONDS=30 + +#Gather options from command line +# Reset in case getopts has been used previously in the shell. +OPTIND=1 + +function show_help() { + echo "Usage: $0 -k <ACCOUNT KEY> -a <MAX ATTEMPTS> -i <INTERVAL SECONDS>" +} + +while getopts "h?k:a:i:d:u:m:f" opt; do + case "$opt" in + h|\?) + show_help + exit 0 + ;; + k) KEY=$OPTARG + ;; + a) MAX_ATTEMPTS=$OPTARG + ;; + a) INTERVAL_SECONDS=$OPTARG + ;; + f) FORCE=true + ;; + d) DEVID=$OPTARG + ;; + u) UUID=$OPTARG + ;; + m) MDM_URL=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +if [ "$FORCE" == "true" ]; then + DONE=false +fi + + +function checkCallHomeNeeded() { + if [ "$FORCE" != "true" ]; then + JSON=$(cat $CONFIG_FILE) + KEY=$( echo $JSON | jsparser -p /accountKey ) + + LAST_CONNECTED="unknown" + STATUS="" + if [ -f $STATUS_FILE ]; then + JSON=$(cat $STATUS_FILE) + LAST_CONNECTED=$( echo $JSON | jsparser -p /lastConnected ) + STATUS=$( echo $JSON | jsparser -p /status ) + fi + + if [ "$KEY" != "" ] && [ $LAST_CONNECTED != "unknown" ] && [ $STATUS == "idle" ]; then + echo "Found that Call-Home Not Needed" + exit 0 + fi + fi +} + +function saveConfigs() { + logger -t callhome "Saving accountKey" + + sed -i "s/\"accountKey\"\s*:\s*\".*\"/\"accountKey\": \"$KEY\"/" $CONFIG_FILE + + if [ $? != 0 ]; then + logger -t callhome "Failed to add account key [$KEY] to $CONFIG_FILE" + fi +} + +function checkForCheckIn() { + + i=0 + while [ $i -lt 10 ]; do + if [ -f $STATUS_FILE ]; then + JSON=$(cat $STATUS_FILE) + LAST_CONNECTED=$( echo $JSON | jsparser -p /lastConnected ) + STATUS=$( echo $JSON | jsparser -p /status ) + if [ "$LAST_CONNECTED" == "unknown" ] || [ $STATUS != "idle" ]; then + logger -t callhome "MDM client has not checked-in yet" + else + logger -t callhome "SUCCESS! MDM Client has checked-in." + DONE=true + return + fi + else + logger -t callhome "MDM client has not checked-in yet" + fi + + let i=i+1 + logger -t callhome "Sleeping for 30 seconds." + sleep 30 + done + +} + +function attemptMdmRegistration() { + + logger -t callhome "Attempting to register with MDM" + CODE=$( curl -m 20 -ks -o $TMPFILE -w "%{http_code}" -X POST -H "Content-Type: application/json" \ + -d '{ "device_id" : "'$DEVID'", "uuid" : "'$UUID'" }' \ + $MDM_REG_URL ) + + if [ $? == 0 ]; then + if [ "$CODE" == "200" ]; then + logger -t callhome "Registered with MDM. Checking for Account Key" + + #Request returned 200 + KEY=$( cat $TMPFILE | jsparser -p /account_key ) + if [ $? == 0 ]; then + if [ "$KEY" != "" ]; then + logger -t callhome "Received Account Key! [$KEY]" + saveConfigs + /etc/init.d/annex-client start + checkForCheckIn + else + logger -t callhome "Account Key not returned. This device may not be registered with a user account" + fi + else + RESULT=$(cat $TMPFILE) + logger -t callhome "Error: Unexpected MDM Registration Server response: $RESULT" + fi + else + RESULT=$(cat $TMPFILE) + logger -t callhome "Error: MDM Registration Failed with Device ID [$DEVID] and UUID [$UUID]" + logger -t callhome "Error: MDM Registration Server Response Header Code: $CODE" + logger -t callhome "Error: MDM Registration Server Response Body Content: $RESULT" + fi + else + logger -t callhome "Warning: Could not connect to MDM server: $MDM_REG_URL" + fi +} + +logger -t callhome "Setting Up Call-Home " +COUNT=0 + +while [ $DONE == false ]; do + logger -t callhome "Attempts: $COUNT" + + checkCallHomeNeeded + + attemptMdmRegistration + + COUNT=$(($COUNT+1)) + if [ $MAX_ATTEMPTS != 0 ] && [ $COUNT -gt $MAX_ATTEMPTS ]; then + DONE=true + logger -t callhome "Reached Maximum Attempts [$MAX_ATTEMPTS]" + fi + + if [ $DONE == false ]; then + logger -t callhome "Sleeping for $INTERVAL_SECONDS seconds before next attempt" + sleep $INTERVAL_SECONDS + fi + +done + diff --git a/recipes-core/annex-client/annex-client/call_home.init b/recipes-core/annex-client/annex-client/call_home.init new file mode 100755 index 0000000..b874565 --- /dev/null +++ b/recipes-core/annex-client/annex-client/call_home.init @@ -0,0 +1,40 @@ +#!/bin/bash +CALLHOME="/sbin/call_home" + +start() { + if [[ $(pidof $CALLHOME) ]]; then + echo "Call-Home Service is already running" + else + echo "Starting Call-Home Service" + $CALLHOME & + fi +} + +stop() { + CALLHOME_PID=$(pidof -x $CALLHOME) + if [[ $CALLHOME_PID ]]; then + echo "Stopping Call-Home Service" + kill $CALLHOME_PID + else + echo "Call-Home Service is not running" + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: /etc/init.d/call_home {start|stop|restart}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-core/annex-client/annex-client/config.json.sample b/recipes-core/annex-client/annex-client/config.json.sample new file mode 100644 index 0000000..5e83c64 --- /dev/null +++ b/recipes-core/annex-client/annex-client/config.json.sample @@ -0,0 +1,10 @@ +{ + "enabled": true, + "accountKey": "", + "deviceHqUrl": "https://www.devicehq.com", + "deviceServerUrl": "ds.devicehq.com", + "checkInIntervalMins": 720, + "gpsDataIntervalMins": 720, + "allowFirmwareUpgrade": true, + "allowConfigUpgrade": false +} diff --git a/recipes-core/annex-client/annex-client/monitor-annexcd b/recipes-core/annex-client/annex-client/monitor-annexcd new file mode 100755 index 0000000..21d5a6b --- /dev/null +++ b/recipes-core/annex-client/annex-client/monitor-annexcd @@ -0,0 +1,46 @@ +#!/bin/bash + +CONFIG_FILE="/var/config/devicehq/config.json" + +if [ ! -f $CONFIG_FILE ]; then + logger -t monitor-annexcd "Config file missing!" + logger -t monitor-annexcd "Do: mkdir /var/config/devicehq" + logger -t monitor-annexcd "Then: cp /opt/devicehq/config.json.sample /var/config/devicehq/config.json" + logger -t monitor-annexcd "Exiting..." + exit 1 +fi + +DEVICE_ID=$(mts-io-sysfs show device-id) +PRODUCT_ID=$(mts-io-sysfs show product-id) + +get_args() { + JSON=$(cat $CONFIG_FILE) + + ENABLED=$( echo $JSON | jsparser -p enabled ) + KEY=$( echo $JSON | jsparser -p accountKey ) + SERVER=$( echo $JSON | jsparser -p deviceServerUrl ) + PORT=5798 + QUERY_INT=$( echo $JSON | jsparser -p checkInIntervalMins ) + GPS_INT=$( echo $JSON | jsparser -p gpsDataIntervalMins ) + FW_UPGRADE=$( echo $JSON | jsparser -p allowFirmwareUpgrade ) + CONFIG_UPGRADE=$(echo $JSON | jsparser -p allowConfigUpgrade ) +} + + +get_args + +if [ "$KEY" == "" ]; then + logger -t monitor-annexcd "Account key missing in $CONFIG_FILE" + logger -t monitor-annexcd "Exiting..." + exit 1 +fi + +MIN_TO_MS=60000 + +if [[ $ENABLED == "true" ]]; then + ANNEXCD="annexcd --account-key $KEY --host $SERVER --port $PORT --product-id $PRODUCT_ID --device-id $DEVICE_ID --rpd-interval $(( $QUERY_INT * $MIN_TO_MS )) --gps-interval $(( $GPS_INT * $MIN_TO_MS )) --net-interval $(( $QUERY_INT * $MIN_TO_MS )) --cell-interval $(( $QUERY_INT * $MIN_TO_MS )) --active-apps-interval $(( $QUERY_INT * $MIN_TO_MS )) --lora-interval $(( $QUERY_INT * $MIN_TO_MS )) --when-ppp-up on --firmware-upgrade $FW_UPGRADE --config-upgrade $CONFIG_UPGRADE --ssl-method ssl --ssl-ca-certificate /etc/ssl/certs/rootCA.pem --ssl-ca-strict --log-upto 7" + until $ANNEXCD; do + echo "annexcd exited with status $? - restarting..." >&2 + sleep 1 + done +fi diff --git a/recipes-core/annex-client/annex-client/push_api_mdm_connected b/recipes-core/annex-client/annex-client/push_api_mdm_connected new file mode 100755 index 0000000..ec8a23d --- /dev/null +++ b/recipes-core/annex-client/annex-client/push_api_mdm_connected @@ -0,0 +1,59 @@ +#!/bin/bash +# This script pushes the current time to the API's remote management +# to track last connected time + +STATUS_FILE="/var/config/devicehq/status.json" +DHQ_DIR="/var/config/devicehq" + +LAST_CONNECTED=$(date +%m/%d/%Y/%H:%M:%S) +INTERVAL="" + +# Reset in case getopts has been used previously in the shell. +OPTIND=1 + +function show_help() { + echo "Usage: $0 -t <TIME OF CONNECTION> -i <INTERVAL SECONDS>" +} + +while getopts "h?t:i:" opt; do + case "$opt" in + h|\?) + show_help + exit 0 + ;; + t) LAST_CONNECTED=$OPTARG + ;; + i) INTERVAL=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) +[ "$1" = "--" ] && shift + +if [ ! -f $STATUS_FILE ]; then + mkdir -p $DHQ_DIR + echo "{ + \"status\": \"unknown\", + \"lastConnected\": \"unknown\", + \"intervalSeconds\": \"10\" +}" > $STATUS_FILE +fi + + +sed -i "s~\"lastConnected\"\s*:\s*\".*\"~\"lastConnected\": \"$LAST_CONNECTED\"~" $STATUS_FILE + +if [ $? != 0 ]; then + logger -t push_api_mdm_connected "Failed to save lastConnected [$LAST_CONNECTED] to $STATUS_FILE" +fi + + +if [ "$INTERVAL" != "" ]; then + sed -i "s/\"intervalSeconds\"\s*:\s*\".*\"/\"intervalSeconds\": \"$INTERVAL\"/" $STATUS_FILE + + if [ $? != 0 ]; then + logger -t push_api_mdm_connected "Failed to save intervalSeconds [$INTERVAL] to $STATUS_FILE" + fi +fi + + diff --git a/recipes-core/annex-client/annex-client/push_api_mdm_status b/recipes-core/annex-client/annex-client/push_api_mdm_status new file mode 100755 index 0000000..cf91eda --- /dev/null +++ b/recipes-core/annex-client/annex-client/push_api_mdm_status @@ -0,0 +1,30 @@ +#!/bin/bash +# This script pushes the current time to the API's remote management +# to track last connected time + +STATUS_FILE="/var/config/devicehq/status.json" +DHQ_DIR="/var/config/devicehq" + +STATUS="$1" + +if [ "$STATUS" == "" ]; then + STATUS="HEARTBEAT: $(date)" +fi + +if [ ! -f $STATUS_FILE ]; then + mkdir -p $DHQ_DIR + echo "{ + \"status\": \"unknown\", + \"lastConnected\": \"unknown\", + \"intervalSeconds\": \"10\" +}" > $STATUS_FILE +fi + +sed -i "s~\"status\"\s*:\s*\".*\"~\"status\": \"$STATUS\"~" $STATUS_FILE + +if [ $? != 0 ]; then + logger -t push_api_mdm_status "Failed to save status [$STATUS] to $STATUS_FILE" +fi + + + diff --git a/recipes-core/annex-proto/annex-proto.bb b/recipes-core/annex-proto/annex-proto.bb new file mode 100644 index 0000000..cbb6fb2 --- /dev/null +++ b/recipes-core/annex-proto/annex-proto.bb @@ -0,0 +1,24 @@ +DESCRIPTION = "Provides the Multi-Tech MDM client protobuffer definitions" +SECTION = "remote-management" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +PR = "r20" +PROVIDES = "annex_proto" +DEPENDS = "protobuf" +SRCREV = "7ad3f17a59d3fe564da099518310d61ad1304913" + +SRC_URI = "git://git@${MTS_INTERNAL_GIT}/annex/proto.git;protocol=ssh;branch=master \ +" +S = "${WORKDIR}/git" + +# don't use cli here +do_compile() { + echo "directory: `pwd`" +} + +do_install() { + install annex.proto ${STAGING_DIR_NATIVE} +} + + + diff --git a/recipes-core/base-files/base-files/mtcap/fstab b/recipes-core/base-files/base-files/mtcap/fstab new file mode 100644 index 0000000..01b5f38 --- /dev/null +++ b/recipes-core/base-files/base-files/mtcap/fstab @@ -0,0 +1,9 @@ +rootfs / auto defaults 1 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,gid=5 0 0 +usbdevfs /proc/bus/usb usbdevfs noauto 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs defaults 0 0 + +/dev/mtdblock6 /var/config jffs2 defaults 0 0 +/dev/mtdblock7 /var/oem jffs2 defaults,ro 0 0 diff --git a/recipes-core/base-files/base-files_3.0.14.bbappend b/recipes-core/base-files/base-files_3.0.14.bbappend index 461f869..0f0ae4f 100644 --- a/recipes-core/base-files/base-files_3.0.14.bbappend +++ b/recipes-core/base-files/base-files_3.0.14.bbappend @@ -1,4 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}" +media_card="/media/card" +media_card_mtcap="" + # add SD card dir -dirs755_append = " /media/card" +dirs755_append = " ${media_card}" diff --git a/recipes-core/busybox/busybox-1.22.1/defconfig b/recipes-core/busybox/busybox-1.22.1/defconfig index 0387a9d..aa1e514 100644 --- a/recipes-core/busybox/busybox-1.22.1/defconfig +++ b/recipes-core/busybox/busybox-1.22.1/defconfig @@ -570,8 +570,8 @@ CONFIG_HEXDUMP=y CONFIG_HWCLOCK=y CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y -# CONFIG_IPCRM is not set -# CONFIG_IPCS is not set +CONFIG_IPCRM=y +CONFIG_IPCS=y CONFIG_LOSETUP=y # CONFIG_LSPCI is not set # CONFIG_LSUSB is not set diff --git a/recipes-core/images/mlinux-base-image.bb b/recipes-core/images/mlinux-base-image.bb index b90903a..a0c460d 100644 --- a/recipes-core/images/mlinux-base-image.bb +++ b/recipes-core/images/mlinux-base-image.bb @@ -1,3 +1,4 @@ +# Conduit 0.0 or 0.1 without RS9113 DESCRIPTION = "mLinux base image" LICENSE = "MIT" @@ -25,7 +26,7 @@ WIFI_FEATURES = " \ wpa-supplicant \ wireless-tools \ iw \ - hostap-daemon hostap-utils \ + hostap-daemon hostap-utils \ " BLUETOOTH_FEATURES = "bluez4" diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index 38c8bc9..c50619b 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -1,4 +1,6 @@ +# Conduit 0.0 or 0.1 without RS9113 require mlinux-base-image.bb +DESCRIPTION = "mLinux factory image" LIGHTTPD = "lighttpd \ lighttpd-module-cgi lighttpd-module-indexfile \ @@ -20,7 +22,7 @@ IMAGE_INSTALL += "autossh" IMAGE_INSTALL += "monit" # LoRa support (MTAC-LORA accessory card) -IMAGE_INSTALL += "lora-network-server lora-query" +IMAGE_INSTALL += "lora-gateway-utils lora-network-server lora-query lora-packet-forwarder-usb" # MQTT server IMAGE_INSTALL += "mosquitto mosquitto-clients" @@ -78,6 +80,9 @@ IMAGE_INSTALL += "nodejs nodejs-npm" IMAGE_INSTALL += "sms-utils" # Multi-Tech GPS Utility IMAGE_INSTALL += "venus-gps" +IMAGE_INSTALL += "pps-tools" -IMAGE_INSTALL += "uvccapture" +# When ntp is to use the GPS, gps-utils is required +IMAGE_INSTALL += "gpsd ntp ntp-utils gps-utils gpsd-udev" +IMAGE_INSTALL += "uvccapture" diff --git a/recipes-core/images/mlinux-mtcap-debug-image.bb b/recipes-core/images/mlinux-mtcap-debug-image.bb new file mode 100644 index 0000000..48009ae --- /dev/null +++ b/recipes-core/images/mlinux-mtcap-debug-image.bb @@ -0,0 +1,13 @@ +DESCRIPTION = "mLinux Conduit Access Point debug image" + +require mlinux-mtcap-image.bb + +# Extra stuff to install +IMAGE_INSTALL += "lora-network-server-mtcap \ + lora-gateway-utils \ + lora-query \ + mosquitto mosquitto-clients \ + nodejs \ + nodejs-npm \ + " + diff --git a/recipes-core/images/mlinux-mtcap-image.bb b/recipes-core/images/mlinux-mtcap-image.bb new file mode 100644 index 0000000..c559023 --- /dev/null +++ b/recipes-core/images/mlinux-mtcap-image.bb @@ -0,0 +1,66 @@ +DESCRIPTION = "mLinux Conduit Access Point image" + +require mlinux-minimal-image.bb + +FILESYSTEM_FEATURES = "dosfstools \ + cifs-utils \ + lsof \ + " + +NETWORKING_FEATURES += "bridge-utils \ + inetutils-ftp \ + openssl \ + rsync \ + iperf \ + mii-diag \ + tcpdump \ + netcat \ + wget \ + strongswan \ + " + +TIME_FEATURES = "tzdata tzdata-africa tzdata-americas tzdata-antarctica tzdata-arctic \ + tzdata-asia tzdata-atlantic tzdata-australia tzdata-europe tzdata-pacific \ + tzdata-misc \ + cronie \ + ntpdate \ + " + +WIFI_FEATURES = "libnl \ + wpa-supplicant \ + wireless-tools \ + iw \ + hostap-daemon hostap-utils \ + wilc1000 \ + " + +MULTITECH_FEATURES += " \ + u-boot-linux-utils \ + mlinux-scripts \ + reset-handler \ + radio-cmd radio-query \ + jsparser \ + protobuf \ + annex-client \ + " + +IMAGE_INSTALL += "lora-network-server \ + lora-gateway-utils \ + lora-query \ + mosquitto mosquitto-clients \ + " + +MISC_FEATURES = "minicom lrzsz nano" + +# Extra stuff to install +# Someday add wifi features +# ${WIFI_FEATURES} +# +IMAGE_INSTALL += " \ + ${FILESYSTEM_FEATURES} \ + ${TIME_FEATURES} \ + ${MISC_FEATURES} \ + " + +# Multi-Tech SMS Utility (see http://git.multitech.net) +IMAGE_INSTALL += "sms-utils" diff --git a/recipes-core/images/mlinux-rs9113-base-image.bb b/recipes-core/images/mlinux-rs9113-base-image.bb new file mode 100644 index 0000000..8aab186 --- /dev/null +++ b/recipes-core/images/mlinux-rs9113-base-image.bb @@ -0,0 +1,5 @@ +require mlinux-base-image.bb +DESCRIPTION = "mLinux base image with rs9113 drivers" + +# Extra stuff to install +IMAGE_INSTALL += " rs9113 " diff --git a/recipes-core/images/mlinux-rs9113-factory-image.bb b/recipes-core/images/mlinux-rs9113-factory-image.bb new file mode 100644 index 0000000..3fe2ca6 --- /dev/null +++ b/recipes-core/images/mlinux-rs9113-factory-image.bb @@ -0,0 +1,5 @@ +require mlinux-factory-image.bb +DESCRIPTION = "mLinux factory image with rs9113 drivers" + +# Extra stuff to install +IMAGE_INSTALL += " rs9113 " diff --git a/recipes-core/init-ifupdown/files/bonding.post-down b/recipes-core/init-ifupdown/files/bonding.post-down new file mode 100644 index 0000000..13ed4fd --- /dev/null +++ b/recipes-core/init-ifupdown/files/bonding.post-down @@ -0,0 +1,67 @@ +#!/bin/sh + +[ "$IF_VERBOSITY" = 1 ] && set -x + +sysfs() +{ + # Called with : + # $1 = value to write. Won't write if $1 is empty. + # $2 = basename of the file in bonding/ to write to. + if [ "$1" ] ; then + echo "$1" > "/sys/class/net/$IFACE/master/bonding/$2" + return $? + fi + return 0 +} + +sysfs_remove_all() +{ + # Called with: + # $1 = target filename + read values < "/sys/class/net/$IFACE/bonding/$1" + for value in $values ; do + echo "-$value" > "/sys/class/net/$IFACE/bonding/$1" + done +} + +BOND_PARAMS="/sys/class/net/$IFACE/bonding" +IFSTATE=/var/run/ifstate + +# free $IFACE if it is currently enslaved to a bonding device. +if [ -f "/sys/class/net/$IFACE/master/bonding/slaves" ] ; then + echo "-$IFACE" > "/sys/class/net/$IFACE/master/bonding/slaves" + + # The first slave in bond-primary found in current slaves becomes the primary. + # If no slave in bond-primary is found, then primary does not change and might be undefined if just removed. + for slave in $IF_BOND_PRIMARY ; do + if grep -sq "\\<$slave\\>" "/sys/class/net/$IFACE/master/bonding/slaves" ; then + sysfs "$slave" primary + break + fi + done +fi + +# If $IFACE is not a master, exit. +[ ! -f "$BOND_PARAMS/slaves" ] && exit + +# Unset multivalue sysfs entries, so that re-enabling the interface later won't cause error. + +sysfs_remove_all arp_ip_target + +# Remove any slaves of $IFACE. + +[ "$IF_VERBOSITY" = 1 ] && v=-v +read slaves < "$BOND_PARAMS/slaves" +for slave in $slaves ; do + # If $slave is currently up in $IFSTATE, then bring it down, to keep $IFSTATE consistent. + # This is supposed to have the side effect of freeing the interface. + grep -q "^$slave=" $IFSTATE && ifdown $v $slave + + # Anyway, ensure $slave is free. + if [ -f "/sys/class/net/$slave/master/bonding/slaves" ] ; then + echo "-$slave" > "$BOND_PARAMS/slaves" 2> /dev/null + fi +done + +# make sure that the link is set to down +ip link set dev $IFACE down diff --git a/recipes-core/init-ifupdown/files/bonding.pre-up b/recipes-core/init-ifupdown/files/bonding.pre-up new file mode 100644 index 0000000..39011b6 --- /dev/null +++ b/recipes-core/init-ifupdown/files/bonding.pre-up @@ -0,0 +1,144 @@ +#!/bin/sh + +[ "$IF_VERBOSITY" = 1 ] && set -x + +IFSTATE=/var/run/ifstate + +add_master() +{ + # Return if $BOND_MASTER is already a bonding interface. + [ -f "/sys/class/net/$BOND_MASTER/bonding/slaves" ] && return + + # If the bonding module is not yet loaded, load it. + if [ ! -r /sys/class/net/bonding_masters ]; then + modprobe -q bonding + fi + + # Create the master interface. + if ! grep -sq "\\<$BOND_MASTER\\>" /sys/class/net/bonding_masters; then + echo "+$BOND_MASTER" > /sys/class/net/bonding_masters + fi +} + +sysfs() +{ + # Called with : + # $1 = value to write. Won't write if $1 is empty. + # $2 = basename of the file in bonding/ to write to. + if [ "$1" ] ; then + echo "$1" > "/sys/class/net/$BOND_MASTER/bonding/$2" + return $? + fi + return 0 +} + +sysfs_add() +{ + # Called with : + # $1 = values to write. + # $2 = target filename. + for value in $1; do + # Do not add $1 to $2 if already present. + if ! grep -sq "\\<$value\\>" /sys/class/net/$BOND_MASTER/bonding/$2 + then + sysfs "+$value" "$2" + fi + done +} + +ifup_once() +{ + local v= + [ "$IF_VERBOSITY" = 1 ] && v=-v + if [ "$1" != "$IFACE" ] && ! grep -q "^$1=" $IFSTATE && ifup -n "$1" >/dev/null 2>&1; then + ifup $v $1 + fi +} + +enslave_slaves() +{ + case "$BOND_SLAVES" in + none) + BOND_SLAVES="" + ;; + all) + BOND_SLAVES=`sed -ne 's/ *\(eth[^:]*\):.*/\1/p' /proc/net/dev` + AUTOIF="yes" + ;; + esac + + for slave in $BOND_SLAVES ; do + if ( [ "$AUTOIF" ] && grep -q "^$slave=" $IFSTATE ) ; then + echo "Not enslaving interface $slave since it is already configured" + else + # Ensure $slave is down. + ip link set "$slave" down 2>/dev/null + if ! sysfs_add "$slave" slaves 2>/dev/null ; then + echo "Failed to enslave $slave to $BOND_MASTER. Is $BOND_MASTER ready and a bonding interface ?" >&2 + else + # Bring up slave if it is defined in interfaces + # This is usefull to bring up slaves that need extra setup. + ifup_once $slave + fi + fi + done +} + +setup_master() +{ + sysfs "$IF_BOND_MODE" mode + sysfs "$IF_BOND_MIIMON" miimon + sysfs "$IF_BOND_USE_CARRIER" use_carrier + sysfs "$IF_BOND_UPDELAY" updelay + sysfs "$IF_BOND_DOWNDELAY" downdelay + sysfs "$IF_BOND_ARP_INTERVAL" arp_interval + sysfs "$IF_BOND_ARP_VALIDATE" arp_validate + sysfs "$IF_BOND_FAIL_OVER_MAC" fail_over_mac + sysfs "$IF_BOND_XMIT_HASH_POLICY" xmit_hash_policy + sysfs "$IF_BOND_LACP_RATE" lacp_rate + sysfs_add "$IF_BOND_ARP_IP_TARGET" arp_ip_target +} + +setup_slaves() +{ + # The first slave in bond-primary found in current slaves becomes the primary. + # If no slave in bond-primary is found, then primary does not change. + for slave in $IF_BOND_PRIMARY ; do + if grep -sq "\\<$slave\\>" "/sys/class/net/$BOND_MASTER/bonding/slaves" ; then + sysfs "$slave" primary + break + fi + done + + if [ "$IF_BOND_ACTIVE_SLAVE" ] ; then + # Need to force interface up before. Bonding will refuse to activate a down interface. + ip link set "$IF_BOND_ACTIVE_SLAVE" up + sysfs "$IF_BOND_ACTIVE_SLAVE" active_slave + fi +} + +# Are there anything to do ? + +# Option slaves deprecated, replaced by bond-slaves, but still supported for backward compatibility. +IF_BOND_SLAVES=${IF_BOND_SLAVES:-$IF_SLAVES} + +if [ "$IF_BOND_MASTER" ] ; then + BOND_MASTER="$IF_BOND_MASTER" + BOND_SLAVES="$IFACE" + if ! [ -e /sys/class/net/$IFACE/master ]; then + ifup_once $BOND_MASTER + fi +else + if [ "$IF_BOND_SLAVES$IF_BOND_MODE" ]; then + BOND_MASTER="$IFACE" + BOND_SLAVES="$IF_BOND_SLAVES" + fi +fi + +# Exit if nothing to do... +[ -z "$BOND_MASTER$BOND_SLAVES" ] && exit + +add_master +setup_master +enslave_slaves +setup_slaves diff --git a/recipes-core/init-ifupdown/files/bonding.up b/recipes-core/init-ifupdown/files/bonding.up new file mode 100644 index 0000000..f10152c --- /dev/null +++ b/recipes-core/init-ifupdown/files/bonding.up @@ -0,0 +1,45 @@ +#!/bin/sh + +[ "$IF_VERBOSITY" = 1 ] && set -x + +sysfs() +{ + # Called with : + # $1 = value to write. Won't write if $1 is empty. + # $2 = basename of the file in bonding/ to write to. + if [ "$1" ] ; then + echo "$1" > "/sys/class/net/$IFACE/master/bonding/$2" + return $? + fi + return 0 +} + +# If the stanza bond-give-a-chance is set for a slave interface, +# then force $IFACE to be the primary for some time, then restore primary to it previous value. + +# This stanza is designed to workaround a bug in wpa_supplicant, when used with bonding : + +# wpa_supplicant expect wifi authentication packets on the bond interface, but also send wifi authentication packets on the bond interface. +# If the active interface is not the wifi interface at the time wpa_supplicant try to authenticate, the wifi AP won't receive anything, causing the authentication to fail. + +# In order for the wifi authentication to succeed, one need to give a chance to the wifi interface to send authentication packets. +# "bond-give-a-chance 10" will set the wifi interface as the primary interface for 10 seconds, then restore the previous primary interface. +# This is supposed to be enought to give a chance to wifi to authenticate properly. + +if [ "$IF_BOND_GIVE_A_CHANCE" ] ; then + read primary < "/sys/class/net/$IFACE/master/bonding/primary" + # Set the temporary primary. + sysfs "$IFACE" primary + + # Wait for the link to be setup, but not longer that $IF_BOND_GIVE_A_CHANGE seconds. + while [ "$IF_BOND_GIVE_A_CHANCE" -gt 0 ] ; do + if ip link show $IFACE | grep -sq 'state UP'; then + break + fi + sleep 1 + IF_BOND_GIVE_A_CHANCE=`expr $IF_BOND_GIVE_A_CHANCE - 1` + done + + # Restore the previous primary. + sysfs "$primary" primary +fi diff --git a/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend b/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend new file mode 100644 index 0000000..5249571 --- /dev/null +++ b/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend @@ -0,0 +1,14 @@ +PR = "r8" + +SRC_URI += "file://bonding.pre-up \ + file://bonding.up \ + file://bonding.post-down" + +FILESEXTRAPATHS_prepend := "${THISDIR}/files" + +do_install_append () { + echo JAK workdir ${WORKDIR} sysconfdir ${D}${sysconfdir} + install -m 0755 ${WORKDIR}/bonding.pre-up ${D}${sysconfdir}/network/if-pre-up.d/bonding + install -m 0755 ${WORKDIR}/bonding.up ${D}${sysconfdir}/network/if-up.d/bonding + install -m 0755 ${WORKDIR}/bonding.post-down ${D}${sysconfdir}/network/if-post-down.d/bonding +} diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc b/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc index fd75904..979fc4c 100644 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc @@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda SRC_URI = "file://mlinux-wifi-ap \ file://mlinux-dhcpd \ file://mlinux-set-apn \ - file://mlinux-cell-router" + file://mlinux-cell-router \ + file://mlinux-firmware-upgrade \ +" do_install() { @@ -15,4 +17,5 @@ do_install() { install -m 755 ${WORKDIR}/mlinux-dhcpd ${D}${sbindir} install -m 755 ${WORKDIR}/mlinux-set-apn ${D}${sbindir} install -m 755 ${WORKDIR}/mlinux-cell-router ${D}${sbindir} + install -m 755 ${WORKDIR}/mlinux-firmware-upgrade ${D}${sbindir} } diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade new file mode 100755 index 0000000..94027d5 --- /dev/null +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade @@ -0,0 +1,57 @@ +#!/bin/bash + +if [ $# != 1 ]; then + echo "Usage: $0 upgrade.bin" + exit 1 +fi + +set -e +upgrade=$1 + +mkdir -p /var/volatile +cd /var/volatile + +# make sure firmware is for this device +hw_version=$(cat /sys/devices/platform/mts-io/hw-version) +firmware_model=$(tar -xO -f $upgrade model) +shopt -s nocasematch +if [[ ! "$hw_version" =~ ^$firmware_model- ]]; then + logger -s -t firmware_upgrade "Wrong firmware for this hardware" + logger -s -t firmware_upgrade "hw version: $hw_version" + logger -s -t firmware_upgrade "firmware model: $firmware_model" + exit 1 +fi + +files=(bstrap.bin uboot.bin uImage.bin config.jffs2 oem.jffs2 rootfs.jffs2) + +tobeflashed=0 +# verify all MD5 sums +for (( i = 0; i < ${#files[@]}; i++ )); do + file=${files[i]} + # if the file is in the tar, md5sum it + if tar -t -f $upgrade | grep -F -q "$file"; then + logger -s -t firmware_upgrade "Checking MD5 for $file..." + if ! tar -x -f $upgrade $file.md5; then + logger -s -t firmware_upgrade "MD5 is not found for the $file, upgrade aborted" + exit 1 + fi + if ! tar -xO -f $upgrade $file | md5sum -c $file.md5; then + logger -s -t firmware_upgrade "MD5 check failed, upgrade aborted" + exit 1 + fi + tobeflashed=1 + fi +done + +if (( $tobeflashed )); then + mkdir -p /var/volatile/flash-upgrade + mv -f $upgrade /var/volatile/flash-upgrade/upgrade.bin + touch /var/volatile/do_flash_upgrade + logger -s -t firmware_upgrade "Rebooting" + sleep 1 + reboot + exit 0 +else + logger -s -t firmware_upgrade "Nothing to be flashed!" + exit 1 +fi diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-set-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-set-apn index 65e01b8..85839f8 100755 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-set-apn +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-set-apn @@ -28,15 +28,17 @@ fi apn=$1 gsm_chat_file=/etc/ppp/peers/gsm_chat lvw2_chat_file=/etc/ppp/peers/lvw2_chat +leu1_chat_file=/etc/ppp/peers/leu1_chat sed -r -i "s/^OK\s+'AT\+CGDCONT=1,\"IP\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=1,\"IP\",\"${apn}\"'/" $gsm_chat_file sed -r -i "s/^OK\s+'AT\+CGDCONT=3,\"IPV4V6\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=3,\"IPV4V6\",\"${apn}\"'/" $lvw2_chat_file +sed -r -i "s/^OK\s+'AT\+CGDCONT=1,\"IPV4V6\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=1,\"IPV4V6\",\"${apn}\"'/" $leu1_chat_file if [[ $? != 0 ]]; then echo "Failed to change APN" exit 1 else - echo "Set APN to \"${apn}\" in $gsm_chat_file and $lvw2_chat_file" + echo "Set APN to \"${apn}\" in $gsm_chat_file, $lvw2_chat_file and $leu1_chat_file" fi exit 0 diff --git a/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb b/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb index efa8635..9fb8fbd 100644 --- a/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb +++ b/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb @@ -2,6 +2,6 @@ DESCRIPTION = "Scripts to easily get started with common mLinux use cases" require mlinux-scripts-1.0.inc -PR = "r3" +PR = "r5" S = "${WORKDIR}/mlinux-scripts-${PV}" diff --git a/recipes-core/multitech/config/network/interfaces b/recipes-core/multitech/config/network/interfaces index 546fd29..579c567 100644 --- a/recipes-core/multitech/config/network/interfaces +++ b/recipes-core/multitech/config/network/interfaces @@ -20,10 +20,44 @@ netmask 255.255.255.0 # netmask 255.255.255.0 # Wifi client +# +# For MTR WiFi only: # NOTE: udev rules will bring up wlan0 automatically if a wifi device is detected # and the wlan0 interface is defined, therefore an "auto wlan0" line is not needed. # If "auto wlan0" is also specified, startup conflicts may result. #iface wlan0 inet dhcp #wpa-conf /var/config/wpa_supplicant.conf #wpa-driver nl80211 - +# +# For Conduit WiFi: +# You must configure wpa_supplicant.conf as appropriate for your WiFi access point +# and its security. The "pre-up" section is needed to create the VAP device, +# wifi0. udhcpc_opts should be used to prevent DHCP from giving up too soon. The +# default timeout is less than 10 seconds, and in some circumstances is not enough +# time for wifi to connect. The udhcpc options specified below are in addition to +# those preconfigured in the ifup program. The option "-t" specifies the number +# of DHCP retries. By default each trial is 3 seconds long. As specified here, +# udhcpc will try for thirty seconds. The option "-b" specifies that if the +# attempts are made and all fail, the boot will proceed, and the udhcpc program +# will continue to periodically attempt to reach the DHCP server. Without the -b +# option, udhcpc will fail and abort if the server is not reached within the +# specified timeout. The boot will continue after the timeout, but the network +# will never be connected without some other intervention. +# +# Specifying "-t 0" results in udhcpc not running in the background, regardless +# of the presence of "-b". This causes udhcpc to enter a loop trying to reach +# the DHCP server, and only relinquising control to the boot (or ifup) if the +# server responds. +# +# The udhcpc_opts parameter will result in the following invocation +# of udhcpc from ifup: +# udhcpc -R -n -p /var/run/udhcpc.wifi0.pid -i wifi0 -t 10 -b +# +# See https://busybox.net/downloads/BusyBox.html for more information. +# +#auto wifi0 +#iface wifi0 inet dhcp +#wpa-conf /etc/wpa_supplicant.conf +#wpa-driver nl80211 +#pre-up bash -c '([[ -d /sys/class/net/wifi0 ]] || /opt/rs9113/onebox_util rpine0 create_vap wifi0 sta sw_bmiss)' +#udhcpc_opts -t 10 -b diff --git a/recipes-core/multitech/config/ppp/peers/leu1 b/recipes-core/multitech/config/ppp/peers/leu1 new file mode 100644 index 0000000..993b33a --- /dev/null +++ b/recipes-core/multitech/config/ppp/peers/leu1 @@ -0,0 +1,11 @@ +linkname ppp0 +230400 +defaultroute +replacedefaultroute +usepeerdns +ipcp-max-failure 10 +ipcp-restart 10 +noauth +crtscts +novj +connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/leu1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/leu1_chat b/recipes-core/multitech/config/ppp/peers/leu1_chat new file mode 100644 index 0000000..6f84008 --- /dev/null +++ b/recipes-core/multitech/config/ppp/peers/leu1_chat @@ -0,0 +1,22 @@ +SAY "LEU1 chat\n" +ECHO OFF +ABORT 'NO DIAL TONE' +ABORT 'NO DIALTONE' +ABORT 'NO ANSWER' +ABORT 'NO CARRIER' +ABORT 'DELAYED' +ABORT 'VOICE' +ABORT 'BUSY' +'' 'AT' +OK 'ATZ' +OK 'AT+CSQ' +# ---------------------------------- +# Set the APN for your provider here +# ---------------------------------- +OK 'AT+CGDCONT=1,"IPV4V6","internet"' +SAY "Dialing...\n" +OK 'ATD*99***1#' +SAY "Waiting for CONNECT...\n" +TIMEOUT 120 +CONNECT '' +SAY "Connected\n" diff --git a/recipes-core/multitech/config_1.0.bb b/recipes-core/multitech/config_1.0.bb index ed93e64..383baed 100644 --- a/recipes-core/multitech/config_1.0.bb +++ b/recipes-core/multitech/config_1.0.bb @@ -2,7 +2,7 @@ DESCRIPTION = "Provides default system config files and /var/config fs" SECTION = "base" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -PR = "r4" +PR = "r5" inherit update-rc.d diff --git a/recipes-core/multitech/reset-handler_1.0.bb b/recipes-core/multitech/reset-handler_1.0.bb index 13dec93..9ccd475 100644 --- a/recipes-core/multitech/reset-handler_1.0.bb +++ b/recipes-core/multitech/reset-handler_1.0.bb @@ -7,7 +7,7 @@ PR = "r1" inherit update-rc.d INITSCRIPT_NAME = "reset-handler" -INITSCRIPT_PARAMS = "start 99 2 3 4 5 ." +INITSCRIPT_PARAMS = "start 95 2 3 4 5 ." CONFFILES_${PN} = "${sysconfdir}/default/reset-handler" SRC_URI = "\ diff --git a/recipes-core/udev/udev-182/cellular_radios.rules b/recipes-core/udev/udev-182/cellular_radios.rules index 28f3131..fd36bbd 100644 --- a/recipes-core/udev/udev-182/cellular_radios.rules +++ b/recipes-core/udev/udev-182/cellular_radios.rules @@ -14,6 +14,13 @@ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_IFACE}=="06", SYMLINK+ ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_IFACE}=="08", SYMLINK+="modem4" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_IFACE}=="0a", SYMLINK+="modem5" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_IFACE}=="0c", SYMLINK+="modem6" +# LAT3, LVW3 and LEU3 +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="00", SYMLINK+="modem0" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="02", SYMLINK+="modem1" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="04", SYMLINK+="modem2" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="06", SYMLINK+="modem3" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="08", SYMLINK+="modem4" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="0a", SYMLINK+="modem5" # EV3 ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1010", ENV{ID_IFACE}=="00", SYMLINK+="modem0" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1010", ENV{ID_IFACE}=="01", SYMLINK+="modem1" @@ -34,6 +41,9 @@ ATTRS{idVendor}=="1199", ATTRS{idProduct}=="0028", SYMLINK+="modem$env{ID_PORT}" # H5: ttyACM0, ttyACM3 ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_IFACE}=="00", SYMLINK+="modem_at0" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0021", ENV{ID_IFACE}=="06", SYMLINK+="modem_at1" +# LAT3, LVW3 and LEU3 +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="00", SYMLINK+="modem_at0" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="06", SYMLINK+="modem_at1" # EV3: ttyUSB2, ttyUSB3 ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1010", ENV{ID_IFACE}=="02", SYMLINK+="modem_at0" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1010", ENV{ID_IFACE}=="03", SYMLINK+="modem_at1" @@ -46,5 +56,14 @@ ATTRS{idVendor}=="1199", ATTRS{idProduct}=="0028", ENV{ID_PORT}=="0", SYMLINK+=" # LAT1, LEU1, LVW2: ttyUSB2, ttyUSB3 (port 04 and port 05) ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1201", ENV{ID_IFACE}=="04", SYMLINK+="modem_at0" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1201", ENV{ID_IFACE}=="05", SYMLINK+="modem_at1" +# LJP1(LE910-JN1), LNA3(LE910-NA1): ttyACM0, ttyACM3 (port 00 and port 03) +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="00", SYMLINK+="modem_at0" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0036", ENV{ID_IFACE}=="06", SYMLINK+="modem_at1" +# G3: ttyACM0, ttyACM1 +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0022", ENV{ID_IFACE}=="00", SYMLINK+="modem_at0" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="0022", ENV{ID_IFACE}=="02", SYMLINK+="modem_at1" +# C2: ttyUSB0, ttyUSB1 (Telit Documentation: Modem Port = USB1, Aux Port = USB0) +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1011", ENV{ID_IFACE}=="01", SYMLINK+="modem_at0" +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1011", ENV{ID_IFACE}=="00", SYMLINK+="modem_at1" LABEL="mlinux_end" diff --git a/recipes-core/udev/udev-182/mtcap/mtcap.rules b/recipes-core/udev/udev-182/mtcap/mtcap.rules new file mode 100644 index 0000000..a0dc9fb --- /dev/null +++ b/recipes-core/udev/udev-182/mtcap/mtcap.rules @@ -0,0 +1,8 @@ +ACTION=="remove", GOTO="mlinux_end" +SUBSYSTEM!="tty", GOTO="mlinux_end" +KERNEL!="ttyXRUSB[0-9]*", GOTO="mlinux_end" + +SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" +ENV{ID_IFACE}=="", GOTO="mlinux_end" + +LABEL="mlinux_end" diff --git a/recipes-core/udev/udev-182/mtcdt/accessory_ethernet.rules b/recipes-core/udev/udev-182/mtcdt/accessory_ethernet.rules new file mode 100644 index 0000000..376486b --- /dev/null +++ b/recipes-core/udev/udev-182/mtcdt/accessory_ethernet.rules @@ -0,0 +1,21 @@ +#To add new rule for new device you have to run (in case if you want to add eth1 interface) +#admin@mtcdt:~# udevadm info --attribute-walk --path=/sys/class/net/eth1 +# looking at device '/devices/ahb.0/700000.ehci/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.0/net/eth1': +# KERNEL=="eth1" +# SUBSYSTEM=="net" +# DRIVER=="" +# ATTR{mtu}=="1500" +# ATTR{type}=="1" +# ........... +# ........... + +# looking at parent device '/devices/ahb.0/700000.ehci/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.0': +# KERNELS=="1-2.1.1:1.0" <------------------- extract this record to add to the rule +# SUBSYSTEMS=="usb" +# DRIVERS=="smsc75xx" +# ATTRS{bInterfaceClass}=="ff" +# ATTRS{bInterfaceSubClass}=="00" +# ........... + +KERNELS=="1-2.1.1:1.0", SUBSYSTEMS=="usb", DRIVERS=="smsc75xx", NAME="eth1" +KERNELS=="1-2.1.2:1.0", SUBSYSTEMS=="usb", DRIVERS=="smsc75xx", NAME="eth2" diff --git a/recipes-core/udev/udev-182/mtcdt/mtcdt.rules b/recipes-core/udev/udev-182/mtcdt/mtcdt.rules index 3bdbe5d..5d528e6 100644 --- a/recipes-core/udev/udev-182/mtcdt/mtcdt.rules +++ b/recipes-core/udev/udev-182/mtcdt/mtcdt.rules @@ -7,6 +7,8 @@ ENV{ID_IFACE}=="", GOTO="mlinux_end" # Accessory Ports ATTRS{idVendor}=="04e2", ATTRS{idProduct}=="1412", ENV{ID_IFACE}=="00", SYMLINK+="ttyAP1" +ATTRS{idVendor}=="04e2", ATTRS{idProduct}=="1414", ENV{ID_IFACE}=="00", SYMLINK+="ttyAP1" ATTRS{idVendor}=="04e2", ATTRS{idProduct}=="1412", ENV{ID_IFACE}=="02", SYMLINK+="ttyAP2" +ATTRS{idVendor}=="04e2", ATTRS{idProduct}=="1414", ENV{ID_IFACE}=="02", SYMLINK+="ttyAP2" LABEL="mlinux_end" diff --git a/recipes-core/udev/udev_182.bbappend b/recipes-core/udev/udev_182.bbappend index 39a5ae1..e793d1d 100644 --- a/recipes-core/udev/udev_182.bbappend +++ b/recipes-core/udev/udev_182.bbappend @@ -1,13 +1,20 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" -PR .= ".mlinux1" +PR .= ".mlinux2" # add custom rules for persistent modem device names SRC_URI += " file://cellular_radios.rules \ - file://${MACHINE}.rules \ + file://${MACHINE}.rules \ " +SRC_URI_append_mtcdt = " file://accessory_ethernet.rules \ + " + do_install_append() { install -m 644 ${WORKDIR}/cellular_radios.rules ${D}${sysconfdir}/udev/rules.d/ install -m 644 ${WORKDIR}/${MACHINE}.rules ${D}${sysconfdir}/udev/rules.d/ } + +do_install_append_mtcdt() { + install -m 644 ${WORKDIR}/accessory_ethernet.rules ${D}${sysconfdir}/udev/rules.d/ +} |