Generic HID with C/C++ or C# driver

Hello, at this time i use a C# software to control my Arduino so i need to set the COM port.

My problem is to use the LUFA library as Generic HID with dev PID/VID and communicate from my program written in C# to the Arduino using only PIV/VID and detect when the Arduino is plugged.

I've search any where to do this but I don't get any info about.

I've found how to use the Atmega directly http://www.waitingforfriday.com/index.php/USB_Generic_HID_Open_Source_Framework_for_Atmel_AVR_and_Windows

but i don't know how to use it with the serial of the Arduino.

So can you help me ?
I would be fine to control the bots etc directly by plugging the USB.

I french so if you don't understand me please tell it and i'll try to explain.
Thanks

From anything running on the PC you just open the right com port and start talking. Well after a delay of a second to allow the Arduino to restart. (most Arduinos are rigged to restart when the com port is opened). I think your look for something thats just not there.

Mark

Benoit934:
Hello, at this time i use a C# software to control my Arduino so i need to set the COM port.

My problem is to use the LUFA library as Generic HID with dev PID/VID and communicate from my program written in C# to the Arduino using only PIV/VID and detect when the Arduino is plugged.

...

but i don't know how to use it with the serial of the Arduino.

Thanks

You seem to be trying to do two separate things, and perhaps one of them is not really necessary.

Your Arduino can present several virtual devices to the PC when it is connected. When it's used as an HID device, it would present virtual mouse/keyboard devices. You could conceivably detect when new keyboards and mice had been installed and guess/detect whether they corresponded to the Arduino, but it's not clear why this would be useful.

Your Arduino can also present itself as a serial device and the associated USB drivers will create a virtual COM port in the PC which applications can use to send serial data to and from the Arduino's serial port. This is much more likely to be useful if you need to send commands to the Arduino or receive status data from it. Since you refer to it as a COM port I guess you're probably working in a Windows environment. In this case it's possible to use the Windows Registry to detect which COM ports correspond to Arduino serial connections. If you're working with the USB driver directly then you can also give your Arduino a unique device name which would enable you to recognise which individual Arduino it is.

You can set an Arduino up so that it appears as an HID device and a serial device if you want to.

Knowing which Arduino you are using would help!!

Mark

I want to use a HID because now I open my app and this detect (at start) the Arduino port and start to send data.

But now i would like to make a driver loaded when we plug the Arduino and notify my GUI when pluged.

In exemple when we plug a logitech keyboard this is detected as a Keyboard and the nividia driver control the LCD display by sending data over USB but in my case is LEDs and maybe later a Joystick.

My app work very fine but i want make it more easy for the final user (I'll release the code after so i would like to make it as best its possible)

Are you willing to get involved in writing USB host drivers? If not, the only options I can see are (1) assume that any device of the correct sort plugged in while the application is running corresponds to the Arduino (you might wait until you see 'one of everything' plugged in to avoid false detection) and (2) assuming a Windows host, look at the virtual device description in the host registry to detect which virtual devices have the same identity as the ones your Arduino is emulating.

Does your application actually need to know which keyboard, mouse etc corresponds to the Arduino, or only that the Arduino is plugged in?

Check this thread:

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=873787