USB: Clean up warnings

This commit is contained in:
refractionpcsx2 2022-04-16 02:26:09 +01:00
parent c53f4d0d63
commit ae83f729db
3 changed files with 23 additions and 6 deletions

View File

@ -274,7 +274,9 @@ namespace usb_pad
ie.code = FF_AUTOCENTER;
ie.value = value * 0xFFFFUL / 100;
write(mHandle, &ie, sizeof(ie));
if (write(mHandle, &ie, sizeof(ie)) == -1)
{
}
}
void EvdevFF::SetGain(int gain /* between 0 and 100 */)
@ -285,7 +287,9 @@ namespace usb_pad
ie.code = FF_GAIN;
ie.value = 0xFFFFUL * gain / 100;
write(mHandle, &ie, sizeof(ie));
if (write(mHandle, &ie, sizeof(ie)) == -1)
{
}
}
} // namespace evdev

View File

@ -629,7 +629,9 @@ namespace usb_pad
{
uint8_t reset[7] = {0};
reset[0] = 0xF3; //stop forces
write(mHidHandle, reset, sizeof(reset));
if (write(mHidHandle, reset, sizeof(reset)) == -1)
{
}
}
close(mHidHandle);
}

View File

@ -106,13 +106,20 @@ namespace usb_printer
header.height = s->height;
header.planes = 1;
header.bpp = 24;
write(s->print_file, &header, sizeof(header));
if (write(s->print_file, &header, sizeof(header)) == -1)
{
Console.Error("Error writing header to print file");
}
s->stride = 3 * s->width + 3 - ((3 * s->width + 3) & 3);
s->data_pos = 0;
lseek(s->print_file, sizeof(BMPHeader) + s->stride * s->height - 1, SEEK_SET);
char zero = 0;
write(s->print_file, &zero, 1);
if (write(s->print_file, &zero, 1) == -1)
{
Console.Error("Error writing zero padding to header to print file");
}
}
void sony_write_data(PrinterState* s, int size, uint8_t* data)
@ -128,7 +135,11 @@ namespace usb_printer
break;
}
lseek(s->print_file, sizeof(BMPHeader) + pos_out + 2 - s->data_pos % 3, SEEK_SET);
write(s->print_file, data + i, 1);
if (write(s->print_file, data + i, 1) == -1)
{
Console.Error("Error writing data to print file");
}
s->data_pos ++;
}
}