X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Fserial.cpp;h=b256b117098b96a64f337c5c73b5f28818f77627;hb=4ad05c650c55e3edccea887d15b26f41cdf60fb6;hp=b4cfaab4726718bbfaa5f450cd3c1d7e1bcf29eb;hpb=1e545df21512e2d41dd16b337eca3944c1ab52aa;p=libs%2Fcore.git diff --git a/source/io/serial.cpp b/source/io/serial.cpp index b4cfaab..b256b11 100644 --- a/source/io/serial.cpp +++ b/source/io/serial.cpp @@ -46,6 +46,12 @@ void Serial::set_block(bool b) sys_set_blocking(handle, b); } +void Serial::set_inherit(bool i) +{ + adjust_mode(mode, M_INHERIT, i); + sys_set_inherit(handle, i); +} + void Serial::set_baud_rate(unsigned rate) { DeviceState state; @@ -100,7 +106,7 @@ void Serial::set_parameters(const string ¶ms) state.apply_to(handle); } -unsigned Serial::do_write(const char *buf, unsigned size) +size_t Serial::do_write(const char *buf, size_t size) { if(size==0) return 0; @@ -108,12 +114,12 @@ unsigned Serial::do_write(const char *buf, unsigned size) return sys_write(handle, buf, size); } -unsigned Serial::do_read(char *buf, unsigned size) +size_t Serial::do_read(char *buf, size_t size) { if(size==0) return 0; - unsigned ret = reader.read(buf, size); + size_t ret = reader.read(buf, size); if(ret==0) set_eof();