HAL_Linux: correct AP_HAL_Linux::RCOutput::enable_ch method

change the mode of file open which was set as RDONLY mistakenly
This commit is contained in:
bugobliterator 2014-05-14 18:13:34 +05:30 committed by Andrew Tridgell
parent eb35c94a43
commit 79fb10d9e8
1 changed files with 2 additions and 2 deletions

View File

@ -136,12 +136,12 @@ void LinuxRCOutput::enable_ch(uint8_t ch)
char run_sysfs_path[20],buffer[]="1"; char run_sysfs_path[20],buffer[]="1";
sprintf(run_sysfs_path,"%s/pwm%d%s",PWM_DIR,chan_pru_map[ch],"/run"); sprintf(run_sysfs_path,"%s/pwm%d%s",PWM_DIR,chan_pru_map[ch],"/run");
_fd=open(run_sysfs_path,O_RDONLY); _fd=open(run_sysfs_path,O_WRONLY);
if(_fd < 0){ if(_fd < 0){
perror("run: file open failed"); perror("run: file open failed");
} }
ret = ::read(_fd,&buffer,sizeof(buffer)); ret = ::write(_fd,&buffer,sizeof(buffer));
if(ret < 0){ if(ret < 0){
perror("run: read failed"); perror("run: read failed");
} }