summaryrefslogtreecommitdiff
path: root/rcm-server-lirc.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-server-lirc.c')
-rw-r--r--rcm-server-lirc.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/rcm-server-lirc.c b/rcm-server-lirc.c
index 4342cc1..3abcc32 100644
--- a/rcm-server-lirc.c
+++ b/rcm-server-lirc.c
@@ -30,16 +30,16 @@ lirc_write(int fd, const uint32_t *v, unsigned count)
static int
lirc_read(sd_event_source *s, int fd, uint32_t revents, void *userdata)
{
- struct device *device = userdata;
+ struct rc_device *rcdev = userdata;
uint8_t buf[100];
ssize_t bytes_read;
- if (fd != device->lirc_fd)
- fprintf(stderr, "lirc fd mismatch: %i != %i\n", device->lirc_fd, fd);
+ if (fd != rcdev->lirc_fd)
+ fprintf(stderr, "lirc fd mismatch: %i != %i\n", rcdev->lirc_fd, fd);
if (revents & EPOLLHUP) {
fprintf(stderr, "lirc connection closed!\n");
- lirc_close(device);
+ lirc_close(rcdev);
return 0;
}
@@ -55,30 +55,30 @@ lirc_read(sd_event_source *s, int fd, uint32_t revents, void *userdata)
}
int
-lirc_setup(struct device *device, const char *path)
+lirc_setup(struct rc_device *rcdev, const char *path)
{
int r;
- if (!device)
+ if (!rcdev)
return -EINVAL;
- if (device->lirc_fd >= 0) {
+ if (rcdev->lirc_fd >= 0) {
printf("Multiple lirc devices!?\n");
return 0;
}
- device->lirc_fd = open(path, O_RDWR | O_NONBLOCK);
- if (device->lirc_fd < 0) {
+ rcdev->lirc_fd = open(path, O_RDWR | O_NONBLOCK);
+ if (rcdev->lirc_fd < 0) {
printf("Failed to open lirc device %s: %s\n", path, strerror(errno));
return -errno;
}
- if (sd_event_add_io(device->mgr->event, &device->lirc_ev,
- device->lirc_fd, EPOLLIN, lirc_read, device) < 0) {
+ if (sd_event_add_io(rcdev->mgr->event, &rcdev->lirc_ev,
+ rcdev->lirc_fd, EPOLLIN, lirc_read, rcdev) < 0) {
printf("Failed to add event source for lirc device %s: %s\n",
path, strerror(errno));
r = -errno;
- lirc_close(device);
+ lirc_close(rcdev);
return r;
}
@@ -86,15 +86,15 @@ lirc_setup(struct device *device, const char *path)
}
void
-lirc_close(struct device *device)
+lirc_close(struct rc_device *rcdev)
{
- if (!device)
+ if (!rcdev)
return;
- if (device->lirc_fd < 0)
+ if (rcdev->lirc_fd < 0)
return;
- close(device->lirc_fd);
- device->lirc_fd = -1;
+ close(rcdev->lirc_fd);
+ rcdev->lirc_fd = -1;
}