From 9de050b14219fc101cb65c4c6e28ae13ad01f933 Mon Sep 17 00:00:00 2001 From: markus Date: Tue, 31 Oct 2006 00:26:58 +0000 Subject: - Add a 'verbose' switch -v - Only dump items that are being used for padding when being verbose. This brings bthidcontrol in line with the behaviour of usbhidctl(1). - Update the manpage accordingly Approved by: emax --- usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 | 5 ++++- usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c | 9 ++++++++- usr.sbin/bluetooth/bthidcontrol/hid.c | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'usr.sbin/bluetooth/bthidcontrol') diff --git a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 index 4f0cdc8..7625b39 100644 --- a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 +++ b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 @@ -25,7 +25,7 @@ .\" $Id: bthidcontrol.8,v 1.1 2004/02/13 21:44:41 max Exp $ .\" $FreeBSD$ .\" -.Dd February 13, 2004 +.Dd October 30, 2006 .Dt BTHIDCONTROL 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Op Fl a Ar BD_ADDR .Op Fl c Ar file .Op Fl H Ar file +.Op Fl v .Ar command .Sh DESCRIPTION The @@ -67,6 +68,8 @@ The default path is .Pa /var/db/bthidd.hids . .It Fl h Display usage message and exit. +.It Fl v +Be verbose and show items that are being used for padding. .It Ar command One of the supported commands (see below). Special command diff --git a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c index 21539e3..900bda5 100644 --- a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c +++ b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c @@ -49,6 +49,8 @@ static void usage(void); int32_t hid_sdp_query(bdaddr_t const *local, bdaddr_t const *remote, int32_t *error); +uint32_t verbose = 0; + /* * bthidcontrol */ @@ -62,7 +64,7 @@ main(int argc, char *argv[]) hid_init(NULL); memcpy(&bdaddr, NG_HCI_BDADDR_ANY, sizeof(bdaddr)); - while ((opt = getopt(argc, argv, "a:c:H:h")) != -1) { + while ((opt = getopt(argc, argv, "a:c:H:hv")) != -1) { switch (opt) { case 'a': /* bdaddr */ if (!bt_aton(optarg, &bdaddr)) { @@ -83,6 +85,10 @@ main(int argc, char *argv[]) hids_file = optarg; break; + case 'v': /* verbose */ + verbose++; + break; + case 'h': default: usage(); @@ -202,6 +208,7 @@ usage(void) " -c file specify path to the bthidd config file\n" \ " -H file specify path to the bthidd HIDs file\n" \ " -h display usage and quit\n" \ +" -v be verbose\n" \ " command one of the supported commands\n"); exit(255); } /* usage */ diff --git a/usr.sbin/bluetooth/bthidcontrol/hid.c b/usr.sbin/bluetooth/bthidcontrol/hid.c index 78b4105..9fb6220 100644 --- a/usr.sbin/bluetooth/bthidcontrol/hid.c +++ b/usr.sbin/bluetooth/bthidcontrol/hid.c @@ -39,6 +39,8 @@ #include "bthid_config.h" #include "bthidcontrol.h" +extern uint32_t verbose; + static void hid_dump_descriptor (report_desc_t r); static void hid_dump_item (char const *label, struct hid_item *h); @@ -153,6 +155,9 @@ hid_dump_descriptor(report_desc_t r) static void hid_dump_item(char const *label, struct hid_item *h) { + if ((h->flags & HIO_CONST) && !verbose) + return; + fprintf(stdout, "%s id=%u size=%u count=%u page=%s usage=%s%s%s%s%s%s%s%s%s%s", label, (uint8_t) h->report_ID, h->report_size, h->report_count, -- cgit v1.1