How to read a USB joystick plugged into the native USB port?

Hi, I'm new to Arduino programming, but I'm having trouble reading from the USB native port on my Arduino DUE board.

I have a Cyborg PC Flight Stick v1 usb joystick connected to the native USB port on my DUE and I cannot detect any input from the joystick.

The program is as follows:

void setup() {
  // initialize serial:
  Serial.begin(9600);
  SerialUSB.begin(9600);
}

void loop() {
  // if there's any serial available, read it:
  while (SerialUSB.available() > 0) {
    Serial.println(SerialUSB.read());
    }
}

I can't seem to find any info on the SerialUSB class. What am I doing wrong? Any help would be appreciated!

You need to have a library for reading data from a USB joystick with your Arduino. For instance you could try

http://airspayce.com/mikem/arduino/USBJoystick.

Hey Alfred, Thank-you for your suggestion. I will definitely give that a try.

I am trying the same thing. I made it work about 10 minutes ago by "porting" parts of the USB Host Shield 2 stack. It's basically renaming "USB" class usages into USBHost as well as renaming quite a few uint8_t into uint32_t in the virtual methods.

I will do a clean port of it again and wrap it up as a library. If time allows I'll also write a short readme on how to port host shield stack drivers to the Due.

@rabinath,

can you publish your code, even if its not yet finished?

C

Any News about it?