Arduino Leonardo - unrecognized descriptor problem


I've tried to edit device descriptor structure, to be able to receive LED states of for example Caps Lock from the system. I've messed something up in the destriptor structure, and now the device stopped being recognizable by the system, therefore it is not detected under the Port menu in Arduino IDE.

Is there any way I could program it with the correct descriptor? Because now Arduino IDE doesn't give me the ability to program it again. I've tried resetting and then trying to upload the code, and few other similar 'tricks' but nothing seems to be working.

You could try connecting an ISP programmer to the Leonardo and then doing a Tools > Burn Bootloader. If you don't own a dedicated ISP programmer then you can use a spare Arduino board as an "Arduino as ISP".