Deleted Added
full compact
bthidcontrol.c (128080) bthidcontrol.c (163811)
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 $
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 128080 2004-04-10 00:18:00Z emax $
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
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
52/*
53 * bthidcontrol
54 */
55
56int
57main(int argc, char *argv[])
58{
59 bdaddr_t bdaddr;
60 int opt;
61
62 hid_init(NULL);
63 memcpy(&bdaddr, NG_HCI_BDADDR_ANY, sizeof(bdaddr));
64
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
65 while ((opt = getopt(argc, argv, "a:c:H:h")) != -1) {
67 while ((opt = getopt(argc, argv, "a:c:H:hv")) != -1) {
66 switch (opt) {
67 case 'a': /* bdaddr */
68 if (!bt_aton(optarg, &bdaddr)) {
69 struct hostent *he = NULL;
70
71 if ((he = bt_gethostbyname(optarg)) == NULL)
72 errx(1, "%s: %s", optarg, hstrerror(h_errno));
73

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

78 case 'c': /* config file */
79 config_file = optarg;
80 break;
81
82 case 'H': /* HIDs file */
83 hids_file = optarg;
84 break;
85
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
86 case 'h':
87 default:
88 usage();
89 /* NOT REACHED */
90 }
91 }
92
93 argc -= optind;

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

197{
198 fprintf(stderr,
199"Usage: bthidcontrol options command\n" \
200"Where options are:\n"
201" -a bdaddr specify bdaddr\n" \
202" -c file specify path to the bthidd config file\n" \
203" -H file specify path to the bthidd HIDs file\n" \
204" -h display usage and quit\n" \
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" \
205" command one of the supported commands\n");
206 exit(255);
207} /* usage */
208
212" command one of the supported commands\n");
213 exit(255);
214} /* usage */
215