Sleep only 100 msecs for device detection

This commit is contained in:
Marcel Holtmann 2006-07-06 09:31:03 +00:00
parent 34a99c66c2
commit be06891a83

View File

@ -261,7 +261,7 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
struct pollfd p;
socklen_t alen;
char dst[18], devname[MAXPATHLEN];
int sk, fd, try = 3;
int sk, fd, try = 30;
laddr.rc_family = AF_BLUETOOTH;
bacpy(&laddr.rc_bdaddr, bdaddr);
@ -337,7 +337,7 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
if (try--) {
snprintf(devname, MAXPATHLEN - 1, "/dev/rfcomm%d", dev);
sleep(1);
usleep(100);
continue;
}
perror("Can't open RFCOMM device");
@ -401,7 +401,7 @@ static void cmd_listen(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv
struct pollfd p;
socklen_t alen;
char dst[18], devname[MAXPATHLEN];
int sk, nsk, fd, try = 3;
int sk, nsk, fd, try = 30;
laddr.rc_family = AF_BLUETOOTH;
bacpy(&laddr.rc_bdaddr, bdaddr);
@ -454,7 +454,7 @@ static void cmd_listen(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
if (try--) {
snprintf(devname, MAXPATHLEN - 1, "/dev/rfcomm%d", dev);
sleep(1);
usleep(100);
continue;
}
perror("Can't open RFCOMM device");