That is indeed another solution, provided you're building the path dynamically

.
i.e., we do that in KOReader to pickup the Accelerometer on one or both of the Oasis.
In a hard-coded compiled program, I find a by-path path usually does the job, but, yes, it depends on the exact task (and, indeed, here, the USB controller can be different and/or use a different name on various Kindle models).
EDIT: I haven't checked, but if you want to go that way in C/C++, libevdev might have higher-level tools to do that without having to reinvent the wheel

. (evtest and its successor evemu certainly parse this in a human-readable format).