Arduino as composite devices

Hello community,

I am using arduino in one of my personal projects.

I want to move the files from the arduino to the host and want to open any windows desktop application using arduino upon the plugIN.

I don't wanna execute any special script on my host for this.

I have checked with one of the famous gaming mouse. They have one antenna with 2.4GHz supported band. As I insert that antenna to my windows host it shows the folder with manufacturer name inside C:/programmingFiles(x86). It also start the installer window upon insertion. I want something just like that, is it possible to do so with the arduino.

the gaming mouse shows up as USB composite device and the arduino with HID interface enabled also shows up the same.

I am not getting this flow, that how does this device put it's folder inside the installation folder of windows automatically without doing anything manually on windows machine.
where does those files stored on the device?

If there was a way to run any application and transfer data to or from the Arduino just upon plugging it in, without any software installed on the PC, can you imagine the security issue it would be ?? :scream: :cold_face:

I'm not a Windows user but you probably had a driver for your "famous gaming mouse". That's custom code running (with privileges) on your host upon plugin and you accepted to install that and trusted it.

(if not, well Windows is Windows.... so security is what it is... but I would doubt it's that bad...)

@J-M-L

No, I did not install any driver manually,

upon the insertion it shows 6-7 different different ports under device manager.

All the ports shows the microsoft drivers. only one came under Human Interface Devices displays the driver manufacturer of that gaming mouse

I am not getting this. I am not that much familiar with windows. I tried the same stuff with ubuntu. In ubuntu it does not open any installer window upon insertion.

and under usb-devices command it shows that default usbhid driver attached to it. under the results of usb-devices command, it displays 3 ports and all these ports are attached with the same usbhid driver as this device is recognized as HID compliant device (03) by the ubuntu

just want to understand this. How does this work?

is this USB composite device having the different class than HID and CDC? where does those files stored on the device?

That driver is included with Windows because they paid Microsoft to include it. The mouse USB communications identified itself with a matching manufacturer number and device number so Windows could find the proper driver.
Paul

@Paul_KD7HB

I think I am getting this,

but I checked that if C:/programmingFiles(x86) don't have the folder razer inside it, upon the insertion of antenna it creates the folder inside C:/programmingFiles(x86) named razer and all the exe files for the installer windows comes up there automatically.

How does this happen?

because my whole disk did not have those files before insertion and I also turned off internet connection of my machine before the antenna insertion, just to check whether it is directly downloading from the internet or not.

No, that is not right. You likely used Windows Explorer for the search. Use the Windows search itself and look for part of the name or the whole name. The file is likely hidden from the logged in user.
Paul

So, won't this require the Arduino to "look like" a disk drive when it's plugged in to a PC? Presumably it would need to implement a FAT system in FLASH or EEPROM, and then provide the appropriate interface to the PC.

I don't know how that is done - presumably there would need to be a sketch on the Arduino to do all this. This is probably worth a look:

Google "make arduino look like a disk drive".

Spend a few hours studying how USB operates.

All the ports shows the microsoft drivers. only one came under Human Interface Devices displays the driver manufacturer of that gaming mouse

I am not getting this. I am not that much familiar with windows. I tried the same stuff with ubuntu. In ubuntu it does not open any installer window upon insertion.

USB 2G/3G/4G gadgets work in a similar way. Your wireless gadget probably works in a similar way. This is a well known problem to Linux users. On Linux, see if the wireless gadget appears as a hard or CD drive. The Windows drivers are useless on Linux. The usb-modeswitch utility forces these devices to switch off the CD drive mode so they can be used as modems.

https://nicovddussen.wordpress.com/2014/11/12/setting-up-your-raspberry-pi-to-work-with-a-3g-dongle/

3G modems are produced to be friendly to Microsoft Windows and to work without hassles in such an environment. To achieve this, such a modem has two modes. The first mode emulates a CD plugged into the USB port, and the second is the actual modem mode. When the modem is plugged into a Windows machine’s USB port, the CD mode is activated and if the drivers and supporting software is present on the computer, the mode is switched to function as a modem. If the drivers and software is not yet present, it is installed.

As previously mentioned, the Adafruit TinyUSB library supports USB mass storage devices for Arduino.

@Paul_KD7HB

yes, I am checking this.

what I understood from the above explanation is, razer already provided it's drivers to windows by paying Microsoft. Microsoft already included those drivers in its kernel.

Upon the insertion of the device with those specific VID & PID, it moves that folder in the C:/programFiles(x86) and installs it if not installed before

is this correct?

Can I write the custom driver and load it to the host PC upon device insertion without any manual driver installation?

I am still bit confused about this

Yes, the first is correct. That is true for all drivers that are part of Windows. Some created and maintained by Microsoft. All others created and maintained by other businesses.

The second, I am sorry to say, if you have to ask, then you do not have the documentation to write such a program. And neither do I.
Paul

okay @Paul_KD7HB

that means the device does not transfer the driver files or the installer.exe file in host upon insertion

This device shows up as a composite device under USB controllers in the device manager, so this device will transfer its Device Descriptor to the host upon descriptor req by the host.

Then the host will search in the already included drivers and then attach the device with the driver which matches its VID PID

In the case of the razer mouse, the Windows machine already has it in some hidden folder and after reading the descriptor of the mouse it copied those hidden folders and installer files to the main path in windows. These Drivers are might not include in ubuntu so ubuntu reads it as a normal HID device and attaches usbhid default HID driver to it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.