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 128080 2004-04-10 00:18:00Z emax $
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
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
65 while ((opt = getopt(argc, argv, "a:c:H:h")) != -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
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" \
205" command one of the supported commands\n");
206 exit(255);
207} /* usage */
208