HAL_Linux: add close(_fd) to some functions in RCOutput

This commit is contained in:
Siddharth Bharat Purohit 2014-06-05 20:44:29 +05:30 committed by Andrew Tridgell
parent 95e0803880
commit 9999e77a74

View File

@ -107,6 +107,7 @@ void LinuxRCOutput::set_freq(uint32_t chmask, uint16_t freq_hz) //LSB
} }
} }
} }
close(_fd);
} }
uint16_t LinuxRCOutput::get_freq(uint8_t ch) uint16_t LinuxRCOutput::get_freq(uint8_t ch)
@ -126,7 +127,7 @@ uint16_t LinuxRCOutput::get_freq(uint8_t ch)
perror("period_ns: read failed"); perror("period_ns: read failed");
} }
freq_hz=1000000000/(unsigned long)strtol(buffer,NULL,10); freq_hz=1000000000/(unsigned long)strtol(buffer,NULL,10);
close(_fd);
return freq_hz; return freq_hz;
} }
@ -145,6 +146,7 @@ void LinuxRCOutput::enable_ch(uint8_t ch)
if(ret < 0){ if(ret < 0){
perror("run: read failed"); perror("run: read failed");
} }
close(_fd);
} }
void LinuxRCOutput::disable_ch(uint8_t ch) void LinuxRCOutput::disable_ch(uint8_t ch)
@ -162,6 +164,7 @@ void LinuxRCOutput::disable_ch(uint8_t ch)
if(ret < 0){ if(ret < 0){
perror("run: read failed"); perror("run: read failed");
} }
close(_fd);
} }
void LinuxRCOutput::write(uint8_t ch, uint16_t period_us) void LinuxRCOutput::write(uint8_t ch, uint16_t period_us)
@ -180,6 +183,7 @@ void LinuxRCOutput::write(uint8_t ch, uint16_t period_us)
if(ret < 0){ if(ret < 0){
perror("duty_ns: read failed"); perror("duty_ns: read failed");
} }
close(_fd);
} }
void LinuxRCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len) void LinuxRCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len)