- 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
This commit is contained in:
Markus Brueffer 2006-10-31 00:26:58 +00:00
parent c3248b4002
commit 77814ea000
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163811
3 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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,