Detecting PC USB version ATmega32u4 pluged in to

Hello,

I'm making RGB LED keyboard (ATmega32u4 MCU) with changeable USB3 Type-C/Type-A cable and would like to dynamically change LED MAX current according to available power. My goal is to set 800-850mA limit on USB3 and 400-450mA on USB2 (optional – no LEDs on UBB1).

Is there a way to find out USB version with hardware in circuit or this is a matter of software (custom drivers)?

Type-C is not an issue – all I have to do is look for voltage on "CC1" or "CC2" pins. Differentiation between USB2 Type-A and USB3 Type-A is more difficult – my idea is to look for voltage in USB3 extra differential pairs, tho I have no idea if this would work.

Any ideas?