Use a separate writeEvent function

This function will also be used for handling UHID_OUTPUT. It also moves
all error checking into a single place.

Bug: none
Test: NintendoSwitchProTest
Change-Id: I72faa4bbfbe41842bbb651730dbd614c5bcbbaea
1 file changed