mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-17 17:24:32 +08:00
Sleep only 100 msecs for device detection
This commit is contained in:
parent
34a99c66c2
commit
be06891a83
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user