summaryrefslogtreecommitdiff
path: root/monitor/control.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2016-04-27 21:06:54 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2016-04-27 21:11:26 +0300
commit67e35de97e2a7b940ee52274577df448cffe4e33 (patch)
treed2c78cfc33d144820e4fc0ae8e76da7b567e1648 /monitor/control.c
parente0ecf26de207483aa5e8cf797e38eece3098b422 (diff)
downloadbluez-67e35de97e2a7b940ee52274577df448cffe4e33.tar.gz
Make use of new tty_get_speed helper
Diffstat (limited to 'monitor/control.c')
-rw-r--r--monitor/control.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/monitor/control.c b/monitor/control.c
index 05faeef49..048add25e 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -1218,59 +1218,6 @@ static void tty_callback(int fd, uint32_t events, void *user_data)
}
}
-static unsigned int get_speed(unsigned int speed)
-{
- switch (speed) {
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
-#ifdef B2500000
- case 2500000:
- return B2500000;
-#endif
-#ifdef B3000000
- case 3000000:
- return B3000000;
-#endif
-#ifdef B3500000
- case 3500000:
- return B3500000;
-#endif
-#ifdef B3710000
- case 3710000:
- return B3710000;
-#endif
-#ifdef B4000000
- case 4000000:
- return B4000000;
-#endif
- default:
- fprintf(stderr, "Unsupported speed. Using 115200.\n");
- return B115200;
- }
-
- return 0;
-}
-
int control_tty(const char *path, unsigned int speed)
{
struct control_data *data;
@@ -1298,7 +1245,7 @@ int control_tty(const char *path, unsigned int speed)
ti.c_cflag |= (CLOCAL | CREAD);
ti.c_cflag &= ~CRTSCTS;
- cfsetspeed(&ti, get_speed(speed));
+ cfsetspeed(&ti, speed);
if (tcsetattr(fd, TCSANOW, &ti) < 0) {
err = -errno;