- Timestamp:
- 06/01/07 17:13:54 (18 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
apps/obexftp.c (modified) (6 diffs)
-
obexftp/client.c (modified) (4 diffs)
-
obexftp/client.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/apps/obexftp.c
r143 r146 229 229 230 230 /*@only@*/ /*@null@*/ static obexftp_client_t *cli = NULL; 231 static const char *src_dev = NULL; 231 232 #ifdef HAVE_BLUETOOTH 232 233 static int transport = OBEX_TRANS_BLUETOOTH; … … 266 267 267 268 /* Connect */ 268 if (obexftp_connect_ uuid (cli, device, channel, uuid, uuid_len) >= 0)269 if (obexftp_connect_src (cli, src_dev, device, channel, uuid, uuid_len) >= 0) 269 270 return TRUE; 270 271 fprintf(stderr, "Still trying to connect\n"); … … 441 442 #ifdef HAVE_BLUETOOTH 442 443 {"bluetooth", optional_argument, NULL, 'b'}, 444 {"channel", required_argument, NULL, 'B'}, 445 {"hci", required_argument, NULL, 'd'}, 443 446 #endif 444 {"channel", required_argument, NULL, 'B'},445 447 #ifdef HAVE_USB 446 448 {"usb", optional_argument, NULL, 'u'}, … … 470 472 }; 471 473 472 c = getopt_long (argc, argv, "-ib::B: u::t:n:U::HSL::l::c:C:f:o:g:G:p:k:XYxm:VvhN:FP",474 c = getopt_long (argc, argv, "-ib::B:d:u::t:n:U::HSL::l::c:C:f:o:g:G:p:k:XYxm:VvhN:FP", 473 475 long_options, &option_index); 474 476 if (c == -1) … … 499 501 case 'B': 500 502 channel = atoi(optarg); 503 break; 504 505 case 'd': 506 src_dev = optarg; 501 507 break; 502 508 #endif /* HAVE_BLUETOOTH */ … … 716 722 " -b, --bluetooth [<device>] use or search a bluetooth device\n" 717 723 " [ -B, --channel <number> ] use this bluetooth channel when connecting\n" 724 " [ -d, --hci <no/address> ] use source device with this address or number\n" 718 725 #endif 719 726 #ifdef HAVE_USB -
trunk/obexftp/client.c
r142 r146 53 53 #include <bluetooth/bluetooth.h> 54 54 #include <bluetooth/rfcomm.h> 55 #include <bluetooth/hci.h> 56 #include <bluetooth/hci_lib.h> 55 57 #endif /* __FreeBSD__ */ 56 58 #endif … … 504 506 int obexftp_connect_uuid(obexftp_client_t *cli, const char *device, int port, const uint8_t uuid[], uint32_t uuid_len) 505 507 { 508 return obexftp_connect_src(cli, NULL, device, port, uuid, uuid_len); 509 } 510 511 int obexftp_connect_src(obexftp_client_t *cli, const char *src, const char *device, int port, const uint8_t uuid[], uint32_t uuid_len) 512 { 506 513 struct sockaddr_in peer; 507 514 #ifdef HAVE_BLUETOOTH 508 515 char *devicedup, *devicep; 509 bdaddr_t bdaddr; 516 bdaddr_t bdaddr, src_addr; 517 int hci_id; 510 518 #endif 511 519 #ifdef HAVE_USB … … 558 566 #ifdef HAVE_BLUETOOTH 559 567 case OBEX_TRANS_BLUETOOTH: 568 if (!src) { 569 bacpy(&src_addr, BDADDR_ANY); 570 } else { 571 str2ba(src, &src_addr); 572 hci_id = atoi(src); 573 if (hci_id > 0) { 574 hci_devba(hci_id, &src_addr); 575 } 576 } 560 577 if (!device) { 561 578 ret = -EINVAL; … … 572 589 if (*devicep == '/') *devicep = ':'; 573 590 } 574 (void) str2ba(devicedup, &bdaddr); /* what is the meaning of the return code? */591 (void) str2ba(devicedup, &bdaddr); 575 592 free(devicedup); 576 ret = BtOBEX_TransportConnect(cli->obexhandle, BDADDR_ANY, &bdaddr, (uint8_t)port);593 ret = BtOBEX_TransportConnect(cli->obexhandle, &src_addr, &bdaddr, (uint8_t)port); 577 594 DEBUG(3, "%s() BT %d\n", __func__, ret); 578 595 break; -
trunk/obexftp/client.h
r145 r146 139 139 int port, /* INET(?), BLUETOOTH, USB*/ 140 140 /*@null@*/ const uint8_t uuid[], uint32_t uuid_len); 141 int obexftp_connect_src(obexftp_client_t *cli, 142 /*@null@*/ const char *src, /* HCI no. or address */ 143 /*@null@*/ const char *device, /* for INET, BLUETOOTH */ 144 int port, /* INET(?), BLUETOOTH, USB*/ 145 /*@null@*/ const uint8_t uuid[], uint32_t uuid_len); 141 146 142 147 //int obexftp_connect_service(obexftp_client_t *cli,
