for a bigger project I have a double-USB-A plug in my housing. This is connected to 5V and GND and I can charge my mobile with it and stuff.
But there are also those Data pins. Is there a way of retrieving data from it via Arduino?
Nothing "special" but I just want to gather the device's name it sends to the computer. For example “Hewlett-Packard DeskJet 6980 Series” or “Realtec Semiconductor Corp. Mass Storage Device” as you can read it in lsusb.
Is this possible? Is there a library for that?
Greetings
Addition: So I found this in the Playground Arduino Playground - UsbMemory
Interfacing with an USB Memory Stick.
But what is a VDIP? And I don't see a command where he gathers device information.
Addition2: Okay, it seems you need that USB controller thingie in order to do anything with the USB device. Sad So then I'll stick with just charging my device and hopefully I get it at least to recognize that there is something plugged in.
In order to pull information, the Arduino would need to be a host device. It is not. It is a slave device. It's role is to obey commands, not issue them.
hopefully I get it at least to recognize that there is something plugged in.
You should be able to do that by monitoring the voltage level on a data pin.
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?
Okay, got it. So the one signal pin is GNDed when there is something plugged in, and the other one is +5V. So I can just monitor one of them and see if it is either noisy or constantly like > 1000.
Thanks for the ideas. I'll implement this