int hiddev_write(const unsigned char data[64], int fd , int usage_code)
{
- int rc = 0, uindex, error;
+ int rc = 0, uindex;
struct hiddev_usage_ref uref;
struct hiddev_report_info rinfo;
err2:
printf("HIDIOCSREPORT\n");
err:
- error = errno;
- printf("Error in IOCTL: %s\n", strerror(error));
+ printf("Error in IOCTL: %m\n");
return rc;
}
static int get_usagecode(int fd)
{
struct hiddev_usage_ref uref;
- int rc, error;
+ int rc;
uref.report_type = HID_REPORT_TYPE_OUTPUT;
uref.report_id = 0x0;
rc = ioctl(fd, HIDIOCGUCODE, &uref);
if (rc < 0) {
- error = errno;
- printf("Error gettin usage code: %s\n", strerror(error));
+ printf("Error gettin usage code: %m\n");
return rc;
}
dir = opendir(HIDDEV_PATH);
if (dir == NULL) {
error = errno;
- trace(4, "Failed to open directory %s: %s\n", HIDDEV_PATH,
- strerror(error));
+ trace(4, "Failed to open directory %s: %m\n", HIDDEV_PATH);
+
return -error;
}
if (errno) {
error = errno;
- trace(0, "Error reading directory %s: %s\n", HIDDEV_PATH,
- strerror(error));
+ trace(0, "Error reading directory %s: %m\n", HIDDEV_PATH);
+
return -error;
}