Arduino Mega and Virtual USB keyboard

I'm trying to convert my car's steering wheel controls to fixed keyboard input using an Arduino. The only documented project I've found to do this is from the Practical Arduino projects (practicalarduino.com), using the rancidbacon code and library (Project Log : Arduino USB - ProjectLogArduinoUSB).

However, I'm stumbling at the first hurdle. The demo code won't compile or pass verification, with dozens of "variable X must be const" errors and "narrowing conversion" warnings. I've tried switching the arduino type to Leonardo/Uno in the IDE, but Verify still throws up lots of errors.

All the threads I've found on this forum are 4-5 years old now, and I haven't found one with a conclusive answer to this problem.

So, has anyone seen a recent implementation of a USB keyboard device?

Only the 32U4 based boards support that kind of USB interface. Mega is not one.

No, but the Leonardo is, and that still generates all these errors in the IDE when verifying the rancidbacon project code. So I'm guessing something has changed in the IDE since that project was developed.

Grrrmachine:
No, but the Leonardo is, and that still generates all these errors in the IDE when verifying the rancidbacon project code. So I'm guessing something has changed in the IDE since that project was developed.

Yes. The const errors can be fixed by just adding the const keyword.

Thanks. It seems there are quite a few changes that need to be made to the library files, including changes to usbdrv.h and usbdrv.c. The error statements in the IDE explain what to change (i.e where to add const) but one other thing needs to modified:

At one point in compiling, there will be errors for undefined usbinit and usbpoll. Open the usbdrv.h file, and at line 168, make sure the code resembles the following:

#ifdef __cplusplus
extern "C"{
#endif
USB_PUBLIC void usbInit(void);

I'm leaving this here for others to find in case they want to follow my progress.