Skip to content
Snippets Groups Projects
Commit dfb3a048 authored by Pete Tucker's avatar Pete Tucker
Browse files

Merge branch 'fix/zephyr' into 'master'

ES-220 Added HCI mode enablement scripts.

See merge request !45
parents 958b179f 39d2485a
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ RDEPENDS_${PN} = "dbus-lib libnl libnl-genl bluez5"
#Qualcomm 6234 board data file
SRCBRANCH ?= "master"
SRCREV = "0d676097941f62e1b664ac90367da3e065a50dee"
SRCREV = "3c34eacb6896926154717dc1b9ef50081515555f"
SRC_URI = "git://git.rigado.com/vesta/vesta-firmware.git;protocol=https;branch=${SRCBRANCH};destsuffix=${S}/git; \
"
S = "${WORKDIR}"
......@@ -32,7 +32,7 @@ do_install() {
install -d ${D}${base_libdir}/firmware/bmd300
install -m 444 git/firmware/bmd300/LICENSE.zephyr_firmware ${D}${base_libdir}/firmware/bmd300
install -m 644 git/firmware/bmd300/zephyr-v1.8.hex ${D}${base_libdir}/firmware/bmd300
install -m 644 git/firmware/bmd300/zephyr_1.9.0_e438c4a_rigdfu_3.4.0.hex ${D}${base_libdir}/firmware/bmd300
install -d ${D}${base_libdir}/firmware/r41z
install -m 644 git/firmware/r41z/nxp-thread-r41z.bin ${D}${base_libdir}/firmware/r41z
......@@ -47,7 +47,7 @@ FILES_${PN} += " \
${base_libdir}/firmware/bmd300/nrf52832_13.1.0.hex \
${base_libdir}/firmware/bmd300/s132_nrf52_4.0.2_softdevice.hex \
${base_libdir}/firmware/bmd300/LICENSE.zephyr_firmware \
${base_libdir}/firmware/bmd300/zephyr-v1.8.hex \
${base_libdir}/firmware/bmd300/zephyr_1.9.0_e438c4a_rigdfu_3.4.0.hex \
${base_libdir}/firmware/r41z/nxp-thread-r41z.bin \
"
......
......@@ -7,4 +7,4 @@
# Default-Stop:
### END INIT INFO
hciattach -n -t 20 /dev/ttymxc0 ath3k 3000000 &
hciattach -t 20 /dev/ttymxc0 ath3k 3000000 &
#!/bin/sh
reset_bmd()
{
reset_pin=$1
if [ ! -f /sys/class/gpio/gpio${reset_pin}/direction ];
then
#setup gpio pin
echo $reset_pin > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio${reset_pin}/direction
fi
#hold 0.1s
echo 0 > /sys/class/gpio/gpio${reset_pin}/value
usleep 100000
echo 1 > /sys/class/gpio/gpio${reset_pin}/value
}
generate_mac()
{
#hash the device serial
hash=`unit_serial_number | md5sum | grep -oE "[0-9a-f]+"`
#truncate to lower 40 bits
mac=`echo $hash | grep -oE "[0-9a-f]{11}$"`
#add a leading 0xf to set the high bit for random address
mac=f$mac
#upper case
mac=${mac^^}
#add colons
mac=`echo $mac | sed 's/.\{2\}/&\:/g' | sed 's/.$//'`
}
#If this is a vesta-100 board set idx=0 otherwise 1
cat /proc/cmdline | grep "vesta-100"
idx=$?
#genmac
echo "generating mac address..."
generate_mac
#hard reset the bmd
echo "resetting bmd..."
reset_bmd 120
echo "detaching..."
killall -9 hciattach
sleep 2
#Skip if vesta-100 board
if [ $idx -ne 0 ]; then
#attach wlan
echo "attaching hci0 (wlan)..."
hciattach -t 20 /dev/ttymxc0 ath3k
fi
#attach
echo "attaching hci$idx (bmd)..."
hciattach -t 20 -s 1000000 /dev/ttymxc2 any 1000000 flow
#verify hciattach was successful
if [ $? -eq 0 ]; then
sleep 2
echo "setting mac address: $mac"
btmgmt --index $idx static-addr $mac
sleep 2
echo "auto-power enable"
btmgmt --index $idx auto-power
sleep 2
else
echo "FAILED: attaching hci$idx (bmd)..."
exit 1
fi
#scan when done?
#this actually will cause hci to detach since the process running hciattach is killed when you press ctrl+C to stop scanning
#so you should start the scan yourself
#if [ $# -eq 1 ] && [ $1 == scan ]; then
# echo "start lescan..."
# btmgmt --index $idx find -l &
#fi
exit 0
#!/bin/sh
### BEGIN INIT INFO
# Provides: hciattach for bmd300
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
### END INIT INFO
/usr/rigado/scripts/attach_hci.sh 2>&1 | logger -p user.info
......@@ -14,6 +14,8 @@ SRC_URI = "file://blacklist.conf \
file://npm_install_packages.sh \
file://rig_init.sh \
file://watchdog.sh \
file://start_hci.sh \
file://attach_hci.sh \
"
S = "${WORKDIR}"
......@@ -26,8 +28,14 @@ do_install() {
install -m 755 set_hwrevision.sh ${D}${exec_prefix}/rigado/scripts/set_hwrevision.sh
install -m 755 watchdog.sh ${D}${exec_prefix}/rigado/scripts/watchdog.sh
install -m 755 npm_install_packages.sh ${D}${exec_prefix}/rigado/scripts/npm_install_packages.sh
install -m 755 attach_hci.sh ${D}${exec_prefix}/rigado/scripts/attach_hci.sh
install -d ${D}${sysconfdir}/rc5.d
ln -sf /usr/rigado/scripts/rig_init.sh ${D}${sysconfdir}/rc5.d/S90rig_init.sh
install -d ${D}${sysconfdir}/init.d
install -m 0755 start_hci.sh ${D}${sysconfdir}/init.d
install -d ${D}${sysconfdir}/vesta
install -d ${D}${sysconfdir}/modprobe.d
......@@ -42,6 +50,7 @@ FILES_${PN} += " \
${exec_prefix}/rigado/scripts/set_hwrevision.sh \
${exec_prefix}/rigado/scripts/watchdog.sh \
${exec_prefix}/rigado/scripts/npm_install_packages.sh \
${exec_prefix}/rigado/scripts/attach_hci.sh \
"
COMPATIBLE_MACHINE = "(vesta|imx6ul)"
#!/bin/sh
#This is a helper script to program the BMD-300 with the Zephyr hex file
bmd300_program.sh -h /lib/firmware/bmd300/zephyr-v1.8.hex
bmd300_program.sh -h /lib/firmware/bmd300/zephyr_1.9.0_e438c4a_rigdfu_3.4.0.hex
if [ $? -eq 0 ]; then
echo
echo "Programming of BMD-300 with Zephyr was SUCCESSFUL"
else
if [ $? -ne 0 ]; then
echo
echo "Programming of BMD-300 with Zephyr has FAILED"
exit 1
fi
echo "Programming of BMD-300 with Zephyr was SUCCESSFUL"
#disable hciattach.sh from startup
update-rc.d -f hciattach.sh remove
#enable start_hci.sh at startup
update-rc.d start_hci.sh start 99 5 .
/etc/init.d/start_hci.sh
if [ $? -ne 0 ]; then
echo
echo FAILED to attach hci interface.
exit 1
else
echo
echo SUCCESSFULLY attached hci interface.
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment