How does the hid-generic driver report the behavior from the mouse to the kernel?
Not at all. This is just the generic HID driver.
Are you perhaps confusing this with hiddev.c from the usbhid directory?
What is the actual purpose of the raw_event function within the driver code? Is it necessary to have when implementing the device driver?
this function doesn't appear in hid-generic.c. Maybe you want to ask this in a new question.
What would you recommend to set up a test environment for the HID device in order to make sure it functions correctly on a Raspberry Pi? Any tools used for testing in the industrial environment for the HID device driver?
Two things:
- for pure software testing, you would probably take the C file as you would use it as a driver (module or in-tree, but probably as module), and include it into a software test fixture, to run unit tests on your specific things. How you do that very much depends on your driver design. My guess is you shouldn't be implementing a kernel-mode driver at all and deal with most things in userland software (libuv?), but that only makes sense if your HID device is kind of similar to existing devices.
- for hardware-in-the-loop-testing: Well, obviously, you will have to build a mechanical apparatus that exercises your input device, and then check that your Linux kernel driver does exactly what you want (hint: VMs are your friend). What you test with that, and to which degree, depends on the kind of HID you're building, and the kind of investment to quality you need to make for its use case. A pushbutton on a beverage vending machine probably needs different testing than the touchscreen controlling your manned space flight rocket or the steering wheel of your car.