Deleted Added
sdiff udiff text old ( 128080 ) new ( 163811 )
full compact
1/*
2 * bthidcontrol.c
3 *
4 * Copyright (c) 2004 Maksim Yevmenkin <m_evmenkin@yahoo.com>
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: bthidcontrol.c,v 1.2 2004/02/13 21:44:41 max Exp $
29 * $FreeBSD: head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c 163811 2006-10-31 00:26:58Z markus $
30 */
31
32#include <sys/queue.h>
33#include <assert.h>
34#include <bluetooth.h>
35#include <err.h>
36#include <errno.h>
37#include <stdio.h>

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

44
45static int do_bthid_command(bdaddr_p bdaddr, int argc, char **argv);
46static struct bthid_command * find_bthid_command(char const *command, struct bthid_command *category);
47static void print_bthid_command(struct bthid_command *category);
48static void usage(void);
49
50int32_t hid_sdp_query(bdaddr_t const *local, bdaddr_t const *remote, int32_t *error);
51
52uint32_t verbose = 0;
53
54/*
55 * bthidcontrol
56 */
57
58int
59main(int argc, char *argv[])
60{
61 bdaddr_t bdaddr;
62 int opt;
63
64 hid_init(NULL);
65 memcpy(&bdaddr, NG_HCI_BDADDR_ANY, sizeof(bdaddr));
66
67 while ((opt = getopt(argc, argv, "a:c:H:hv")) != -1) {
68 switch (opt) {
69 case 'a': /* bdaddr */
70 if (!bt_aton(optarg, &bdaddr)) {
71 struct hostent *he = NULL;
72
73 if ((he = bt_gethostbyname(optarg)) == NULL)
74 errx(1, "%s: %s", optarg, hstrerror(h_errno));
75

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

80 case 'c': /* config file */
81 config_file = optarg;
82 break;
83
84 case 'H': /* HIDs file */
85 hids_file = optarg;
86 break;
87
88 case 'v': /* verbose */
89 verbose++;
90 break;
91
92 case 'h':
93 default:
94 usage();
95 /* NOT REACHED */
96 }
97 }
98
99 argc -= optind;

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

203{
204 fprintf(stderr,
205"Usage: bthidcontrol options command\n" \
206"Where options are:\n"
207" -a bdaddr specify bdaddr\n" \
208" -c file specify path to the bthidd config file\n" \
209" -H file specify path to the bthidd HIDs file\n" \
210" -h display usage and quit\n" \
211" -v be verbose\n" \
212" command one of the supported commands\n");
213 exit(255);
214} /* usage */
215