DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, uwb_rc_beacon_show, uwb_rc_beacon_store);
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/kdev_t.h>
#include "uwb-internal.h"
struct uwb_rc_cmd_start_beacon {
} __attribute__((packed));
static int uwb_rc_start_beacon(struct uwb_rc *rc, u16 bpst_offset, u8 channel)
struct uwb_rc_cmd_start_beacon *cmd;
struct uwb_rc_evt_confirm reply;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
cmd->rccb.bCommandType = UWB_RC_CET_GENERAL;
cmd->rccb.wCommand = cpu_to_le16(UWB_RC_CMD_START_BEACON);
cmd->wBPSTOffset = cpu_to_le16(bpst_offset);
cmd->bChannelNumber = channel;
reply.rceb.bEventType = UWB_RC_CET_GENERAL;
reply.rceb.wEvent = UWB_RC_CMD_START_BEACON;
result = uwb_rc_cmd(rc, "START-BEACON", &cmd->rccb, sizeof(*cmd),
&reply.rceb, sizeof(reply));
if (reply.bResultCode != UWB_RC_RES_SUCCESS) {
dev_err(&rc->uwb_dev.dev,
"START-BEACON: command execution failed: %s (%d)\n",
uwb_rc_strerror(reply.bResultCode), reply.bResultCode);
static int uwb_rc_stop_beacon(struct uwb_rc *rc)
struct uwb_rc_evt_confirm reply;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
cmd->bCommandType = UWB_RC_CET_GENERAL;
cmd->wCommand = cpu_to_le16(UWB_RC_CMD_STOP_BEACON);
reply.rceb.bEventType = UWB_RC_CET_GENERAL;
reply.rceb.wEvent = UWB_RC_CMD_STOP_BEACON;
result = uwb_rc_cmd(rc, "STOP-BEACON", cmd, sizeof(*cmd),
&reply.rceb, sizeof(reply));
if (reply.bResultCode != UWB_RC_RES_SUCCESS) {
dev_err(&rc->uwb_dev.dev,
"STOP-BEACON: command execution failed: %s (%d)\n",