USB DEVICE Descriptor

How can I make the sketch uses the same descriptor as the one from the Boatloader. After I upload the sketch the Device descriptor changes and the serial number disappears as well even tho when I use the Board Get INFO everything is correct. In another words

This how it looks like before I upload the sketch ( that is what I am trying to achieve after uploading the sketch )

===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0110
bDeviceClass: 0x02 -> This is a Communication Device
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 = (64) Bytes
idVendor: 0x0AAD = CUSTOMe DEVICE
idProduct: 0x01F1
bcdDevice: 0x0000
iManufacturer: 0x02
English (United States) "Custome device company "
iProduct: 0x01
English (United States) "B&G HGB20 "
iSerialNumber: 0x03
English (United States) "0002494358"
bNumConfigurations: 0x01

This is how it looks like After Uploading the sketch

===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0xEF -> This is a Multi-interface Function Code Device
bDeviceSubClass: 0x02 -> This is the Common Class Sub Class
bDeviceProtocol: 0x01 -> This is the Interface Association Descriptor protocol
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0x0AAD = CUSTOMe DEVICE
idProduct: 0x01F1
bcdDevice: 0x0100
iManufacturer: 0x01
English (United States) "Unknown"
iProduct: 0x02
English (United States) "Genuino HBC200"
iSerialNumber: 0x03
English (United States) ""
bNumConfigurations: 0x01

---===>Open Pipes<===---

Look in the Arduino core files for USBCore.cpp, Pluggable.cpp, and USBDesc.h. It is possible to change the USB descriptors but it is not easy.

gdsports:
Look in the Arduino core files for USBCore.cpp, Pluggable.cpp, and USBDesc.h. It is possible to change the USB descriptors but it is not easy.

I've been trying to do that , but it isnot working, i did some changes in USBCore.cpp
but why do i need to modify Pluggable.cpp ?

I think I modified Pluggable.cpp for some other reason so I guess there is no need for your project. I was modifying the files so the Arduino used the boot flag on the keyboard descriptor so it was recognized by the BIOS.

gdsports:
I think I modified Pluggable.cpp for some other reason so I guess there is no need for your project. I was modifying the files so the Arduino used the boot flag on the keyboard descriptor so it was recognized by the BIOS.

SO what boot flags are you using ?

I do not think the HID Boot subclass is relevant to a communication device such the one you are using. They are relevant for USB HID keyboard so the keyboard is active from power up such as during the BIOS. The default settings for the Arduino USB HID keyboard does not set the boot interface subclass.

Yes That what i though too !!!