Merge commit 'ddc43d20a70210a00d0eeff948ef505b38648c18' into dora
This commit is contained in:
commit
824a820142
|
@ -6,6 +6,8 @@ require sysmobts-v2.conf
|
||||||
|
|
||||||
MACHINEOVERRIDES = "${MACHINE}:sysmobts-v2"
|
MACHINEOVERRIDES = "${MACHINE}:sysmobts-v2"
|
||||||
|
|
||||||
|
# TODO: Remove this file once edison support is dropped from this layer
|
||||||
|
|
||||||
# we are disabling the serial console for now, as it may interfere with
|
# we are disabling the serial console for now, as it may interfere with
|
||||||
# the MSP430 service processor communication until proper filtering/splitting
|
# the MSP430 service processor communication until proper filtering/splitting
|
||||||
# of the serial stream is implemented in the kernel
|
# of the serial stream is implemented in the kernel
|
||||||
|
|
|
@ -5,7 +5,7 @@ do_extract() {
|
||||||
SEARCH=`tar -tvf $1 | grep $2`
|
SEARCH=`tar -tvf $1 | grep $2`
|
||||||
RES=$?
|
RES=$?
|
||||||
if [ $RES = 0 ]; then
|
if [ $RES = 0 ]; then
|
||||||
tar -C / -xvf $1 --strip=1 $2
|
tar --transform='s,^content/,,' -C / -xvf $1 $2
|
||||||
else
|
else
|
||||||
echo "Directory '$2' is not in backup '$1'."
|
echo "Directory '$2' is not in backup '$1'."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
DESCRIPTION = "sysmocom config backup and restore scripts"
|
DESCRIPTION = "sysmocom config backup and restore scripts"
|
||||||
LICENSE = "GPLv3+"
|
LICENSE = "GPLv3+"
|
||||||
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
|
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
|
||||||
PR = "r10"
|
PR = "r11"
|
||||||
|
|
||||||
SRC_URI = "file://sysmocom-backup file://sysmocom-restore"
|
SRC_URI = "file://sysmocom-backup file://sysmocom-restore"
|
||||||
RDEPENDS_${PN} = "tar"
|
RDEPENDS_${PN} = "tar"
|
||||||
|
|
|
@ -4,13 +4,13 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3
|
||||||
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||||
DEPENDS = "virtual/kernel"
|
DEPENDS = "virtual/kernel"
|
||||||
ALLOW_EMPTY_${PN} = "1"
|
ALLOW_EMPTY_${PN} = "1"
|
||||||
PR = "r21"
|
PR = "r23"
|
||||||
|
|
||||||
CALIB = ""
|
CALIB = ""
|
||||||
CALIB_sysmobts-v2 = "sysmobts-calib sysmobts-util"
|
CALIB_sysmobts-v2 = "sysmobts-calib sysmobts-util"
|
||||||
|
|
||||||
UTIL = ""
|
UTIL = ""
|
||||||
UTIL_sysmobts-2050 = "sbts2050-util gpsd gps-utils"
|
UTIL_sysmobts-v2 = "sbts2050-util gpsd gps-utils"
|
||||||
|
|
||||||
# TODO: re-add femtobts-calib after it went through the API migration
|
# TODO: re-add femtobts-calib after it went through the API migration
|
||||||
RDEPENDS_${PN} = "\
|
RDEPENDS_${PN} = "\
|
||||||
|
@ -18,6 +18,7 @@ RDEPENDS_${PN} = "\
|
||||||
osmo-bts-remote \
|
osmo-bts-remote \
|
||||||
osmo-pcu \
|
osmo-pcu \
|
||||||
lmsensors-scripts \
|
lmsensors-scripts \
|
||||||
|
sysmobts-config \
|
||||||
${CALIB} \
|
${CALIB} \
|
||||||
${UTIL} \
|
${UTIL} \
|
||||||
"
|
"
|
||||||
|
|
|
@ -3,10 +3,11 @@ LICENSE = "MIT"
|
||||||
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
|
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
|
||||||
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||||
ALLOW_EMPTY_${PN} = "1"
|
ALLOW_EMPTY_${PN} = "1"
|
||||||
PR = "r9"
|
PR = "r10"
|
||||||
|
|
||||||
RDEPENDS_${PN} = "\
|
RDEPENDS_${PN} = "\
|
||||||
task-sysmocom-tools \
|
task-sysmocom-tools \
|
||||||
task-sysmocom-debug \
|
task-sysmocom-debug \
|
||||||
minicom vlan patch procps psmisc \
|
minicom vlan patch procps psmisc \
|
||||||
ppp rsync sed usbutils openvpn iperf"
|
ppp rsync sed usbutils openvpn iperf \
|
||||||
|
lcr"
|
||||||
|
|
|
@ -154,6 +154,16 @@ CONFIG_USB_USBNET=y
|
||||||
# CONFIG_USB_BELKIN is not set
|
# CONFIG_USB_BELKIN is not set
|
||||||
# CONFIG_USB_ARMLINUX is not set
|
# CONFIG_USB_ARMLINUX is not set
|
||||||
# CONFIG_USB_NET_ZAURUS is not set
|
# CONFIG_USB_NET_ZAURUS is not set
|
||||||
|
CONFIG_WLAN=y
|
||||||
|
CONFIG_RT2X00=m
|
||||||
|
CONFIG_RT2800USB=m
|
||||||
|
CONFIG_RT2800USB_RT33XX=y
|
||||||
|
CONFIG_RT2800USB_RT35XX=y
|
||||||
|
CONFIG_RT2800_LIB=m
|
||||||
|
CONFIG_RT2X00_LIB_USB=m
|
||||||
|
CONFIG_RT2X00_LIB=m
|
||||||
|
CONFIG_RT2X00_LIB_FIRMWARE=y
|
||||||
|
CONFIG_RT2X00_LIB_CRYPTO=y
|
||||||
CONFIG_WL12XX_MENU=y
|
CONFIG_WL12XX_MENU=y
|
||||||
CONFIG_WL12XX=m
|
CONFIG_WL12XX=m
|
||||||
CONFIG_WL12XX_SDIO=m
|
CONFIG_WL12XX_SDIO=m
|
||||||
|
|
|
@ -14,10 +14,10 @@ BTS_FIRMWARE_NAME_sysmobts-2050 = "sysmobts-v2"
|
||||||
SRCREV = "bcc4fa827be7f59486ff305d664b42a142025f9b"
|
SRCREV = "bcc4fa827be7f59486ff305d664b42a142025f9b"
|
||||||
|
|
||||||
# odu handling.
|
# odu handling.
|
||||||
SRCREV_sysmocom-odu = "f11945e1d688bef5d2a81cc0255b19ed416cab42"
|
SRCREV_sysmocom-odu = "6e6273dd4e6c29f9ed23e898393a3ab89647ef15"
|
||||||
LINUX_VERSION_sysmocom-odu = "3.2.0"
|
LINUX_VERSION_sysmocom-odu = "3.2.63"
|
||||||
|
|
||||||
PR = "r34"
|
PR = "r35"
|
||||||
PV = "${LINUX_VERSION}+git${SRCPV}"
|
PV = "${LINUX_VERSION}+git${SRCPV}"
|
||||||
|
|
||||||
SRC_URI = "git://git.sysmocom.de/sysmo-bts/linux.git;protocol=git;branch=v3.2 \
|
SRC_URI = "git://git.sysmocom.de/sysmo-bts/linux.git;protocol=git;branch=v3.2 \
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
#ping = 172.31.14.1
|
|
||||||
#ping = 172.26.1.255
|
|
||||||
#interface = eth0
|
|
||||||
#file = /var/log/messages
|
|
||||||
#change = 1407
|
|
||||||
|
|
||||||
# Uncomment to enable test. Setting one of these values to '0' disables it.
|
|
||||||
# These values will hopefully never reboot your machine during normal use
|
|
||||||
# (if your machine is really hung, the loadavg will go much higher than 25)
|
|
||||||
#max-load-1 = 24
|
|
||||||
#max-load-5 = 18
|
|
||||||
#max-load-15 = 12
|
|
||||||
|
|
||||||
# Note that this is the number of pages!
|
|
||||||
# To get the real size, check how large the pagesize is on your machine.
|
|
||||||
#min-memory = 1
|
|
||||||
|
|
||||||
#repair-binary = /usr/sbin/repair
|
|
||||||
#repair-timeout =
|
|
||||||
#test-binary =
|
|
||||||
#test-timeout =
|
|
||||||
|
|
||||||
watchdog-device = /dev/watchdog
|
|
||||||
|
|
||||||
# Defaults compiled into the binary
|
|
||||||
#temperature-device =
|
|
||||||
#max-temperature = 120
|
|
||||||
|
|
||||||
# Defaults compiled into the binary
|
|
||||||
#admin = root
|
|
||||||
#interval = 1
|
|
||||||
#logtick = 1
|
|
||||||
#log-dir = /var/log/watchdog
|
|
||||||
|
|
||||||
# This greatly decreases the chance that watchdog won't be scheduled before
|
|
||||||
# your machine is really loaded
|
|
||||||
realtime = yes
|
|
||||||
priority = 1
|
|
||||||
|
|
||||||
# Check if syslogd is still running by enabling the following line
|
|
||||||
#pidfile
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# we sed the udev automounter so it mounts all partions on the stick/sdcard readonly
|
||||||
|
|
||||||
|
change_udev_automounter_ro() {
|
||||||
|
sed -i -e 's/\-t auto/\-t auto \-o ro/' ${IMAGE_ROOTFS}/etc/udev/scripts/mount.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
ROOTFS_POSTPROCESS_COMMAND += "change_udev_automounter_ro ; "
|
|
@ -9,9 +9,32 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
# We want a 1 Gig partition on the cf
|
# We want a 1 Gig partition on the cf
|
||||||
partition_size=1000
|
partition_size=1000
|
||||||
|
|
||||||
|
# Parse original arguments coming from the kernel cmdline.
|
||||||
|
# Then shift the first two arguments which contains
|
||||||
|
# partition information.
|
||||||
|
dev_name=$1
|
||||||
|
shift
|
||||||
|
image_name=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
kernel_cmdline_console=""
|
||||||
|
kernel_cmdline_video_mode=""
|
||||||
|
kernel_cmdline_vga_mode=""
|
||||||
|
|
||||||
|
while [ "$1" != "" ]; do
|
||||||
|
|
||||||
|
echo "$1" | grep -q "console="
|
||||||
|
success_console=$?
|
||||||
|
if [ $success_console -eq 0 ]; then
|
||||||
|
kernel_cmdline_console=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
# Get a list of hard drives
|
# Get a list of hard drives
|
||||||
hdnamelist=""
|
hdnamelist=""
|
||||||
live_dev_name=${1%%/*}
|
live_dev_name=${dev_name%%/*}
|
||||||
|
|
||||||
echo "Searching for hard drives ..."
|
echo "Searching for hard drives ..."
|
||||||
|
|
||||||
|
@ -120,7 +143,7 @@ mkdir /tgt_root
|
||||||
mkdir -p /boot
|
mkdir -p /boot
|
||||||
|
|
||||||
echo "Copying rootfs files..."
|
echo "Copying rootfs files..."
|
||||||
dd if=/media/$1/$2 of=$rootfs bs=1024
|
dd if=/media/$dev_name/$image_name of=$rootfs bs=1024
|
||||||
|
|
||||||
# Handling of the target root partition
|
# Handling of the target root partition
|
||||||
mount $rootfs /tgt_root
|
mount $rootfs /tgt_root
|
||||||
|
@ -139,11 +162,13 @@ echo "Preparing boot partition..."
|
||||||
GRUBCFG="/boot/grub/grub.cfg"
|
GRUBCFG="/boot/grub/grub.cfg"
|
||||||
mkdir -p $(dirname $GRUBCFG)
|
mkdir -p $(dirname $GRUBCFG)
|
||||||
|
|
||||||
|
baudrate=`echo $kernel_cmdline_console | cut -f 2 -d ',' | cut -f 1 -d 'n'`
|
||||||
|
|
||||||
cat > $GRUBCFG << EOF
|
cat > $GRUBCFG << EOF
|
||||||
default=0
|
default=0
|
||||||
timeout=1
|
timeout=1
|
||||||
|
|
||||||
serial --unit=0 --speed=38400
|
serial --unit=0 --speed=$baudrate
|
||||||
terminal --timeout=2 serial
|
terminal --timeout=2 serial
|
||||||
|
|
||||||
terminal_input --append serial
|
terminal_input --append serial
|
||||||
|
@ -155,10 +180,11 @@ if [ -f /etc/grub.d/40_custom ] ; then
|
||||||
|
|
||||||
cat /etc/grub.d/40_custom >> $GRUBCFG
|
cat /etc/grub.d/40_custom >> $GRUBCFG
|
||||||
sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG
|
sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG
|
||||||
sed -i "s/__VIDEO_MODE__/$3/g" $GRUBCFG
|
sed -i "s/__VIDEO_MODE__/$kernel_cmdline_video_mode/g" $GRUBCFG
|
||||||
sed -i "s/__VGA_MODE__/$4/g" $GRUBCFG
|
sed -i "s/__VGA_MODE__/$kernel_cmdline_vga_mode/g" $GRUBCFG
|
||||||
sed -i "s/__CONSOLE__/$5/g" $GRUBCFG
|
sed -i "s/__CONSOLE__/$kernel_cmdline_console/g" $GRUBCFG
|
||||||
sed -i "s/quiet/net.ifnames=0 quiet/g" $GRUBCFG
|
sed -i "s/quiet/net.ifnames=0 quiet/g" $GRUBCFG
|
||||||
|
sed -i "s/rw/ro/g" $GRUBCFG
|
||||||
sed -i "/#/d" $GRUBCFG
|
sed -i "/#/d" $GRUBCFG
|
||||||
sed -i "/exec tail/d" $GRUBCFG
|
sed -i "/exec tail/d" $GRUBCFG
|
||||||
chmod 0444 $GRUBCFG
|
chmod 0444 $GRUBCFG
|
||||||
|
@ -172,10 +198,31 @@ umount /boot
|
||||||
umount /tgt_root
|
umount /tgt_root
|
||||||
|
|
||||||
echo "Resizing partition"
|
echo "Resizing partition"
|
||||||
|
e2fsck -f $rootfs || true
|
||||||
resize2fs $rootfs
|
resize2fs $rootfs
|
||||||
|
|
||||||
sync
|
sync
|
||||||
|
|
||||||
|
echo "Re-mounting the root and trying to apply backup."
|
||||||
|
mount $rootfs /tgt_root
|
||||||
|
|
||||||
|
echo "Finding backupfiles"
|
||||||
|
backupfile=`find /media/$dev_name/ -name "sysmocom-backup*.tar" | head -n1`
|
||||||
|
if [ -n "$backupfile" ]; then
|
||||||
|
if [ ! -r "$backupfile" ]; then
|
||||||
|
echo "configurations-file $backupfile it is not readable"
|
||||||
|
else
|
||||||
|
echo "restoring $backupfile"
|
||||||
|
backupfile_basename=`basename $backupfile`
|
||||||
|
cp $backupfile /tgt_root
|
||||||
|
chroot /tgt_root /usr/sbin/sysmocom-restore $backupfile_basename
|
||||||
|
rm /tgt_root/$backupfile_basename
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No configurations-file found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
umount /tgt_root
|
||||||
|
sync
|
||||||
|
|
||||||
echo "Remove your installation media, and press ENTER"
|
echo "Remove your installation media, and press ENTER"
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
|
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
|
||||||
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/files:"
|
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/files:"
|
||||||
|
|
||||||
|
RDEPENDS_${PN} += "e2fsprogs-e2fsck"
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# If you must specify a non-NMEA driver, uncomment and modify the next line
|
|
||||||
GPSD_SOCKET="/var/run/gpsd.sock"
|
|
||||||
GPSD_OPTIONS=""
|
|
||||||
GPS_DEVICES="/dev/ttyS2"
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# If you must specify a non-NMEA driver, uncomment and modify the next line
|
# If you must specify a non-NMEA driver, uncomment and modify the next line
|
||||||
GPSD_SOCKET="/var/run/gpsd.sock"
|
GPSD_SOCKET="/var/run/gpsd.sock"
|
||||||
GPSD_OPTIONS=""
|
GPSD_OPTIONS=""
|
||||||
GPS_DEVICES="udp://127.0.0.1:12345 udp://127.0.0.1:12346"
|
GPS_DEVICES="/dev/ttyS2"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ DEPENDS = "ncurses python"
|
||||||
#DEPENDS = "ncurses libusb1 python"
|
#DEPENDS = "ncurses libusb1 python"
|
||||||
PROVIDES = "virtual/gpsd"
|
PROVIDES = "virtual/gpsd"
|
||||||
|
|
||||||
PR = "r3.15"
|
PR = "r3.16"
|
||||||
|
|
||||||
SRC_URI = "http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz \
|
SRC_URI = "http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz \
|
||||||
file://0002-SConstruct-respect-sysroot-also-in-SPLINTOPTS.patch \
|
file://0002-SConstruct-respect-sysroot-also-in-SPLINTOPTS.patch \
|
||||||
|
|
|
@ -0,0 +1,185 @@
|
||||||
|
From 987960ea03c59a2ef9164e4f7309031ef4e0242d Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <987960ea03c59a2ef9164e4f7309031ef4e0242d.1410189314.git.daniel@totalueberwachung.de>
|
||||||
|
From: Daniel Willmann <dwillmann@sysmocom.de>
|
||||||
|
Date: Mon, 8 Sep 2014 15:53:54 +0200
|
||||||
|
Subject: [PATCH 1/1] Add wifi2udp program
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 4 +-
|
||||||
|
wifi2udp.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 149 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 wifi2udp.c
|
||||||
|
|
||||||
|
Index: wireless_tools.29/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- wireless_tools.29.orig/Makefile 2014-09-08 17:27:45.000000000 +0200
|
||||||
|
+++ wireless_tools.29/Makefile 2014-09-08 17:32:52.065211007 +0200
|
||||||
|
@@ -48,7 +48,7 @@
|
||||||
|
# Targets to build
|
||||||
|
STATIC=libiw.a
|
||||||
|
DYNAMIC=libiw.so.$(WT_VERSION)
|
||||||
|
-PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent ifrename
|
||||||
|
+PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent ifrename wifi2udp
|
||||||
|
MANPAGES8=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8 ifrename.8
|
||||||
|
MANPAGES7=wireless.7
|
||||||
|
MANPAGES5=iftab.5
|
||||||
|
@@ -135,6 +135,8 @@
|
||||||
|
|
||||||
|
macaddr: macaddr.o $(IWLIB)
|
||||||
|
|
||||||
|
+wifi2udp: wifi2udp.o $(IWLIB)
|
||||||
|
+
|
||||||
|
iwmulticall: iwmulticall.o
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
|
Index: wireless_tools.29/wifi2udp.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ wireless_tools.29/wifi2udp.c 2014-09-08 17:30:08.217211001 +0200
|
||||||
|
@@ -0,0 +1,146 @@
|
||||||
|
+
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <time.h>
|
||||||
|
+#include <iwlib.h>
|
||||||
|
+
|
||||||
|
+#include <sys/socket.h>
|
||||||
|
+
|
||||||
|
+static int verbose = 0;
|
||||||
|
+static int delay = 10;
|
||||||
|
+
|
||||||
|
+static void escape_essid(const char *src, char *dst, ssize_t len)
|
||||||
|
+{
|
||||||
|
+ int i, j;
|
||||||
|
+
|
||||||
|
+ for (i = 0, j = 0; j < len; i++, j++) {
|
||||||
|
+ if (src[i] == '"') {
|
||||||
|
+ dst[j] = '\\';
|
||||||
|
+ j++;
|
||||||
|
+ if (j == len)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dst[j] = src[i];
|
||||||
|
+
|
||||||
|
+ if (!src[i])
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void scan_wifi(char *iface, const char *oduiface, const char *server, int port)
|
||||||
|
+{
|
||||||
|
+ int sock, rc;
|
||||||
|
+ iwrange range;
|
||||||
|
+ struct ifreq buf;
|
||||||
|
+ char mac[20];
|
||||||
|
+
|
||||||
|
+ struct sockaddr_in remote;
|
||||||
|
+ struct hostent *hp;
|
||||||
|
+
|
||||||
|
+ hp = gethostbyname(server);
|
||||||
|
+ if (!hp) {
|
||||||
|
+ printf("Could not resolve %s\n", server);
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ remote.sin_family = AF_INET;
|
||||||
|
+ memcpy(&remote.sin_addr, hp->h_addr, hp->h_length);
|
||||||
|
+ remote.sin_port = htons(port);
|
||||||
|
+
|
||||||
|
+ /* Retrieve MAC address of Wifi card */
|
||||||
|
+ sock = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
|
+ memset(&buf, 0, sizeof(buf));
|
||||||
|
+
|
||||||
|
+ strcpy(buf.ifr_name, oduiface);
|
||||||
|
+ ioctl(sock, SIOCGIFHWADDR, &buf);
|
||||||
|
+ iw_sawap_ntop(&buf.ifr_hwaddr, mac);
|
||||||
|
+
|
||||||
|
+ sock = iw_sockets_open();
|
||||||
|
+
|
||||||
|
+ rc = iw_get_range_info(sock, iface, &range);
|
||||||
|
+ if (rc < 0) {
|
||||||
|
+ printf("iw_get_range_info() returned %i\n", rc);
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ while (1) {
|
||||||
|
+ time_t now;
|
||||||
|
+ wireless_scan_head head;
|
||||||
|
+ wireless_scan *result;
|
||||||
|
+ /* Scan for wireless networks */
|
||||||
|
+ rc = iw_scan(sock, iface, range.we_version_compiled, &head);
|
||||||
|
+ if (rc < 0) {
|
||||||
|
+ printf("iw_scan() returned %i\n", rc);
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ now = time(NULL);
|
||||||
|
+
|
||||||
|
+ /* Print the results */
|
||||||
|
+ result = head.result;
|
||||||
|
+ while (NULL != result) {
|
||||||
|
+ char bssid[20];
|
||||||
|
+ char line[1024];
|
||||||
|
+ char essid_escaped[50];
|
||||||
|
+ iw_sawap_ntop(&result->ap_addr, bssid);
|
||||||
|
+
|
||||||
|
+ escape_essid(result->b.essid, essid_escaped, 50);
|
||||||
|
+ snprintf(line, 1024, "WIFI,%li,%s,\"%s\",%s,%0.0f,%i\r\n", now, mac, essid_escaped, bssid, result->b.freq/1000000, (int8_t)result->stats.qual.level);
|
||||||
|
+ if (verbose)
|
||||||
|
+ printf("%s", line);
|
||||||
|
+ rc = sendto(sock, line, strlen(line), 0, (struct sockaddr*)&remote, sizeof(remote));
|
||||||
|
+ if (rc == -1)
|
||||||
|
+ printf("Failed to send message: %s\n", strerror(errno));
|
||||||
|
+ result = result->next;
|
||||||
|
+ }
|
||||||
|
+ sleep(delay);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void usage(void)
|
||||||
|
+{
|
||||||
|
+ printf("Usage: prog [options] host [port]\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int main(int argc, char *argv[])
|
||||||
|
+{
|
||||||
|
+ int option;
|
||||||
|
+ char *wifiiface = NULL, *ifacename = NULL, *server;
|
||||||
|
+ int port = 20001;
|
||||||
|
+
|
||||||
|
+ while ((option = getopt(argc, argv, "?hvw:i:d:")) != -1) {
|
||||||
|
+ switch (option) {
|
||||||
|
+ case 'v':
|
||||||
|
+ verbose = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 'w':
|
||||||
|
+ wifiiface = optarg;
|
||||||
|
+ break;
|
||||||
|
+ case 'i':
|
||||||
|
+ ifacename = optarg;
|
||||||
|
+ break;
|
||||||
|
+ case 'd':
|
||||||
|
+ delay = atoi(optarg);
|
||||||
|
+ break;
|
||||||
|
+ case '?':
|
||||||
|
+ case 'h':
|
||||||
|
+ usage();
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (optind < argc) {
|
||||||
|
+ server = argv[optind];
|
||||||
|
+ optind++;
|
||||||
|
+ } else {
|
||||||
|
+ usage();
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
+ if (optind < argc)
|
||||||
|
+ port = atoi(argv[optind]);
|
||||||
|
+
|
||||||
|
+ scan_wifi(wifiiface, ifacename, server, port);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
|
@ -0,0 +1,8 @@
|
||||||
|
[Unit]
|
||||||
|
Description=WIFI scan service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStartPre=/sbin/ifconfig wlan0 up
|
||||||
|
ExecStart=/usr/sbin/wifi2udp -w wlan0 -i eth0 10.3.0.1
|
||||||
|
Restart=always
|
||||||
|
RestartSec=2
|
|
@ -0,0 +1,21 @@
|
||||||
|
THISDIR := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
|
||||||
|
FILESPATH =. "${@base_set_filespath(["${THISDIR}/files"], d)}:"
|
||||||
|
|
||||||
|
PRINC="6"
|
||||||
|
|
||||||
|
SRC_URI += "file://0001-Add-wifi2udp-program.patch \
|
||||||
|
file://wifi2udp.service"
|
||||||
|
|
||||||
|
PACKAGES =+ "wireless-tools-wifi2udp"
|
||||||
|
|
||||||
|
FILES_wireless-tools-wifi2udp = "${sbindir}/wifi2udp \
|
||||||
|
${systemd_unitdir}/system/wifi2udp.service \
|
||||||
|
${systemd_unitdir}/system/multi-user.target.wants/wifi2udp.service"
|
||||||
|
|
||||||
|
do_install_append() {
|
||||||
|
install -m 0755 wifi2udp ${D}${sbindir}/wifi2udp
|
||||||
|
install -d ${D}${systemd_unitdir}/system/
|
||||||
|
install -m 0644 ${WORKDIR}/wifi2udp.service ${D}${systemd_unitdir}/system/
|
||||||
|
install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/
|
||||||
|
ln -sf ../wifi2udp.service ${D}${systemd_unitdir}/system/multi-user.target.wants/
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ do_compile() {
|
||||||
:
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
COMPATIBLE_MACHINE = "sysmobts-2050"
|
COMPATIBLE_MACHINE = "sysmobts-v2"
|
||||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||||
|
|
||||||
INSANE_SKIP_${PN} += "already-stripped ldflags"
|
INSANE_SKIP_${PN} += "already-stripped ldflags"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
prepare_sysmobts_2050() {
|
||||||
|
# Disable getty and mangle the config
|
||||||
|
/bin/systemctl mask serial-getty@ttyS0.service
|
||||||
|
|
||||||
|
# We need to mange the systemd config file
|
||||||
|
sed -i s,#LogTarget=journal-or-kmsg,LogTarget=null, /etc/systemd/system.conf
|
||||||
|
sed -i s,#ShowStatus=yes,ShowStatus=no, /etc/systemd/system.conf
|
||||||
|
sed -i s,#DefaultStandardOutput=journal,DefaultStandardOutput=syslog, /etc/systemd/system.conf
|
||||||
|
sed -i s,#DefaultStandardError=inherit,DefaultStandardError=syslog, /etc/systemd/system.conf
|
||||||
|
sync
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
MODEL=`/usr/bin/sysmobts-util -r model-nr`
|
||||||
|
|
||||||
|
if [ $MODEL -eq "2050" ];
|
||||||
|
then
|
||||||
|
echo "Going to fix the configuration for sysmobts-2050"
|
||||||
|
prepare_sysmobts_2050
|
||||||
|
fi
|
|
@ -0,0 +1,22 @@
|
||||||
|
DESCRIPTION = "Script to mangle the configuration"
|
||||||
|
SECTION = "core"
|
||||||
|
LICENSE = "CLOSED"
|
||||||
|
|
||||||
|
SRC_URI = "file://sysmobts-post-install-config"
|
||||||
|
PR = "r1"
|
||||||
|
|
||||||
|
do_install() {
|
||||||
|
install -d ${D}${bindir}
|
||||||
|
install -m 0755 ${WORKDIR}/sysmobts-post-install-config ${D}${bindir}/
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst_${PN} () {
|
||||||
|
if test "x$D" != "x"; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Going to run device specific post configuration"
|
||||||
|
/usr/bin/sysmobts-post-install-config
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKAGE_ARCH = "all"
|
|
@ -0,0 +1 @@
|
||||||
|
require recipes-fixes/wireless-tools/${PN}_sysmocom.inc
|
Loading…
Reference in New Issue