static int priority = -1;
static int rcvbuf = 0;
static int chan_policy = -1;
+static int bdaddr_type = 0;
struct lookup_table {
char *name;
{ NULL, 0 },
};
+static struct lookup_table bdaddr_types[] = {
+ { "bredr", BDADDR_BREDR },
+ { "le_public", BDADDR_LE_PUBLIC },
+ { "le_random", BDADDR_LE_RANDOM },
+ { NULL, 0 },
+};
+
static int get_lookup_flag(struct lookup_table *table, char *name)
{
int i;
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
str2ba(svr, &addr.l2_bdaddr);
+ addr.l2_bdaddr_type = bdaddr_type;
if (cid)
addr.l2_cid = htobs(cid);
else if (psm)
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
str2ba(svr, &addr.l2_bdaddr);
+ addr.l2_bdaddr_type = bdaddr_type;
if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0 ) {
perror("Can't connect socket");
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
str2ba(svr, &addr.l2_bdaddr);
+ addr.l2_bdaddr_type = bdaddr_type;
if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0 ) {
perror("Can't connect socket");
"\t[-E] request encryption\n"
"\t[-S] secure connection\n"
"\t[-M] become master\n"
- "\t[-T] enable timestamps\n");
+ "\t[-T] enable timestamps\n"
+ "\t[-V type] address type (help for list, default = bredr)\n");
}
int main(int argc, char *argv[])
bacpy(&bdaddr, BDADDR_ANY);
while ((opt = getopt(argc, argv, "rdscuwmntqxyzpb:a:"
- "i:P:I:O:J:B:N:L:W:C:D:X:F:Q:Z:Y:H:K:RUGAESMT")) != EOF) {
+ "i:P:I:O:J:B:N:L:W:C:D:X:F:Q:Z:Y:H:K:V:RUGAESMT")) != EOF) {
switch (opt) {
case 'r':
mode = RECV;
rcvbuf = atoi(optarg);
break;
+ case 'V':
+ bdaddr_type = get_lookup_flag(bdaddr_types, optarg);
+
+ if (bdaddr_type == -1) {
+ print_lookup_values(bdaddr_types,
+ "List Address types:");
+ exit(1);
+ }
+
+ break;
+
default:
usage();
exit(1);