You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/09/19 09:36:58 UTC

[GitHub] andrzej-kaczmarek closed pull request #170: [linux] allow setting of hci device id for socket.

andrzej-kaczmarek closed pull request #170: [linux] allow setting of hci device id for socket.
URL: https://github.com/apache/mynewt-nimble/pull/170
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/transport/socket/src/ble_hci_socket.c b/nimble/transport/socket/src/ble_hci_socket.c
index 296d0e91..f26c20b2 100644
--- a/nimble/transport/socket/src/ble_hci_socket.c
+++ b/nimble/transport/socket/src/ble_hci_socket.c
@@ -201,6 +201,12 @@ static struct ble_hci_sock_state {
     uint8_t rx_data[512];
 } ble_hci_sock_state;
 
+#if MYNEWT_VAL(BLE_SOCK_USE_TCP)
+static int s_ble_hci_device = MYNEWT_VAL(BLE_SOCK_TCP_PORT));
+#elif MYNEWT_VAL(BLE_SOCK_USE_LINUX_BLUE)
+static int s_ble_hci_device = MYNEWT_VAL(BLE_SOCK_LINUX_DEV);
+#endif
+
 /**
  * Allocates a buffer (mbuf) for ACL operation.
  *
@@ -454,7 +460,7 @@ ble_hci_sock_config(void)
 
     memset(&sin, 0, sizeof(sin));
     sin.sin_family = AF_INET;
-    sin.sin_port = htons(MYNEWT_VAL(BLE_SOCK_TCP_PORT));
+    sin.sin_port = htons(s_ble_hci_device);
     sin.sin_addr.s_addr = inet_addr("127.0.0.1");
 #ifdef MN_OSX
     sin.sin_len = sizeof(sin);
@@ -512,7 +518,7 @@ ble_hci_sock_config(void)
 
     memset(&shci, 0, sizeof(shci));
     shci.hci_family = AF_BLUETOOTH;
-    shci.hci_dev = MYNEWT_VAL(BLE_SOCK_LINUX_DEV);
+    shci.hci_dev = s_ble_hci_device;
     shci.hci_channel = HCI_CHANNEL_USER;
 
     if (ble_hci_sock_state.sock >= 0) {
@@ -804,6 +810,12 @@ ble_hci_sock_init_task(void)
 
 }
 
+void
+ble_hci_sock_set_device(int dev)
+{
+    s_ble_hci_device = dev;
+}
+
 /**
  * Initializes the UART HCI transport module.
  *


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services