If you remove the COM port functionality from the bootloader, why have a bootloader? That functionality is used to upload code.
You are starting IMO too many threads about related USB issues, so someone answering in each thread doesn't see the whole picture of what you're trying to do (I sure can't figure it out).
if my Logitech G300S Gaming mouse don't have COM port, how it's working without it ?
And I want to do that just because I want it, nothing else, do you have any problem with that ?
And you cannot say if someone answering me will be confused because for now, no one answered me about my problem, just talking about why I ask such questions.
The Leonardo is programmed by triggering a reset (IIRC this is done by opening and closing serial port at 2400 baud, which is detected by the virtual com port code that runs as part of the sketch, and resets it into the bootloader. The bootloader then presents as a virtual com port (just like normal) and implements some standard serial programming protocol over this serial port.
So getting rid of the com port functionality in the bootloader will get rid of the ability to program the leonardo over USB using the bootloader, hence making the bootloader pointless, while getting rid of it in the sketch will mean you'll have to double-tap reset to get into the bootloader to reprogram it (it could still be put into DFU mode and flashed using Atmel FLIP, or you could upload code via ISP programmer). If you get rid of that in the bootloader, you might as well not use a bootloader....
Your mouse acts as a HID device. There is also no facility for reprogramming your mouse over USB.
I strongly suspect that this is an x-y problem, and that there is a much simpler solution to your original problem, rather than doing all manner of strange things to the USB code. Maybe there isn't, but these threads have all the hallmarks of an x-y problem.
Since you're removing all hope of the bootloader doing it's job, wouldn't it be a better solution to dispense with the bootloader entirely (and upload by ISP or export hex -> DFU)? That would get you 2k of extra flash and slightly faster startup too...
Logitech Dev: Since we're removing all hope of the bootloader doing it's job, wouldn't it be a better solution to dispense with the bootloader entirely (and upload by ISP or export hex -> DFU)? That would get we 2k of extra flash and slightly faster startup too...
I have no experience with it but have an interest in 32U4 related stuff. Note that there is a risk that you already know this.
My feeling is that you have to remove the vid/pid that's responsible for the serial port; there might be some of the others that you might want to remove as well.