mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-05 06:11:36 +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>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#define TONEALARM_DEVICE_PATH "/dev/tone_alarm"
|
||||||
|
|
||||||
#define _TONE_ALARM_BASE 0x7400
|
#define _TONE_ALARM_BASE 0x7400
|
||||||
#define TONE_SET_ALARM _IOC(_TONE_ALARM_BASE, 1)
|
#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() :
|
ToneAlarm::ToneAlarm() :
|
||||||
CDev("tone_alarm", "/dev/tone_alarm"),
|
CDev("tone_alarm", TONEALARM_DEVICE_PATH),
|
||||||
_default_tune_number(0),
|
_default_tune_number(0),
|
||||||
_user_tune(nullptr),
|
_user_tune(nullptr),
|
||||||
_tune(nullptr),
|
_tune(nullptr),
|
||||||
@@ -820,10 +820,10 @@ play_tune(unsigned tune)
|
|||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
fd = open("/dev/tone_alarm", 0);
|
fd = open(TONEALARM_DEVICE_PATH, 0);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
err(1, "/dev/tone_alarm");
|
err(1, TONEALARM_DEVICE_PATH);
|
||||||
|
|
||||||
ret = ioctl(fd, TONE_SET_ALARM, tune);
|
ret = ioctl(fd, TONE_SET_ALARM, tune);
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -839,10 +839,10 @@ play_string(const char *str, bool free_buffer)
|
|||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
fd = open("/dev/tone_alarm", O_WRONLY);
|
fd = open(TONEALARM_DEVICE_PATH, O_WRONLY);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
err(1, "/dev/tone_alarm");
|
err(1, TONEALARM_DEVICE_PATH);
|
||||||
|
|
||||||
ret = write(fd, str, strlen(str) + 1);
|
ret = write(fd, str, strlen(str) + 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|||||||
Reference in New Issue
Block a user