Is there any way to identify a USB device is a storage or a mouse, keyboard etc.
You can differentiate a storage from a keyboard, but not a keyboard from a mouse, as both belong to HID class.
LibUSB has the following list of device class.
With a score of messages under his belt, OP should know enough by now to specify what OS he's interested in in the text of his message, or if in fact he's asking a general question which he'd like to apply to all OSes.
Speaking specifically for Linux, and specifically excluding other unix-derived OSes including the Mac. It is possible to get a lot of info by looking at the output from lsusb or from a command such as
# udevadm info -q all -n /dev/ttyACM0 --attribute-walk
Credit there to
https://back7.co/home/scaling-octoprint-with-a-raspberry-pi which reminded me of it yesterday.
Both of these in practice work by walking the /sys tree, I'm managing to do quite a lot looking at various serial ports e.g. /dev/ttyUSBn and finding the driver name, device description and sometimes (but not always) the name of the driver module supporting the chip.
I'd note that some of the accessible stuff is post-quirk, I can't remember exactly where I've got to in the past but I think that I've found getting the /actual/ HID description emitted by e.g. a trackball to be a problem. I'd also note that getting definite confirmation that one of the generic cdc_xxx drivers is being used can be a problem.
Apologies if this is not what OP is asking, but this would by no means be the first time that somebody has tried to get a generic answer by posting in an OS-specific forum.
MarkMLl