Hi Maurizio,
The only option to change the speed in a usb device it is not by software it is by hardware, you need to add a pull-up resistor from D+ or D- depending of the speed, you want to select. For a full speed device, the pull-up is attached to the D+ signal. When the host detects this voltage change then it begins the enumeration process at the full speed rate. If the voltage change is detected on the D- line, then the enumeration happens at low speed.

Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------