From ae83f729db2cb4c2648dab1d1393285511affb41 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sat, 16 Apr 2022 02:26:09 +0100 Subject: [PATCH] USB: Clean up warnings --- pcsx2/USB/usb-pad/evdev/evdev-ff.cpp | 8 ++++++-- pcsx2/USB/usb-pad/evdev/evdev.cpp | 4 +++- pcsx2/USB/usb-printer/usb-printer.cpp | 17 ++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp b/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp index 4f05366545..5a055189ef 100644 --- a/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp +++ b/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp @@ -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 diff --git a/pcsx2/USB/usb-pad/evdev/evdev.cpp b/pcsx2/USB/usb-pad/evdev/evdev.cpp index 5ea033db8d..f81ca4a509 100644 --- a/pcsx2/USB/usb-pad/evdev/evdev.cpp +++ b/pcsx2/USB/usb-pad/evdev/evdev.cpp @@ -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); } diff --git a/pcsx2/USB/usb-printer/usb-printer.cpp b/pcsx2/USB/usb-printer/usb-printer.cpp index abc2766273..ec2a03f9ce 100644 --- a/pcsx2/USB/usb-printer/usb-printer.cpp +++ b/pcsx2/USB/usb-printer/usb-printer.cpp @@ -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 ++; } }