Skip to content

Instantly share code, notes, and snippets.

@pawitp
Created April 18, 2013 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pawitp/5411720 to your computer and use it in GitHub Desktop.
Save pawitp/5411720 to your computer and use it in GitHub Desktop.
From 1e15efe8b70865b1006c1911daa2743e077da6cf Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Wed, 17 Apr 2013 13:49:01 +0700
Subject: [PATCH] libbt: switch to N_BRCM_HCI line disclipline for userial ioctl
Change-Id: I47ea7d535ab5fba976efb7d65f6dcecc64a603b1
---
libbt/src/userial_vendor.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/libbt/src/userial_vendor.c b/libbt/src/userial_vendor.c
index 1a745b5..43d1889 100755
--- a/libbt/src/userial_vendor.c
+++ b/libbt/src/userial_vendor.c
@@ -182,6 +182,10 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg)
uint16_t parity;
uint8_t stop_bits;
+#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
+ int ldisc;
+#endif
+
vnd_userial.fd = -1;
if (!userial_to_tcio_baud(p_cfg->baud, &baud))
@@ -251,6 +255,13 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg)
tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios);
#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
+ // TODO: check for breakage on tuna (Galaxy Nexus). It defines this,
+ // but does not contain the kernel code to support it.
+
+ // Switch to N_BRCM_HCI line disclipline for ioctl to work
+ ldisc = 25; // N_BRCM_HCI
+ ioctl(vnd_userial.fd, TIOCSETD, &ldisc);
+
userial_ioctl_init_bt_wake(vnd_userial.fd);
#endif
--
1.7.3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment