+static bool keyd_send_cmd(int fd, enum keyd_ops _cmd)
+{
+ uint32_t cmd = _cmd;
+ ssize_t bytes;
+
+ bytes = write(fd, &cmd, sizeof(cmd));
+ if (bytes != sizeof(cmd)) {
+ return false;
+ }
+
+ bytes = read(fd, &cmd, sizeof(cmd));
+ if (bytes != sizeof(cmd)) {
+ return false;
+ }
+
+ if (cmd != KEYD_REPLY_OK) {
+ return false;
+ }
+
+ return true;
+}
+