Deleted Added
full compact
le.c (360316) le.c (361159)
1/*
2 * le.c
3 *
4 * Copyright (c) 2015 Takanori Watanabe <takawata@freebsd.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: hccontrol.c,v 1.5 2003/09/05 00:38:24 max Exp $
1/*
2 * le.c
3 *
4 * Copyright (c) 2015 Takanori Watanabe <takawata@freebsd.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: hccontrol.c,v 1.5 2003/09/05 00:38:24 max Exp $
29 * $FreeBSD: stable/11/usr.sbin/bluetooth/hccontrol/le.c 360316 2020-04-25 15:44:25Z emaste $
29 * $FreeBSD: stable/11/usr.sbin/bluetooth/hccontrol/le.c 361159 2020-05-18 08:46:53Z hselasky $
30 */
31
32#include <sys/types.h>
33#include <sys/ioctl.h>
34#include <sys/sysctl.h>
35#include <sys/select.h>
36#include <assert.h>
37#include <bitstring.h>

--- 182 unchanged lines hidden (view full) ---

220
221 return OK;
222}
223
224static int
225le_read_local_supported_features(int s, int argc ,char *argv[])
226{
227 ng_hci_le_read_local_supported_features_rp rp;
30 */
31
32#include <sys/types.h>
33#include <sys/ioctl.h>
34#include <sys/sysctl.h>
35#include <sys/select.h>
36#include <assert.h>
37#include <bitstring.h>

--- 182 unchanged lines hidden (view full) ---

220
221 return OK;
222}
223
224static int
225le_read_local_supported_features(int s, int argc ,char *argv[])
226{
227 ng_hci_le_read_local_supported_features_rp rp;
228 int e;
229 int n = sizeof(rp);
230
228 int n = sizeof(rp);
229
231 e = hci_simple_request(s,
230 union {
231 uint64_t raw;
232 uint8_t octets[8];
233 } le_features;
234
235 char buffer[2048];
236
237 if (hci_simple_request(s,
232 NG_HCI_OPCODE(NG_HCI_OGF_LE,
233 NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES),
238 NG_HCI_OPCODE(NG_HCI_OGF_LE,
239 NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES),
234 (void *)&rp, &n);
240 (void *)&rp, &n) == ERROR)
241 return (ERROR);
235
242
236 printf("LOCAL SUPPORTED: %d %d %jx\n", e, rp.status,
237 (uintmax_t) rp.le_features);
243 if (rp.status != 0x00) {
244 fprintf(stdout, "Status: %s [%#02x]\n",
245 hci_status2str(rp.status), rp.status);
246 return (FAILED);
247 }
238
248
239 return 0;
249 le_features.raw = rp.le_features;
250
251 fprintf(stdout, "LE Features: ");
252 for(int i = 0; i < 8; i++)
253 fprintf(stdout, " %#02x", le_features.octets[i]);
254 fprintf(stdout, "\n%s\n", hci_le_features2str(le_features.octets,
255 buffer, sizeof(buffer)));
256 fprintf(stdout, "\n");
257
258 return OK;
240}
241
242static int
243le_read_supported_status(int s, int argc, char *argv[])
244{
245 ng_hci_le_read_supported_status_rp rp;
246 int e;
247 int n = sizeof(rp);

--- 109 unchanged lines hidden ---
259}
260
261static int
262le_read_supported_status(int s, int argc, char *argv[])
263{
264 ng_hci_le_read_supported_status_rp rp;
265 int e;
266 int n = sizeof(rp);

--- 109 unchanged lines hidden ---