2 * This file is part of the libsigrok project.
4 * Copyright (C) 2018-2019 Gerhard Sittig <gerhard.sittig@gmx.net>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <libsigrok/libsigrok.h>
23 #include "libsigrok-internal.h"
27 #define LOG_PREFIX "serial-bt"
29 #ifdef HAVE_SERIAL_COMM
32 #define SER_BT_CONN_PREFIX "bt"
33 #define SER_BT_CHUNK_SIZE 1200
35 #define SER_BT_PARAM_PREFIX_CHANNEL "channel="
36 #define SER_BT_PARAM_PREFIX_HDL_RX "handle_rx="
37 #define SER_BT_PARAM_PREFIX_HDL_TX "handle_tx="
38 #define SER_BT_PARAM_PREFIX_HDL_CCCD "handle_cccd="
39 #define SER_BT_PARAM_PREFIX_VAL_CCCD "value_cccd="
40 #define SER_BT_PARAM_PREFIX_BLE_MTU "mtu="
45 * Serial port handling, wraps the external BT/BLE dependencies.
49 * @defgroup grp_serial_bt Serial port handling, BT/BLE group
51 * Make serial-over-BT communication appear like a regular serial port.
56 /* {{{ support for serial-over-BT channels */
59 * This builtin database of known devices (keyed by their names as
60 * provided during BT/BLE scans) can help improve the presentation of
61 * scan results. Ideally users could take the output and pass it to
62 * subsequent program invocations, not having to "come up with" the
63 * conn= spec, or only having to touch it up minimally. GUI dialogs
64 * could present scan results such that users just need to pick an
65 * item to open a connection.
67 * The current implementation guesses connection types from device
68 * names, and optionally amends them with additional parameters if
69 * experience shows that individual devices need these extra specs.
71 * This database may have to move to a separate source file should
72 * its size grow to amounts that are considered inappropriate here
73 * in the serial transport's BT dispatcher. For now the item count
77 static const struct scan_supported_item {
79 enum ser_bt_conn_t type;
80 const char *add_params;
81 } scan_supported_items[] = {
82 { "121GW", SER_BT_CONN_BLE122, NULL, },
83 { "Adafruit Bluefruit LE 8134", SER_BT_CONN_NRF51, NULL, },
84 { "DL24M_BLE", SER_BT_CONN_AC6328, NULL, },
85 { "DL24M_SPP", SER_BT_CONN_RFCOMM, "/channel=2", },
86 { "HC-05", SER_BT_CONN_RFCOMM, NULL, },
87 { "UC96_BLE", SER_BT_CONN_AC6328, NULL, },
88 { "UC96_SPP", SER_BT_CONN_RFCOMM, "/channel=2", },
89 { "UM25C", SER_BT_CONN_RFCOMM, NULL, },
90 { NULL, SER_BT_CONN_UNKNOWN, NULL, },
93 static const struct scan_supported_item *scan_is_supported(const char *name)
96 const struct scan_supported_item *item;
98 for (idx = 0; idx < ARRAY_SIZE(scan_supported_items); idx++) {
99 item = &scan_supported_items[idx];
102 if (strcmp(name, item->name) != 0)
110 static const char *ser_bt_conn_names[SER_BT_CONN_MAX] = {
111 [SER_BT_CONN_UNKNOWN] = "<type>",
112 [SER_BT_CONN_RFCOMM] = "rfcomm",
113 [SER_BT_CONN_BLE122] = "ble122",
114 [SER_BT_CONN_NRF51] = "nrf51",
115 [SER_BT_CONN_CC254x] = "cc254x",
116 [SER_BT_CONN_AC6328] = "ac6328",
119 static enum ser_bt_conn_t lookup_conn_name(const char *name)
125 return SER_BT_CONN_UNKNOWN;
126 idx = ARRAY_SIZE(ser_bt_conn_names);
128 item = ser_bt_conn_names[idx];
129 if (strcmp(item, name) == 0)
133 return SER_BT_CONN_UNKNOWN;
136 static const char *conn_name_text(enum ser_bt_conn_t type)
138 if (type >= ARRAY_SIZE(ser_bt_conn_names))
139 type = SER_BT_CONN_UNKNOWN;
141 return ser_bt_conn_names[type];
145 * Parse conn= specs for serial over Bluetooth communication.
147 * @param[in] serial The serial port that is about to get opened.
148 * @param[in] spec The caller provided conn= specification.
149 * @param[out] conn_type The type of BT comm (BT RFCOMM, BLE notify).
150 * @param[out] remote_addr The remote device address.
151 * @param[out] rfcomm_channel The RFCOMM channel (if applicable).
152 * @param[out] read_hdl The BLE notify read handle (if applicable).
153 * @param[out] write_hdl The BLE notify write handle (if applicable).
154 * @param[out] cccd_hdl The BLE notify CCCD handle (if applicable).
155 * @param[out] cccd_val The BLE notify CCCD value (if applicable).
157 * @return 0 upon success, non-zero upon failure.
159 * Summary of parsing rules as they are implemented:
160 * - Implementor's note: Automatic scan for available devices is not
161 * yet implemented. So strictly speaking some parts of the input
162 * spec are optional, but fallbacks may not take effect ATM.
163 * - Insist on the "bt" prefix. Accept "bt" alone without any other
165 * - The first field that follows is the connection type. Supported
166 * types are 'rfcomm', 'ble122', 'cc254x', and potentially others
167 * in a future implementation.
168 * - The next field is the remote device's address, either separated
169 * by colons or dashes or spaces, or not separated at all.
170 * - Other parameters (RFCOMM channel, notify handles and write values)
171 * get derived from the connection type.
172 * - More fields after the remote address are options which override
173 * builtin defaults (RFCOMM channels, BLE handles, etc).
175 * Supported formats resulting from these rules:
176 * bt/<conn>/<addr>[/<param>]...
179 * bt/rfcomm/11-22-33-44-55-66
180 * bt/rfcomm/11-22-33-44-55-66/channel=2
181 * bt/ble122/88:6b:12:34:56:78
182 * bt/cc254x/0123456789ab
184 * It's assumed that users easily can create those conn= specs from
185 * available information, or that scan routines will create such specs
186 * that copy'n'paste results (or GUI choices from previous scan results)
187 * can get processed here.
189 static int ser_bt_parse_conn_spec(
190 struct sr_serial_dev_inst *serial, const char *spec,
191 enum ser_bt_conn_t *conn_type, const char **remote_addr,
192 size_t *rfcomm_channel,
193 uint16_t *read_hdl, uint16_t *write_hdl,
194 uint16_t *cccd_hdl, uint16_t *cccd_val,
197 char **fields, *field;
198 enum ser_bt_conn_t type;
201 size_t fields_count, field_idx;
203 unsigned long parm_val;
206 *conn_type = SER_BT_CONN_UNKNOWN;
222 if (!serial || !spec || !spec[0])
225 /* Evaluate the mandatory first three fields. */
226 fields = g_strsplit_set(spec, "/", 0);
229 if (g_strv_length(fields) < 3) {
234 if (strcmp(field, SER_BT_CONN_PREFIX) != 0) {
239 type = lookup_conn_name(field);
247 if (!field || !*field) {
251 addr = g_strdup(field);
255 /* Derive default parameters that match the connection type. */
256 /* TODO Lookup defaults from a table? */
258 case SER_BT_CONN_RFCOMM:
262 case SER_BT_CONN_BLE122:
272 case SER_BT_CONN_NRF51:
274 * Are these values appropriate? Check the learn article at
275 * https://learn.adafruit.com/introducing-the-adafruit-bluefruit-le-uart-friend?view=all
285 /* TODO 'random' type, sec-level=high */
287 case SER_BT_CONN_CC254x:
288 /* TODO Are these values appropriate? Just guessing here. */
298 case SER_BT_CONN_AC6328:
313 * Preset a successful return value for the conn= parse call.
314 * Scan optional additional fields which specify more params.
315 * Update the defaults which were setup above. Pessimize the
316 * routine's return value in error paths.
319 fields_count = g_strv_length(fields);
320 for (field_idx = 3; field_idx < fields_count; field_idx++) {
321 field = fields[field_idx];
322 if (!field || !*field)
324 if (g_str_has_prefix(field, SER_BT_PARAM_PREFIX_CHANNEL)) {
325 field += strlen(SER_BT_PARAM_PREFIX_CHANNEL);
327 ret = sr_atoul_base(field, &parm_val, &endp, 0);
328 if (ret != SR_OK || !endp || *endp != '\0') {
329 ret_parse = SR_ERR_ARG;
333 *rfcomm_channel = parm_val;
336 if (g_str_has_prefix(field, SER_BT_PARAM_PREFIX_HDL_RX)) {
337 field += strlen(SER_BT_PARAM_PREFIX_HDL_RX);
339 ret = sr_atoul_base(field, &parm_val, &endp, 0);
340 if (ret != SR_OK || !endp || *endp != '\0') {
341 ret_parse = SR_ERR_ARG;
345 *read_hdl = parm_val;
348 if (g_str_has_prefix(field, SER_BT_PARAM_PREFIX_HDL_TX)) {
349 field += strlen(SER_BT_PARAM_PREFIX_HDL_TX);
351 ret = sr_atoul_base(field, &parm_val, &endp, 0);
352 if (ret != SR_OK || !endp || *endp != '\0') {
353 ret_parse = SR_ERR_ARG;
357 *write_hdl = parm_val;
360 if (g_str_has_prefix(field, SER_BT_PARAM_PREFIX_HDL_CCCD)) {
361 field += strlen(SER_BT_PARAM_PREFIX_HDL_CCCD);
363 ret = sr_atoul_base(field, &parm_val, &endp, 0);
364 if (ret != SR_OK || !endp || *endp != '\0') {
365 ret_parse = SR_ERR_ARG;
369 *cccd_hdl = parm_val;
372 if (g_str_has_prefix(field, SER_BT_PARAM_PREFIX_VAL_CCCD)) {
373 field += strlen(SER_BT_PARAM_PREFIX_VAL_CCCD);
375 ret = sr_atoul_base(field, &parm_val, &endp, 0);
376 if (ret != SR_OK || !endp || *endp != '\0') {
377 ret_parse = SR_ERR_ARG;
381 *cccd_val = parm_val;
384 if (g_str_has_prefix(field, SER_BT_PARAM_PREFIX_BLE_MTU)) {
385 field += strlen(SER_BT_PARAM_PREFIX_BLE_MTU);
387 ret = sr_atoul_base(field, &parm_val, &endp, 0);
388 if (ret != SR_OK || !endp || *endp != '\0') {
389 ret_parse = SR_ERR_ARG;
403 static void ser_bt_mask_databits(struct sr_serial_dev_inst *serial,
404 uint8_t *data, size_t len)
410 if ((serial->comm_params.data_bits % 8) == 0)
413 mask32 = (1UL << serial->comm_params.data_bits) - 1;
414 mask = mask32 & 0xff;
415 for (idx = 0; idx < len; idx++)
419 static int ser_bt_data_cb(void *cb_data, uint8_t *data, size_t dlen)
421 struct sr_serial_dev_inst *serial;
432 ser_bt_mask_databits(serial, data, dlen);
433 sr_ser_queue_rx_data(serial, data, dlen);
439 /* {{{ wrap serial-over-BT operations in a common serial.c API */
441 /* See if a serial port's name refers to a BT type. */
442 SR_PRIV int ser_name_is_bt(struct sr_serial_dev_inst *serial)
449 if (!serial->port || !*serial->port)
452 /* Accept either "bt" alone, or "bt/" as a prefix. */
453 if (!g_str_has_prefix(serial->port, SER_BT_CONN_PREFIX))
455 off = strlen(SER_BT_CONN_PREFIX);
456 sep = serial->port[off];
457 if (sep != '\0' && sep != '/')
463 /* The open() wrapper for BT ports. */
464 static int ser_bt_open(struct sr_serial_dev_inst *serial, int flags)
466 enum ser_bt_conn_t conn_type;
467 const char *remote_addr;
468 size_t rfcomm_channel;
469 uint16_t read_hdl, write_hdl, cccd_hdl, cccd_val;
472 struct sr_bt_desc *desc;
476 /* Derive BT specific parameters from the port spec. */
477 rc = ser_bt_parse_conn_spec(serial, serial->port,
478 &conn_type, &remote_addr,
480 &read_hdl, &write_hdl,
481 &cccd_hdl, &cccd_val,
486 if (!conn_type || !remote_addr || !remote_addr[0]) {
487 /* TODO Auto-search for available connections? */
491 /* Create the connection. Only store params after successful use. */
492 desc = sr_bt_desc_new();
495 serial->bt_desc = desc;
496 rc = sr_bt_config_addr_remote(desc, remote_addr);
499 serial->bt_addr_remote = g_strdup(remote_addr);
501 case SER_BT_CONN_RFCOMM:
502 rc = sr_bt_config_rfcomm(desc, rfcomm_channel);
505 serial->bt_rfcomm_channel = rfcomm_channel;
507 case SER_BT_CONN_BLE122:
508 case SER_BT_CONN_NRF51:
509 case SER_BT_CONN_CC254x:
510 case SER_BT_CONN_AC6328:
511 rc = sr_bt_config_notify(desc,
512 read_hdl, write_hdl, cccd_hdl, cccd_val,
516 serial->bt_notify_handle_read = read_hdl;
517 serial->bt_notify_handle_write = write_hdl;
518 serial->bt_notify_handle_cccd = cccd_hdl;
519 serial->bt_notify_value_cccd = cccd_val;
520 serial->bt_ble_mtu = ble_mtu;
523 /* Unsupported type, or incomplete implementation. */
526 serial->bt_conn_type = conn_type;
528 /* Make sure the receive buffer can accept input data. */
529 if (!serial->rcv_buffer)
530 serial->rcv_buffer = g_string_sized_new(SER_BT_CHUNK_SIZE);
531 rc = sr_bt_config_cb_data(desc, ser_bt_data_cb, serial);
535 /* Open the connection. */
537 case SER_BT_CONN_RFCOMM:
538 rc = sr_bt_connect_rfcomm(desc);
542 case SER_BT_CONN_BLE122:
543 case SER_BT_CONN_NRF51:
544 case SER_BT_CONN_CC254x:
545 case SER_BT_CONN_AC6328:
546 rc = sr_bt_connect_ble(desc);
549 rc = sr_bt_start_notify(desc);
560 static int ser_bt_close(struct sr_serial_dev_inst *serial)
565 if (!serial->bt_desc)
568 sr_bt_disconnect(serial->bt_desc);
569 sr_bt_desc_free(serial->bt_desc);
570 serial->bt_desc = NULL;
572 g_free(serial->bt_addr_local);
573 serial->bt_addr_local = NULL;
574 g_free(serial->bt_addr_remote);
575 serial->bt_addr_remote = NULL;
576 g_slist_free_full(serial->bt_source_args, g_free);
577 serial->bt_source_args = NULL;
582 /* Flush, discards pending RX data, empties buffers. */
583 static int ser_bt_flush(struct sr_serial_dev_inst *serial)
591 /* Drain, waits for completion of pending TX data. */
592 static int ser_bt_drain(struct sr_serial_dev_inst *serial)
595 /* EMPTY */ /* TODO? */
600 static int ser_bt_write(struct sr_serial_dev_inst *serial,
601 const void *buf, size_t count,
602 int nonblocking, unsigned int timeout_ms)
607 * TODO Support chunked transmission when callers' requests
608 * exceed the BT channel's capacity? See ser_hid_write().
611 switch (serial->bt_conn_type) {
612 case SER_BT_CONN_RFCOMM:
615 wrlen = sr_bt_write(serial->bt_desc, buf, count);
619 case SER_BT_CONN_BLE122:
620 case SER_BT_CONN_NRF51:
621 case SER_BT_CONN_CC254x:
622 case SER_BT_CONN_AC6328:
624 * Assume that when applications call the serial layer's
625 * write routine, then the BLE chip/module does support
626 * a TX handle. Just call the serial-BT library's write
631 wrlen = sr_bt_write(serial->bt_desc, buf, count);
641 static int ser_bt_read(struct sr_serial_dev_inst *serial,
642 void *buf, size_t count,
643 int nonblocking, unsigned int timeout_ms)
645 gint64 deadline_us, now_us;
646 uint8_t buffer[SER_BT_CHUNK_SIZE];
652 * Immediately satisfy the caller's request from the RX buffer
653 * if the requested amount of data is available already.
655 if (sr_ser_has_queued_data(serial) >= count)
656 return sr_ser_unqueue_rx_data(serial, buf, count);
659 * When a timeout was specified, then determine the deadline
660 * where to stop reception.
664 now_us = g_get_monotonic_time();
665 deadline_us = now_us + timeout_ms * 1000;
669 * Keep receiving from the port until the caller's requested
670 * amount of data has become available, or the timeout has
671 * expired. In the absence of a timeout, stop reading when an
672 * attempt no longer yields receive data.
675 /* Run another attempt to receive data. */
676 switch (serial->bt_conn_type) {
677 case SER_BT_CONN_RFCOMM:
678 rdlen = sr_bt_read(serial->bt_desc, buffer, sizeof(buffer));
681 rc = ser_bt_data_cb(serial, buffer, rdlen);
685 case SER_BT_CONN_BLE122:
686 case SER_BT_CONN_NRF51:
687 case SER_BT_CONN_CC254x:
688 case SER_BT_CONN_AC6328:
689 dlen = sr_ser_has_queued_data(serial);
690 rc = sr_bt_check_notify(serial->bt_desc);
693 else if (sr_ser_has_queued_data(serial) != dlen)
704 * Stop upon receive errors, or timeout expiration. Only
705 * stop upon empty reception in the absence of a timeout.
709 if (nonblocking && !rdlen)
712 now_us = g_get_monotonic_time();
713 if (now_us > deadline_us)
717 /* Also stop when sufficient data has become available. */
718 if (sr_ser_has_queued_data(serial) >= count)
723 * Satisfy the caller's demand for receive data from previously
724 * queued incoming data.
726 dlen = sr_ser_has_queued_data(serial);
732 return sr_ser_unqueue_rx_data(serial, buf, dlen);
735 struct bt_source_args_t {
736 /* The application callback. */
737 sr_receive_data_callback cb;
739 /* The serial device, to store RX data. */
740 struct sr_serial_dev_inst *serial;
744 * Gets periodically invoked by the glib main loop. "Drives" (checks)
745 * progress of BT communication, and invokes the application's callback
746 * which processes RX data (when some has become available), as well as
747 * handles application level timeouts.
749 static int bt_source_cb(int fd, int revents, void *cb_data)
751 struct bt_source_args_t *args;
752 struct sr_serial_dev_inst *serial;
753 uint8_t rx_buf[SER_BT_CHUNK_SIZE];
761 serial = args->serial;
764 if (!serial->bt_conn_type)
768 * Drain receive data which the channel might have pending.
769 * This is "a copy" of the "background part" of ser_bt_read(),
770 * without the timeout support code, and not knowing how much
771 * data the application is expecting.
774 switch (serial->bt_conn_type) {
775 case SER_BT_CONN_RFCOMM:
776 rdlen = sr_bt_read(serial->bt_desc, rx_buf, sizeof(rx_buf));
779 rc = ser_bt_data_cb(serial, rx_buf, rdlen);
783 case SER_BT_CONN_BLE122:
784 case SER_BT_CONN_NRF51:
785 case SER_BT_CONN_CC254x:
786 case SER_BT_CONN_AC6328:
787 dlen = sr_ser_has_queued_data(serial);
788 rc = sr_bt_check_notify(serial->bt_desc);
791 else if (sr_ser_has_queued_data(serial) != dlen)
803 * When RX data became available (now or earlier), pass this
804 * condition to the application callback. Always periodically
805 * run the application callback, since it handles timeouts and
806 * might carry out other tasks as well like signalling progress.
808 if (sr_ser_has_queued_data(args->serial))
810 rc = args->cb(fd, revents, args->cb_data);
815 /* TODO Can we use the Bluetooth socket's file descriptor? Probably not portably. */
816 #define WITH_MAXIMUM_TIMEOUT_VALUE 0
817 static int ser_bt_setup_source_add(struct sr_session *session,
818 struct sr_serial_dev_inst *serial,
819 int events, int timeout,
820 sr_receive_data_callback cb, void *cb_data)
822 struct bt_source_args_t *args;
827 /* Optionally enforce a minimum poll period. */
828 if (WITH_MAXIMUM_TIMEOUT_VALUE && timeout > WITH_MAXIMUM_TIMEOUT_VALUE)
829 timeout = WITH_MAXIMUM_TIMEOUT_VALUE;
831 /* Allocate status container for background data reception. */
832 args = g_malloc0(sizeof(*args));
834 args->cb_data = cb_data;
835 args->serial = serial;
838 * Have a periodic timer installed. Register the allocated block
839 * with the serial device, since the GSource's finalizer won't
840 * free the memory, and we haven't bothered to create a custom
841 * BT specific GSource.
843 rc = sr_session_source_add(session, -1, events, timeout, bt_source_cb, args);
848 serial->bt_source_args = g_slist_append(serial->bt_source_args, args);
853 static int ser_bt_setup_source_remove(struct sr_session *session,
854 struct sr_serial_dev_inst *serial)
858 (void)sr_session_source_remove(session, -1);
859 /* Release callback args here already? */
864 struct bt_scan_args_t {
866 sr_ser_list_append_t append;
871 static void scan_cb(void *cb_args, const char *addr, const char *name)
873 struct bt_scan_args_t *scan_args;
876 const struct scan_supported_item *item;
877 enum ser_bt_conn_t type;
878 char *port_name, *port_desc;
884 sr_info("BT scan, found: %s - %s\n", addr, name);
886 /* Check whether the device was seen before. */
887 for (l = scan_args->addr_list; l; l = l->next) {
888 if (strcmp(addr, l->data) == 0)
892 /* Substitute colons in the address by dashes. */
895 snprintf(addr_text, sizeof(addr_text), "%s", addr);
896 g_strcanon(addr_text, "0123456789abcdefABCDEF", '-');
898 /* Create a port name, and a description. */
899 item = scan_is_supported(name);
900 type = item ? item->type : SER_BT_CONN_UNKNOWN;
901 port_name = g_strdup_printf("%s/%s/%s%s",
902 SER_BT_CONN_PREFIX, conn_name_text(type), addr_text,
903 (item && item->add_params) ? item->add_params : "");
904 port_desc = g_strdup_printf("%s (%s)", name, scan_args->bt_type);
906 scan_args->port_list = scan_args->append(scan_args->port_list, port_name, port_desc);
910 /* Keep track of the handled address. */
911 addr_copy = g_strdup(addr);
912 scan_args->addr_list = g_slist_append(scan_args->addr_list, addr_copy);
915 static GSList *ser_bt_list(GSList *list, sr_ser_list_append_t append)
917 static const int scan_duration = 3;
919 struct bt_scan_args_t scan_args;
920 struct sr_bt_desc *desc;
923 * Implementor's note: This "list" routine is best-effort. We
924 * assume that registering callbacks always succeeds. Silently
925 * ignore failure to scan for devices. Just return those which
929 desc = sr_bt_desc_new();
933 memset(&scan_args, 0, sizeof(scan_args));
934 scan_args.port_list = list;
935 scan_args.append = append;
937 scan_args.addr_list = NULL;
938 scan_args.bt_type = "BT";
939 (void)sr_bt_config_cb_scan(desc, scan_cb, &scan_args);
940 (void)sr_bt_scan_bt(desc, scan_duration);
941 g_slist_free_full(scan_args.addr_list, g_free);
943 scan_args.addr_list = NULL;
944 scan_args.bt_type = "BLE";
945 (void)sr_bt_config_cb_scan(desc, scan_cb, &scan_args);
946 (void)sr_bt_scan_le(desc, scan_duration);
947 g_slist_free_full(scan_args.addr_list, g_free);
949 sr_bt_desc_free(desc);
951 return scan_args.port_list;
954 static struct ser_lib_functions serlib_bt = {
956 .close = ser_bt_close,
957 .flush = ser_bt_flush,
958 .drain = ser_bt_drain,
959 .write = ser_bt_write,
962 * Bluetooth communication has no concept of bitrate, so ignore
963 * these arguments silently. Neither need we pass the frame format
964 * down to internal BT comm routines, nor need we keep the values
965 * here, since the caller will cache/register them already.
967 .set_params = std_dummy_set_params,
968 .set_handshake = std_dummy_set_handshake,
969 .setup_source_add = ser_bt_setup_source_add,
970 .setup_source_remove = ser_bt_setup_source_remove,
972 .get_frame_format = NULL,
974 SR_PRIV struct ser_lib_functions *ser_lib_funcs_bt = &serlib_bt;
979 SR_PRIV int ser_name_is_bt(struct sr_serial_dev_inst *serial)
986 SR_PRIV struct ser_lib_functions *ser_lib_funcs_bt = NULL;