aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigory Kletsko <grigory.kletsko@cogentembedded.com>2016-06-17 15:43:53 +0300
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-09-07 15:44:42 +0200
commiteb2c1a7e212e61159c92cf2b127bfe264b7d231c (patch)
tree7c03f480183affb40be36a3bea64df2cb4519845
parent4820ac0702e78857bcb5c9bca02f9c64f3f03a92 (diff)
Add bluetooth firmware used by porter ext01 board
-rw-r--r--common/recipes-support/ti-bt-firmware/ti-bt-firmware_git.bb22
-rw-r--r--common/recipes-support/ti-bt/files/0001-fix-poll-restart-after-fail.patch52
-rw-r--r--common/recipes-support/ti-bt/files/uim-sysfs36
-rw-r--r--common/recipes-support/ti-bt/ti-bt_git.bb32
4 files changed, 142 insertions, 0 deletions
diff --git a/common/recipes-support/ti-bt-firmware/ti-bt-firmware_git.bb b/common/recipes-support/ti-bt-firmware/ti-bt-firmware_git.bb
new file mode 100644
index 0000000..9fdcfff
--- /dev/null
+++ b/common/recipes-support/ti-bt-firmware/ti-bt-firmware_git.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Bluetooth firmare files for WL18xx combo modules"
+SECTION = "misc"
+
+LICENSE = "CLOSED"
+
+PE = "1"
+PV = "0.0"
+
+SRC_URI = "git://github.com/TI-ECS/bt-firmware.git;protocol=git "
+SRCREV = "169b2df5b968f0ede32ea9044859942fc220c435"
+
+S = "${WORKDIR}/git"
+
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}/lib/firmware/
+ cp *.bts ${D}/lib/firmware/
+}
+
+FILES_${PN} = "/lib/firmware/*" \ No newline at end of file
diff --git a/common/recipes-support/ti-bt/files/0001-fix-poll-restart-after-fail.patch b/common/recipes-support/ti-bt/files/0001-fix-poll-restart-after-fail.patch
new file mode 100644
index 0000000..829759b
--- /dev/null
+++ b/common/recipes-support/ti-bt/files/0001-fix-poll-restart-after-fail.patch
@@ -0,0 +1,52 @@
+From c4b8eca95c37d728c39c57811d975c50900605fd Mon Sep 17 00:00:00 2001
+From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+Date: Tue, 31 May 2016 19:50:27 +0300
+Subject: [PATCH] fix poll restart after fail
+
+also add some delay before starting speaking with BT
+
+Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+---
+ uim.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/uim.c b/uim.c
+index 6bde5ca..89bafd8 100644
+--- a/uim.c
++++ b/uim.c
+@@ -286,6 +286,8 @@ int st_uart_config(unsigned char install)
+
+ UIM_START_FUNC();
+
++ usleep(100 * 1000);
++
+ if (install == '1') {
+ memset(buf, 0, UART_DEV_NAME_LEN);
+ fd = open(DEV_NAME_SYSFS, O_RDONLY);
+@@ -375,6 +377,7 @@ int st_uart_config(unsigned char install)
+
+ /* Read the response for the Change speed command */
+ if (read_command_complete(dev_fd, HCI_HDR_OPCODE) < 0) {
++ tcflush(dev_fd, TCIOFLUSH);
+ close(dev_fd);
+ return -1;
+ }
+@@ -534,7 +537,6 @@ int main(int argc, char *argv[])
+ return -1;
+ }
+
+-RE_POLL:
+ /* read to start proper poll */
+ err = read(st_fd, &install, 1);
+ /* special case where bluetoothd starts before the UIM, and UIM
+@@ -547,6 +549,7 @@ RE_POLL:
+
+ UIM_DBG("begin polling...");
+
++RE_POLL:
+ memset(&p, 0, sizeof(p));
+ p.fd = st_fd;
+ p.events = POLLERR | POLLPRI;
+--
+1.7.10.4
+
diff --git a/common/recipes-support/ti-bt/files/uim-sysfs b/common/recipes-support/ti-bt/files/uim-sysfs
new file mode 100644
index 0000000..93c2cac
--- /dev/null
+++ b/common/recipes-support/ti-bt/files/uim-sysfs
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+uim="/usr/bin/uim"
+test -x "$uim" || exit 0
+
+case "$1" in
+ start)
+ echo -n "Starting uim-sysfs daemon"
+ modprobe st_drv
+ NODE=`cd /sys; find . | grep kim | grep install`
+ if [ $NODE ]
+ then
+ echo UIM SYSFS Node Found at /sys/$NODE
+ else
+ echo UIM SYSFS Node Not Found
+ rmmod st_drv
+ exit 0
+ fi
+ uim_args="-f `dirname /sys/$NODE`"
+ start-stop-daemon --start --quiet --pidfile /var/run/uim.pid --make-pidfile --exec $uim -- $uim_args &
+ modprobe btwilink
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping uim-sysfs daemon"
+ start-stop-daemon --stop --quiet --pidfile /var/run/uim.pid
+ rmmod btwilink
+ rmmod st_drv
+ echo "."
+ ;;
+ *)
+ echo "Usage: /etc/init.d/uim-sysfs {start|stop}"
+ exit 1
+esac
+
+exit 0
diff --git a/common/recipes-support/ti-bt/ti-bt_git.bb b/common/recipes-support/ti-bt/ti-bt_git.bb
new file mode 100644
index 0000000..7ce29f1
--- /dev/null
+++ b/common/recipes-support/ti-bt/ti-bt_git.bb
@@ -0,0 +1,32 @@
+SUMMARY = "UIM tool for WL18xx module"
+SECTION = "misc"
+
+LICENSE = "CLOSED"
+
+inherit update-rc.d
+INITSCRIPT_NAME="uim-sysfs"
+INITSCRIPT_PARAMS = "start 20 2 3 4 5 ."
+
+PR = "0+gitr${SRCPV}"
+PV = "0.1"
+
+SRC_URI = "git://git.ti.com/ti-bt/uim.git;protocol=git \
+ file://0001-fix-poll-restart-after-fail.patch \
+ file://uim-sysfs"
+SRCREV = "a75f45be2d5c74fc1dd913d08afc30f09a230aa9"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -d ${D}${sysconfdir}/init.d
+
+ install -m 0755 uim ${D}${bindir}/
+ install -m 0755 ${WORKDIR}/uim-sysfs ${D}${sysconfdir}/init.d
+
+ # Blacklist st_drv and btwilink to prevent modules autoload
+ # /etc/init.d/uim-sysfs will do the work with the proper parameters
+ install -d ${D}/${sysconfdir}/modprobe.d
+ echo "blacklist st_drv" > ${D}/${sysconfdir}/modprobe.d/ti_bt.conf
+ echo "blacklist btwilink" >> ${D}/${sysconfdir}/modprobe.d/ti_bt.conf
+} \ No newline at end of file