Get USB device name

So, I should connect a analog input to the data pin (and with a resistor to ground) and handle it like a switch and then when there is something recognize that there is something? Or via interrupt on a digital pin? And how do I recognize if it is gone?

Hm or is it better that I monitor the GND that comes from the USB and add an analog input sensor cable there? (and wired to GND via a resistor) or would that decrase the current too strongly?