i wonder if it is possible to somehow make so when you plug the camera in by usb, it tells the computer that its a keyboard so you can inject keystrokes... Would be quite useful. Is this technically possible? or would a lot of reverse-engineering be necessary.
If you mean have the camera act as a USB
HID keyboard that would require writing a full HID stack to run on the camera, which would in turn require reverse engineering the low level parts of the camera USB stack. While it may be theoretically possible, it would almost certainly be a huge amount of work.
Can we use camera to send pressed keys to chdkptp ? (Don't use scripts,because might send keys when shooting)
You would need to use a script. In that case, you could use use the
USB message interface to send messages to chdkptp, and a script on the chdkptp side to act based on the received messages.
You could of course modify CHDK to generate messages while a script was not running, but I wouldn't consider including that in the official version without a really compelling use case.