diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-26 14:37:12 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-26 14:37:12 +0200 |
commit | 525209ac9465f37a9ba292f1ff138dd80768e869 (patch) | |
tree | 741d9bef9fd62960e7a7b853bbf7cd98ba2aba40 /libbb/speed_table.c | |
parent | 4537f83d522086bec8aaa2077f889d8c1c389862 (diff) | |
download | busybox-w32-525209ac9465f37a9ba292f1ff138dd80768e869.tar.gz busybox-w32-525209ac9465f37a9ba292f1ff138dd80768e869.tar.bz2 busybox-w32-525209ac9465f37a9ba292f1ff138dd80768e869.zip |
libbb/speed_table.c: expand comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/speed_table.c')
-rw-r--r-- | libbb/speed_table.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libbb/speed_table.c b/libbb/speed_table.c index 13dc9c73a..11ced01d0 100644 --- a/libbb/speed_table.c +++ b/libbb/speed_table.c | |||
@@ -103,8 +103,23 @@ static const struct speed_map speeds[] = { | |||
103 | {B4000000, 4000000/200 + 0x8000u}, | 103 | {B4000000, 4000000/200 + 0x8000u}, |
104 | #endif | 104 | #endif |
105 | /* 4000000/200 = 0x4e20, bit#15 still does not interfere with the value */ | 105 | /* 4000000/200 = 0x4e20, bit#15 still does not interfere with the value */ |
106 | /* (can use /800 if higher speeds would appear, /1600 won't work for B500000) */ | ||
106 | }; | 107 | }; |
107 | 108 | ||
109 | /* | ||
110 | * TODO: maybe we can just bite the bullet, ditch the table and use termios2 | ||
111 | * Linux API (supports arbitrary baud rates, no Bxxxx mess needed)? Example: | ||
112 | * | ||
113 | * #include <asm/termios.h> | ||
114 | * #include <asm/ioctls.h> | ||
115 | * struct termios2 t; | ||
116 | * ioctl(fd, TCGETS2, &t); | ||
117 | * t.c_ospeed = t.c_ispeed = 543210; | ||
118 | * t.c_cflag &= ~CBAUD; | ||
119 | * t.c_cflag |= BOTHER; | ||
120 | * ioctl(fd, TCSETS2, &t); | ||
121 | */ | ||
122 | |||
108 | enum { NUM_SPEEDS = ARRAY_SIZE(speeds) }; | 123 | enum { NUM_SPEEDS = ARRAY_SIZE(speeds) }; |
109 | 124 | ||
110 | unsigned FAST_FUNC tty_baud_to_value(speed_t speed) | 125 | unsigned FAST_FUNC tty_baud_to_value(speed_t speed) |
@@ -114,7 +129,7 @@ unsigned FAST_FUNC tty_baud_to_value(speed_t speed) | |||
114 | do { | 129 | do { |
115 | if (speed == speeds[i].speed) { | 130 | if (speed == speeds[i].speed) { |
116 | if (speeds[i].value & 0x8000u) { | 131 | if (speeds[i].value & 0x8000u) { |
117 | return ((unsigned long) (speeds[i].value) & 0x7fffU) * 200; | 132 | return ((unsigned)(speeds[i].value) & 0x7fffU) * 200; |
118 | } | 133 | } |
119 | return speeds[i].value; | 134 | return speeds[i].value; |
120 | } | 135 | } |