bthidcontrol.c (77814ea0002b19275e4cc6fb499f8113b50babbf) | bthidcontrol.c (6490c2ffabe2a6e5df2545d164f1c257e0d471de) |
---|---|
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 --- 35 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 | 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 --- 35 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 | 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 |
67 while ((opt = getopt(argc, argv, "a:c:H:hv")) != -1) { | 65 while ((opt = getopt(argc, argv, "a:c:H:h")) != -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 | 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 |
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" \ | 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" \ |
211" -v be verbose\n" \ | |
212" command one of the supported commands\n"); 213 exit(255); 214} /* usage */ 215 | 205" command one of the supported commands\n"); 206 exit(255); 207} /* usage */ 208 |