mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 08:27:34 +08:00
tone_alarm: add #define for device path
This commit is contained in:
committed by
Lorenz Meier
parent
1a641b791d
commit
f4abcb51a1
@@ -60,6 +60,8 @@
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define TONEALARM_DEVICE_PATH "/dev/tone_alarm"
|
||||
|
||||
#define _TONE_ALARM_BASE 0x7400
|
||||
#define TONE_SET_ALARM _IOC(_TONE_ALARM_BASE, 1)
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ extern "C" __EXPORT int tone_alarm_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
ToneAlarm::ToneAlarm() :
|
||||
CDev("tone_alarm", "/dev/tone_alarm"),
|
||||
CDev("tone_alarm", TONEALARM_DEVICE_PATH),
|
||||
_default_tune_number(0),
|
||||
_user_tune(nullptr),
|
||||
_tune(nullptr),
|
||||
@@ -820,10 +820,10 @@ play_tune(unsigned tune)
|
||||
{
|
||||
int fd, ret;
|
||||
|
||||
fd = open("/dev/tone_alarm", 0);
|
||||
fd = open(TONEALARM_DEVICE_PATH, 0);
|
||||
|
||||
if (fd < 0)
|
||||
err(1, "/dev/tone_alarm");
|
||||
err(1, TONEALARM_DEVICE_PATH);
|
||||
|
||||
ret = ioctl(fd, TONE_SET_ALARM, tune);
|
||||
close(fd);
|
||||
@@ -839,10 +839,10 @@ play_string(const char *str, bool free_buffer)
|
||||
{
|
||||
int fd, ret;
|
||||
|
||||
fd = open("/dev/tone_alarm", O_WRONLY);
|
||||
fd = open(TONEALARM_DEVICE_PATH, O_WRONLY);
|
||||
|
||||
if (fd < 0)
|
||||
err(1, "/dev/tone_alarm");
|
||||
err(1, TONEALARM_DEVICE_PATH);
|
||||
|
||||
ret = write(fd, str, strlen(str) + 1);
|
||||
close(fd);
|
||||
|
||||
Reference in New Issue
Block a user