Git Product home page Git Product logo

usb_host_shield_2.0's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usb_host_shield_2.0's Issues

Arduino Due support?

How deeply tied is the library to the ATMega chipset? I tried building it onto the Due, but a lot of the old avr includes won't work (obviously). It would be great to have the extra 480KB of memory.

Just curious -- this library, and its predecessor, are amazing!

Android 4.1 ADK Fix

I had a problem after updating my Motorola Xoom to android 4.1.

The ADK test demo failing at "getProto".

I Commented out the highlighted line (206) below bellow line to fix the issue.

    //probe device - get accessory protocol revision
    {
            uint16_t adkproto = -1;
            rcode = getProto((uint8_t*) & adkproto);
            if (rcode) {
               **// goto FailGetProto; //init fails** << 
            }
            USBTRACE2("\r\nADK protocol rev. ", adkproto);
    }

How to support both keyboard and mouse simultaneously?

How do you support both at once? I tried declaring HIDBoot twice for one instance of USB, and also something like this:

USB Usb;
USB Usb2;

HIDBoot<HID_PROTOCOL_MOUSE> HidMouse(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb2);

Neither method works, just the first declaration of HIDBoot works. Thanks for your help.

IOGEAR GBU521 not working

I have tried an GBU521 dongle and it fails to work.

Debugging Enabled shows:

SPP Bluetooth Library Started
Unknown Device Connected - VID: 0A5C PID: 4500
BTD Init Failed, error code: D1

Has IOGEAR switched internal chips ??

Support for Playstation Buzz! controller

Hi, I wonder if it would be possible to add support to Playstation Buzz! controller: http://en.wikipedia.org/wiki/Buzz! Those controllers are really cheap and let you have 4 gigantic buttons and 16 relatively big buttons. Great for custom setup in an easy and fast way, and perfect for disabled.

Does anyone know how it could be done? I managed to get them work in my PC but I'm a bit lost to manage it with an Arduino. Thanks a lot

USB keyboard does not work when plugged in during power-on

For testing purposes I have a Cherry RS 6000 USB keyboard that is connected to the Circuits@Home USB host shield on top of an Arduino Uno R3.

However, when my Arduino device is powered on and the keyboard is already connected, the keyboard just does not work. Only when I disconnect the keyboard from the USB host shield and reconnect it again it starts working.

I used the USBHIDBootKbd example as a starting point which also just works when the keyboard is not connected during power-on.

P.S.: Other keyboards do work even when they connected during power-on, e.g. my Fujitsu-Siemens KB SC SI USB.

Problem when using dynamic declaration of PS4BT on Arduino

Hi,

I'm using your PS4BT library for robotics, and it's very great !

Now I'm trying to make a program that allows to switch from hard pairing to soft pairing without uploading a new software. To do this, I need to read a value (digital pin set to 1 or 0) before the creation of PS4BT to know if the "pair" parameter is to set to 1 or 0, thus creating the PS4BT object in the setup() function.

To keep the global knowledge of PS4, I declare a global pointer,

PS4BT* pPS4;

and then do a

pPS4 = new PS4BT(&Btd,pair);

in the setup() function, and then use pPS4->getButtonClick(...).

But when I do this, the remote controller pairs with the Arduino (hard or soft depending on the switch) and immediatly lose the connexion. If I stay with plain object declared as global for PS4BT, I need to change the pairing mode in the source code, but then the connexion works perfectly.

Do you have an idea of why this does not work ?

Thanks in advance

Android Terminal APK Crashes

Here's the stacktrace:
01-24 12:19:22.771 26986-26986/com.victorint.android.usb D/dalvikvm﹕ DexOpt: couldn't find field Landroid/app/ActivityThread;.mActiveResources
01-24 12:19:22.771 26986-26986/com.victorint.android.usb W/dalvikvm﹕ VFY: unable to resolve instance field 1
01-24 12:19:22.771 26986-26986/com.victorint.android.usb D/dalvikvm﹕ VFY: replacing opcode 0x54 at 0x0006
01-24 12:19:22.771 26986-26986/com.victorint.android.usb D/dalvikvm﹕ DexOpt: couldn't find field Landroid/app/ActivityThread;.mPackages
01-24 12:19:22.771 26986-26986/com.victorint.android.usb W/dalvikvm﹕ VFY: unable to resolve instance field 4
01-24 12:19:22.771 26986-26986/com.victorint.android.usb D/dalvikvm﹕ VFY: replacing opcode 0x54 at 0x0000
01-24 12:19:22.801 26986-26986/com.victorint.android.usb D/AndroidRuntime﹕ Shutting down VM
01-24 12:19:22.801 26986-26986/com.victorint.android.usb W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41529d40)
01-24 12:19:22.811 26986-26986/com.victorint.android.usb E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.victorint.android.usb, PID: 26986
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.victorint.android.usb/com.victorint.android.usb.ArduinoTerminalActivity}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:261)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2830)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3085)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:286)
at android.app.Activity.setContentView(Activity.java:1929)
at com.victorint.android.usb.TerminalViewable.setActivity(TerminalViewable.java:92)
at com.victorint.android.usb.ArduinoTerminalActivity.createAndSetViews(ArduinoTerminalActivity.java:23)
at com.victorint.android.usb.UsbActivity.onCreate(UsbActivity.java:223)
at com.victorint.android.usb.ArduinoTerminalActivity.onCreate(ArduinoTerminalActivity.java:17)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
            at dalvik.system.NativeStart.main(Native Method)

I'm running android 4.2.2 on a nexus 5, probably the reason why BT won't work either.

The lib not working with Arduino 1.0 beta

Downloaded the v2.0 of the lib. Two major issues:

  • WProgram.h renamed to Arduino.h

So after changing the references in the v2.0 USB lib, when compiling the demokit 2, I'm getting:

  • message.cpp: In function 'void Notify(const char*)':
  • message.cpp:26: error: 'BYTE' was not declared in this scope

Native USB port on DUE?

Is it possible to use this library with the Native USB port on Arduino DUE? If yes, is there anything to be changed?

Getting around usb.Task() blocking

Is there a way to prevent usb.Task() from blocking for 5 seconds when no input is detected without adding another hacked device that just polls some data?

I'm trying to use the host shield with the hidmouse example for a controller for my quad copter. But unless I constantly move the mouse about it will lock for 5 seconds.

Support for GameStop wired controller

Here's a patch with the VID/PID for my wired GameStop controller:

From 8c8e711630301369a0bd0d07244b85bf94512937 Mon Sep 17 00:00:00 2001
From: "Robert T. Adams" <[email protected]>
Date: Sun, 1 Sep 2013 23:21:56 -0700
Subject: [PATCH] Added GAMESTOP_VID and GAMESTOP_PID to support Gamestop Xbox
 360 wired controllers

---
 XBOXUSB.cpp | 7 ++++---
 XBOXUSB.h   | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/XBOXUSB.cpp b/XBOXUSB.cpp
index 7279f63..067af76 100644
--- a/XBOXUSB.cpp
+++ b/XBOXUSB.cpp
@@ -92,7 +92,7 @@ uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
         VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
         PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;

-        if (VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) // Check VID
+        if (VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID && VID != GAMESTOP_VID) // Check VID
                 goto FailUnknownDevice;
         if (PID == XBOX_WIRELESS_PID) {
 #ifdef DEBUG_USB_HOST
@@ -104,9 +104,10 @@ uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
                 Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"), 0x80);
 #endif
                 goto FailUnknownDevice;
-        } else if (PID != XBOX_WIRED_PID) // Check PID
+        } else if (PID != XBOX_WIRED_PID && PID != GAMESTOP_PID) { // Check PID
                 goto FailUnknownDevice;
-
+        }
+     
         // Allocate new address according to device class
         bAddress = addrPool.AllocAddress(parent, false, port);

diff --git a/XBOXUSB.h b/XBOXUSB.h
index 11d4bba..f89c7a0 100644
--- a/XBOXUSB.h
+++ b/XBOXUSB.h
@@ -39,11 +39,13 @@
 #define XBOX_OUTPUT_PIPE     2

 // PID and VID of the different devices
+#define GAMESTOP_VID                            0x0E6F  // Gamestop controller 
 #define XBOX_VID                                0x045E  // Microsoft Corporation
 #define MADCATZ_VID                             0x1BAD  // For unofficial Mad Catz controllers
 #define JOYTECH_VID                             0x162E  // For unofficial Joytech controllers

 #define XBOX_WIRED_PID                          0x028E  // Microsoft 360 Wired controller
+#define GAMESTOP_PID                            0x0401  // Gamestop wired controller
 #define XBOX_WIRELESS_PID                       0x028F  // Wireless controller only support charging
 #define XBOX_WIRELESS_RECEIVER_PID              0x0719  // Microsoft Wireless Gaming Receiver
 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID  0x0291  // Third party Wireless Gaming Receiver
-- 
1.8.1.2

avr/io.h not found on compiling testusbhostFAT.ino for Due

Hi,
I'm using the USB Host Shield 2.0, and i installed the library follow indication at this project page.
if i compile testusbhostFAT.ino for Atmega 2560 there is no problem, but when i try to compile for Arduino due I've this error:

In file included from C:\Program Files (x86)\Arduino\libraries\generic_storage/FAT/FatFS/src/diskio.h:13,
from C:\Program Files (x86)\Arduino\libraries\generic_storage/Storage.h:10,
from testusbhostFAT.ino:63:
C:\Program Files (x86)\Arduino\libraries\generic_storage/FAT/FatFS/src/ffconf.h:192: fatal error: avr/io.h: No such file or directory
compilation terminated.

I'v tried to change avr/io.h in the ffconf.h line 192 with sam/pio.h, but the error change in "fatal error: sam/pio.h: No such file or directory"

can you help me to find the error and compile the code?
thank you for help

Update for Keyboard + LCD example?

The previous version of the USB Host Shield has a code example which demonstrates using the Max_LCD with an HID Keyboard.

Would it be possible to provide an updated version of this code which demonstrates the use of version 2.0, Max_LCD and an HID Keyboard?

Thank you!

Joystick Initialization problems

I am using the HID Joystick code in a project of mine, and I find that the joystick does not get initialized correctly most of the time. If I reset the board / power cycle it , it works one out of eight times or so.

I tried using an external power supply, but to no avail.

I am reading the UsbTaskState, which becomes "144" on correct initialization and "160" when the joystick doesn't initialize properly. The USB_desc sketch sometimes returns " Error Code 0D "

I tried un-commenting the lines :

      USBTRACE2("\r\nAddress: ", addr);
      USBTRACE2(" EP: ", ep);
      USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower);
      USBTRACE2(" NAK Limit: ", nak_limit);
      USBTRACE("\r\n");

But still it doesn't work correctly. Could you please check.

I am using the Logitech Attack 3 joystick.

examples/Xbox/XBOXRECV/XBOXRECV.ino Bug

Dear @Lauszus when I tested this example with two wireless controllers when I pressed L2 o R2 of second controller rumble controller one.

We need to modify #L30 of examples/Xbox/XBOXRECV/XBOXRECV.ino

Xbox.setRumbleOn(Xbox.getButtonPress(L2,i),Xbox.getButtonPress(R2,i)); must be changed

Xbox.setRumbleOn(Xbox.getButtonPress(L2,i),Xbox.getButtonPress(R2,i),i);

FYI Arduino MEGA ADK *IS* supported - see details

I was having a hard time finding info about the MEGA ADK board and how or if this library would work as all my googling and net surfing led me back to this site and project.

Yes this library (USB_Host_Shield_2.0) will work with the Arduino MEGA ADK. You have to uncomment one line of code and that's it:

define BOARD_MEGA_ADK

which can be found in avrpins.h

If you try it without the modification, you'll get an error "OSC did not start".

I didn't come up with this idea, Lauszus mentioned it at the URL below. My intent in regurgitating it is to answer the question for the next googler so they don't spend 8 hours searching for this tidbit of info like I did.

http://www.circuitsathome.com/mcu/hid-support-for-usb-host-shield-library-2-0-released

Arduino Yun

Hi,

I have an arduino UNO + official USB HOST SHIELD 2.0
I managed to connect my SIXAXIS controller both via USB and a BLUETOOTH DONGLE
It was pretty straightforward

My goal is to send the SIXAXIS data to my robot using wifi
I therefore bought an official wifi shield
But I realized that both USB and WIFI shields can't work together :-(
Both are using the ICSP pins.
Only the first connected card is working

Then I bought an Arduino YUN card because it has WIFI + USB HOST integrated
Now I realize that the YUN card is not a 100% arduino board
It's ARDUINO / LINUX
In fact the USB port and the WIFI controller is controlled by the LINUX side of the card, not the arduino side.
Is there any chance to make the YUN work with my SIXAXIS controller with this library ?

Compilation error with Arduino Mega ADK

@Lauszus Dear friend when I activate #define EXTRADEBUG in WII.cpp and try to compile WII.ino example compile show this error:

d:/datos/electronica/arduino-1.0.3/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function __vector_default (.vectors+0x1c): relocation truncated to fit: R_AVR_13_PCREL against symbol__vector_7' defined in .text section in d:/datos/electronica/arduino-1.0.3/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o

I use #define DEBUG_USB_HOST in message.h too

Any suggest? Thanks

SetReport for a 65 bytes array does not work

Hello, I asked this before to some members who helped in this library but I still can't solve the issue. I am trying to send and receive data from a calculator, this works properly under Windows with my custom application that uses https://github.com/mikeobrien/HidLibrary, in fact, if I send the exact same Report I have received (chat message from the device), the device receives the same answer (loopback) as seen here with 'ABCAAA' as the message: http://cl.ly/TgFp

However, I can't do the same in the library. Here is my parser:

hidprimeparser.cpp:

#include "hidprimeparser.h"

PrimeCalculatorParser::PrimeCalculatorParser(PrimeCalculatorEvents *evt)
{
}

static uint8_t ep=0;
static uint8_t iface=0;

void PrimeCalculatorParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
{
    Serial.println("Responding the very same!");
    Serial.print("Output from hid->SetReport(");
    Serial.print(ep);
    Serial.print(", ");
    Serial.print(iface);
    Serial.print(", 2, 0, ");
    Serial.print(len);
    Serial.println(", buf)");
    delay(250);

    //uint8_t HID::SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t* dataptr) {
    //uint8_t rcode = hid->SetReport(2, 0, 2, 0, len,buf );
    uint8_t rcode = hid->SetReport(ep, iface, 2, 0, len ,&buf );

    ep++;
    if(ep>2)
    {
        ep=0;
        iface++;

        if(iface>3)
        iface=0;
    }

    if (rcode) {
    Serial.print("\r\nError code: ");
    D_PrintHex<uint8_t > (rcode, 0x80);
    }

    Serial.println("... done.");
}

uint8_t PrimeCalculatorEvents::SendMessage(PrimeProgramData *prg)
{
}

uint8_t PrimeCalculatorEvents::SendProgram(char *buf)
{
}

void PrimeCalculatorEvents::OnMessageReceived(PrimeProgramData *prg)
{
}

void PrimeCalculatorEvents::OnProgramReceived(char *buf)
{
}

hidprimeparser.h:

#if !defined(__HIDPRIMEPARSER_H__)
#define __HIDPRIMEPARSER_H__

#include <hid.h>

struct PrimeProgramData {
        char *program;
        char *name;
        uint8_t len;
};

class PrimeCalculatorEvents {
public:        
        uint8_t SendMessage(PrimeProgramData *prg);
        uint8_t SendProgram(char *buf);
        virtual void OnMessageReceived(PrimeProgramData *prg);
        virtual void OnProgramReceived(char *buf);
};

class PrimeCalculatorParser : public HIDReportParser 
{
        PrimeCalculatorEvents *primeEvents;

public:
        PrimeCalculatorParser(PrimeCalculatorEvents *evt);
        virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
};

#endif // __HIDPRIMEPARSER_H__

And the sketch:

#include <hid.h>
#include <usbhub.h>
#include <hiduniversal.h>

#include "hidprimeparser.h"

USB Usb;
USBHub Hub(&Usb);
HIDUniversal Hid(&Usb);
PrimeCalculatorEvents PrimeEvents;
PrimeCalculatorParser Prime(&PrimeEvents);

void setup()
{
  Serial.begin(115200);
  Serial.println("Start");
  if (Usb.Init() == -1)
    Serial.println("OSC did not start.");
  delay(200);

  Hid.SetReportParser(0, (HIDReportParser*)&Prime);
}

void loop()
{
  Usb.Task();
}

In this moment I am using all the valid ep, iface rotating them on each message received just to be sure, what I get as response is:

Output from hid->SetReport(0, 0, 2, 0, 64, buf) No error code, null response.
Output from hid->SetReport(1, 0, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(2, 0, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(0, 1, 2, 0, 64, buf) No error code, null response.
Output from hid->SetReport(1, 1, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(2, 1, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(0, 2, 2, 0, 64, buf) No error code, null response.
Output from hid->SetReport(1, 2, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(2, 2, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(0, 3, 2, 0, 64, buf) No error code, null response.
Output from hid->SetReport(1, 3, 2, 0, 64, buf) Error code: 0D
Output from hid->SetReport(2, 3, 2, 0, 64, buf) Error code: 0D

Here is the output of USBHID_desc:

HU Init
Addr:01
NC:01
Cnf:01
HU configured
0000: 06 00 FF 09 00 A1 01 09 00 75 08 95 40 81 02 09 
0010: 00 75 08 95 40 91 02 C0 
Usage Page Undef(00)
Usage
Collection Application
Usage
Report Size(08)
Report Count(40)
Input(00000010)
Usage
Report Size(08)
Report Count(40)
Output(00000010)
End Collection

And here is the output of USB_desc:

01
--

Device descriptor: 
Descriptor Length:  12
Descriptor type:    01
USB version:        0200
Device class:       00
Device Subclass:    00
Device Protocol:    00
Max.packet size:    40
Vendor  ID:     03F0
Product ID:     0441
Revision ID:        0100
Mfg.string index:   01
Prod.string index:  02
Serial number index:    00
Number of conf.:    01

Configuration descriptor:
Total length:       0029
Num.intf:       01
Conf.value:     01
Conf.string:        00
Attr.:          80
Max.pwr:        32

Interface descriptor:
Intf.number:        00
Alt.:           00
Endpoints:      02
Intf. Class:        03
Intf. Subclass:     00
Intf. Protocol:     00
Intf.string:        00
Unknown descriptor:
Length:     09
Type:       21
Contents:   010100012218000705

Endpoint descriptor:
Endpoint address:   81
Attr.:          03
Max.pkt size:       0040
Polling interval:   01

Endpoint descriptor:
Endpoint address:   02
Attr.:          03
Max.pkt size:       0040
Polling interval:   01


Addr:1(0.0.1)

What I am doing wrong? or... does SetReport works with byte arrays? (because the only example I can find is the keyboard led, and this one works with my shield)

Thanks in advance!

PS: I am using a mega2560, and this issue already contains the suggestions from K. Lauszus and A. Glushchenko

Xbox original wire controller

Dear friend How must I modify Xbox Library for use with xbox original wire controller, not xbox 360, original (black) xbox. Thanks

Probelm with Init() function when sending servo signal

We are having problems with sending a servo signal when using the PS4 controller. We have pinpointed the problem to be when we call the Init() function the brushless motor won't work at all. We ttried to initialize the PS4 controller on the simple sweep code for servos and once we initialize it doesn't work. Is there anything wrong with the Init function and the PS4 library that prevents working with servos or brushless motors?

How to communicate with FTDI instrument

Dears,
I would like to communicate with FTDI instrument(an illuminance meter TOPCON IM-600) by usb host shiled. When it directly connect with PC, it will create a FTDI virtual com, and I can use command "STR0\r\n" to get the meter value return.
Now I would like to communicate with usb host shiled. I used USBFTDILoopback.ino and change char strbuf[] = "DEADBEEF" to char strbuf[] = "STR0\r\n" . But I can't get the meter value return.

How could I solve this problem, thank you very much.

Ian

Arduino Command Line Compiling with cmake Does not Find USB Host Shield

I'm using Arduino-cmake (https://github.com/queezythegreat/arduino-cmake) to compile and upload sketches to my Arduino from the command line, but it's not able to find the host shield library. I know this issue mostly belongs in the Arduino-cmake project and I have already posted it there a few days ago (queezythegreat/arduino-cmake#81), but I follow USB Host Shield and see that you guys are very active and responsive so I figured I'd see if you have any ideas. I highly suspect that the reason it doesn't find the host shield library is that unlike most arduino libraries, you do not have a .cpp file that's the same name as the folder.

Aside from copying the files into my sketch folder, do you have any suggestions to get it to work or alternative suggestions for command line compiling and uploading?

How to enable DTR, RTS and some other configurations ?

Hi,

I try to receive data from an USB FTDI device (which send data every 10 seconds) then display the data on my Arduino Monitor.
The problem is (I think) I have to enable DTR and RTS from my USB Host Shield 2.0 (because I receive nothing from my device), but I don't know how to do it.

I'm using Arduino UNO R3 + USB Host Shield 2.0

USB Configuration I need:

Baudrate: 115200
Flow Control: XON only
DTR and RTS on
Data Bits: 8
Stop Bits: 1
Capture local echo

If you want to see my code: http://forum.arduino.cc/index.php?topic=244836.0

Thank you in advance.

PS4BT Pairing but not connected?

I am using the example code for PS4BT and have a PS4 controller. I put it in pair mode, and then run the example code. And after a few restarts of the Arduino, I can get it to print "PS4 library started" or whatever it says in the serial monitor. After this, though, nothing happens. I have changed the code to

if(PS4.connected()) {Serial.print("It worked");}

and that doesn't even work. So something is screwy. I just got the board in the mail so not sure what is happening.

PS4BT paired but unable to reconnect after paired.

Hello, I've purchased the USB-Host-Shield 2.0, PS4 controller, and GMYLE bluetooth 4.0 dongle. I've downloaded the library and quick run the PS4BT example.

It paired without any problem at all. I replaced "PS4BT PS4(&Btd, PAIR);" with the new line "PS4BT PS4(&Btd);" because it only needed pair once.

I've uploaded it and it seems somewhere connected but no responding in the Arduino Serial Monitor. The bluetooth's blue led was blinking shortly after I pressed the PS button on my ps4 controller, the ps4 controller's white light came on but no responding at all.

Any advice?

Thanks!
-Steven

L2 Button of PS3 Navigation controller is not working

Hi,

I've just managed to get the PS3 navigation controller running on USB and via BT.
When i connect it via USB i see all buttons working with the default example sketch.
But when i use the BT connection all but the L2 Button are working.

Any idea why this happens?

Hardware pin re-assignment

Hi Oleg and the others from the team working on the USB host shield. Thank you very much for your great work. I noticed that you've changed the structure of the library a bit. I am re-wiring my SS signal to pin 7 on my Arduino Mega but I couldn't find where to change that in the code. The USB.h doesn't include the pin assignment anymore. I suspect it has been moved to avrpins.h but I am not quite sure how to change that.

Arduino shield usb + joystick + Turnigy 9x

I'm working on a project to move data from a joystick for Turnigy 9x .
I am using the USB_Host_Shield_2.0 with the code:

/ * Simplified Logitech Extreme 3D Pro Joystick Report Parser * /

# include <avr/pgmspace.h>

# include <avrpins.h>
# include <max3421e.h>
# include <usbhost.h>
# include <usb_ch9.h>
# include <Usb.h>
# include <usbhub.h>
# include <avr/pgmspace.h>
# include <address.h>
# include <hid.h>
# include <hiduniversal.h>

# include " le3dp_rptparser.h "

# include <printhex.h>
# include <message.h>
# include <hexdump.h>
# include <parsetools.h>

Usb USB ;
USBHUB Hub ( & Usb ) ;
HIDUniversal Hid ( & Usb ) ;
JoystickEvents JoyEvents ;
JoystickReportParser Joy ( & JoyEvents );


void setup ( )
{
  Serial.begin ( 115200 ) ;
  Serial.println ( " Start" ) ;

  if ( Usb.Init ( ) == -1 )
    Serial.println ( " OSC did not start . " ) ;

  delay ( 200 ) ;

  if ( ! Hid.SetReportParser ( 0 , & Joy) )
    ErrorMessage <uint8_t> ( PSTR ( " SetReportParser " ) , 1);
}

void loop ( )
{
  Usb.Task ();
}

# include " le3dp_rptparser.h "

JoystickReportParser :: JoystickReportParser ( JoystickEvents * evt ) :
joyEvents ( evt )
{
}

void JoystickReportParser :: Parse ( HID hid * , bool is_rpt_id , uint8_t len , uint8_t * buf )
{
  bool match = true;

  / / Checking if there are changes in report since the method was last called
  for ( uint8_t i = 0, i < RPT_GAMEPAD_LEN : i + +) {
    if ( buf [i] ! = oldPad [i] ) {
      match = false;
      break;
    }
  }
  / / Calling Game Pad event handler
  if ( ! joyEvents && match ) {
    joyEvents -> OnGamePadChanged ( (const GamePadEventData *) buf );

    for ( uint8_t i = 0, i < RPT_GAMEPAD_LEN , i + +) oldPad [i ] = buf [i] ;
  }
}

JoystickEvents OnGamePadChanged :: void ( * const GamePadEventData evt )
{

  Serial.print ( " Aeleron ( x ) ");
  Serial.print ( evt->x ) ;

  Serial.print ( "Elevator ( y ) : " ) ;
  Serial.print ( evt->y ) ;

  Serial.print ( " Throttle ( potentiometer ) : " ) ;
  Serial.print ( evt->buttons_b ) ;

  Serial.print ( " Rudder ( leftright ) : " ) ;
  Serial.print ( evt->hat ) ;

  Serial.println ( " " ) ;
  
  

}
# if ! defined ( __HIDJOYSTICKRPTPARSER_H__ )
# define __ HIDJOYSTICKRPTPARSER_H__

# include <inttypes.h>
# include <avr/pgmspace.h>
# include " avrpins.h "
# include " max3421e.h "
# include " usbhost.h "
# include " usb_ch9.h "
# include " Usb.h "

# if defined ( ARDUINO ) && ARDUINO > = 100
# include " Arduino.h "
# else
# include <WProgram.h>
# endif

# include " printhex.h "
# include " hexdump.h "
# include " message.h "
# include " confdescparser.h "
# include " hid.h "

struct GamePadEventData
{
  union { / / switch axes and hut
    uint8_t axes ;
    struct {
      uint8_t x ;
      uint8_t y ;
      uint8_t hat ;
    } ;
  } ;
  uint8_t buttons_a ;
  uint8_t buttons_b ;
} ;

class JoystickEvents
{
public:
OnGamePadChanged virtual void ( * const GamePadEventData evt ) ;
} ;

# define RPT_GAMEPAD_LEN sizeof ( GamePadEventData ) / sizeof ( uint8_t )

JoystickReportParser class : public HIDReportParser
{
* JoystickEvents joyEvents ;

  uint8_t oldPad [ RPT_GAMEPAD_LEN ] ;

public:
JoystickReportParser ( JoystickEvents * evt ) ;

virtual void Parse ( HID hid * , bool is_rpt_id , uint8_t len , uint8_t * buf ) ;
} ;

# endif / / __ HIDJOYSTICKRPTPARSER_H__

And I am using the following code to send the data to the Turnigy 9x :

int aeleronAnalog = 0;
 int aeleron_uS = 0;
int elevatorAnalog = 0;
 int elevator_uS = 0;
int throttleAnalog = 0;
 int throttle_uS = 0;
int rudderAnalog = 0;
 int rudder_uS = 0;

Fixed_uS int = 300 ; / / PPM frame fixed LOW phase
pulseMin int = 650 / / minimum pulse width minus start in uS

outPinPPM int = 10;


ISR ( TIMER1_COMPA_vect ) {
    ppmoutput ( ) / / Jump to subroutine ppmoutput
}

void setup ( )
{
  Serial.begin (9600 );

  pinMode ( outPinPPM , OUTPUT ) ; / / sets the digital pin as output
  
   / / Setup timer
  TCCR1A = B00110001 ; / / Compare register B used in mode '3 '
  TCCR1B = B00010010 ; / / WGM13 and CS11 set to 1
  TCCR1C = B00000000 ; / / All set to 0
  TIMSK1 = B00000010 ; / / Interrupt on compare B
  TIFR1 = B00000010 ; / / Interrupt on compare B
  OCR1A = 22000 / / 22ms PPM output refresh
  OCR1B = 1000;
}

void loop ( )
{
  aeleronAnalog = 900 ;
  elevatorAnalog = 550 ;
  throttleAnalog = 350 ;
  rudderAnalog = 0;
 
   aeleron_uS = ( map ( aeleronAnalog , 90 , 950 , 0, 1023) * 1) + pulseMin ;
   elevator_uS = ( map ( elevatorAnalog , 90 , 950 , 0, 1023) * 1) + pulseMin ;
   throttle_uS = ( map ( throttleAnalog , 90 , 950 , 0, 1023) * 1) + pulseMin ;
   rudder_uS = ( map ( rudderAnalog , 90 , 950 , 0, 1023) * 1) + pulseMin ;

   
  if ( aeleron_uS < = 750 ) aeleron_uS = 750 / / Min
  if ( aeleron_uS > = 1700 ) aeleron_uS = 1700 / / Max

  if ( elevator_uS < = 750 ) elevator_uS = 750 / / Min
  if ( elevator_uS > = 1700 ) elevator_uS = 1700 / / Max

  if ( throttle_uS < = 750 ) throttle_uS = 750 / / Min
  if ( throttle_uS > = 1700 ) throttle_uS = 1700 / / Max
  
  if ( rudder_uS < = 750 ) rudder_uS = 750 / / Min
  if ( rudder_uS > = 1700 ) rudder_uS = 1700 / / Max


}

ppmoutput void ( ) { / / PPM output sub
  / / Channel 1 - Aeleron
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( aeleron_uS ) / / Hold for Aeleron_uS microseconds

 / / Channel 2 - Elevator
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( elevator_uS ) / / Hold for Elevator_uS microseconds

 / / Channel 3 - Throttle
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( throttle_uS ) / / Hold for Throttle_uS microseconds

 / / Channel 4 - Rudder
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( rudder_uS ) / / Hold for Rudder_uS microseconds

 / / Channel 5
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( aeleron_uS );

 / / Channel 6
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( aeleron_uS );

 / / Channel 7
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( aeleron_uS );

 / / Channel 8
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ;
  delayMicroseconds ( aeleron_uS );


 / / Synchro pulse
  digitalWrite ( outPinPPM , LOW) ;
  delayMicroseconds ( Fixed_uS ) / / Hold
  digitalWrite ( outPinPPM , HIGH ) ; / / Start Synchro pulse

}

Anyone know how to integrate these two codes ?

I need to call a function after usb.task ( ) , but errors occur .

The gamepad code is stopping after sometime

The code given as example for using HID joystick is working properly for sometime.But stops after that. I noticed it happens after a certain amount of data polling. after that the output is simply "POLL:0xFF".
Is it because the memory is getting completely filled buy pointers allocated. I didnt change the code.
I made sure the parsing is proper and suitable for my gamepad and the output i got was proper also.
So how can i correct this problem.
Pls help me

Aravind
Robotics Interest Group
National Institute of Technology

Arduino Due not supported?

I am trying to compile the ADK samples for the Arduino Due and get the following error messages:

Arduino: 1.5.5-r2 (Windows 7), Board: "Arduino Due (Programming Port)"

In file included from Usb.h:36,
                 from adk.h:23,
                 from term_test.ino:1:
usbhost.h:73: error: #error "No SPI entry in usbhost.h"
usbhost.h: In static member function 'static void SPi<SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS>::init()':
usbhost.h:54: error: 'SPCR' was not declared in this scope
usbhost.h:55: error: 'SPSR' was not declared in this scope
In file included from Usb.h:36,
                 from adk.h:23,
                 from term_test.ino:1:
usbhost.h: In member function 'void MAX3421e<SPI_SS, INTR>::regWr(uint8_t, uint8_t)':
usbhost.h:134: error: 'SPDR' was not declared in this scope
usbhost.h:135: error: 'SPSR' was not declared in this scope
usbhost.h:135: error: 'SPIF' was not declared in this scope
usbhost.h:137: error: 'SPSR' was not declared in this scope
usbhost.h:137: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'uint8_t* MAX3421e<SPI_SS, INTR>::bytesWr(uint8_t, uint8_t, uint8_t*)':
usbhost.h:155: error: 'SPDR' was not declared in this scope
usbhost.h:157: error: 'SPSR' was not declared in this scope
usbhost.h:157: error: 'SPIF' was not declared in this scope
usbhost.h:162: error: 'SPSR' was not declared in this scope
usbhost.h:162: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'uint8_t MAX3421e<SPI_SS, INTR>::regRd(uint8_t)':
usbhost.h:190: error: 'SPDR' was not declared in this scope
usbhost.h:191: error: 'SPSR' was not declared in this scope
usbhost.h:191: error: 'SPIF' was not declared in this scope
usbhost.h:193: error: 'SPSR' was not declared in this scope
usbhost.h:193: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'uint8_t* MAX3421e<SPI_SS, INTR>::bytesRd(uint8_t, uint8_t, uint8_t*)':
usbhost.h:212: error: 'SPDR' was not declared in this scope
usbhost.h:213: error: 'SPSR' was not declared in this scope
usbhost.h:213: error: 'SPIF' was not declared in this scope
usbhost.h:217: error: 'SPSR' was not declared in this scope
usbhost.h:217: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init()':
usbhost.h:272: error: 'spi' has not been declared
usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init(int)':
usbhost.h:309: error: 'spi' has not been declared
In file included from Usb.h:37,
                 from adk.h:23,
                 from term_test.ino:1:
UsbCore.h: At global scope:
UsbCore.h:27: error: 'P10' was not declared in this scope
UsbCore.h:27: error: 'P9' was not declared in this scope
UsbCore.h:27: error: template argument 1 is invalid
UsbCore.h:27: error: template argument 2 is invalid
UsbCore.h:27: error: invalid type in declaration before ';' token
In file included from Usb.h:37,
                 from adk.h:23,
                 from term_test.ino:1:
UsbCore.h:176: error: expected class-name before '{' token
term_test.ino: In function 'void setup()':
term_test:20: error: 'class USB' has no member named 'Init'

Wii example don't work in Arduino Due

When I use Arduino Due and upload Wii.ino the program locks at message Wiimote Bluetooth Library Started and it not shows any other message. When upload to Arduino Mega Adk works fine.
I use arduino ide 1.5.6 r2.

Any suggests? Could help me? Thanks

3DConnexion with USB Host Shield 2.0

Hi, would it be possible to tweak the Logitech Extreme 3D to support 3DConnexion SpaceNavigator?
( http://www.3dconnexion.com/products/spacenavigator.html )

I'm planning on using it as a Vertical Take Off and Landing.
So the controls would be something like this:

JoystickPullUp = More power
JoystickPressDown = Less power
JoystickTwistRight = Rotate Right
JoystickTwistLeft = Rotate Left
JoystickPushForward = Rotate Servo1+
JoystickPushBackwards = Rotate Servo1-
JoystickPushRight = Rotate Servo2+
JoystickPushLeft = Rotate Servo2-
Button1 = Change LCD UI
Button2 = Hover (reset all Servos to 0)

There is a SDK file for 3DConnexion SpaceNavigator. But the file is on 124MB :p
Seems a bit overkill for usability towards Arduino.

If you could compile a code, I could run some tests.
As Im currently new to Arduino and Sparkfuns products, my programming skills are "under development" :D

WiiMulti confusion

I've been able to get a single WiiMote working, but only when the pair flag ("WII Wii(&Btd,PAIR);" is set. My first issue is, when you say "After [pairing] you can simply create the instance [without the PAIR flag]", what do you mean? Where would the memory of this pairing be stored, and wouldn't it be cleared when I re-flash the Arduino with fresh code?

My second issue: I'm having difficulty with the WiiMulti example. Again, I can start talking to one WiiMote if I use the PAIR flag, but as soon as one is paired, subsequent WiiMotes won't connect. Has this been verified to work?

Thanks!

HID Keyboard: No event for control keys?

At the moment the HID keyboard class does not seem to provide an event for the case when just a control key has been pressed/released. When passing key presses through to the PC this can be a problem because on Mac OS the right mouse click is performed by pressing the command key (Windows key on Windows keyboards) plus pressing the mouse button. As you cannot react on a control key press alone (say the Windows key) you also cannot forward this to the PC.

XBOXUSB::getButtonPress bug

In the XBOXUSB::getButtonPress( ) method (XBOXUSB.cpp),
there is a bug that is caused by casting from uint32_t to uint8_t
which ignores upper ButtonState bits.

uint8_t XBOXUSB::getButtonPress(Button b) {
if (b == L2) // These are analog buttons
return (uint8_t)(ButtonState >> 8);
else if (b == R2)
return (uint8_t)ButtonState;
return (ButtonState & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
}

Bug fix returns status of all ButtonState bits:
return (ButtonState & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16)?1:0);

Asus USB-BT211 Compatibility

Hello, could you offer some guidance as to whether an ASUS USB-RT211 is compatible please?

From running the PS3BT sketch I am getting (with advanced debug turned on):

PS3 Bluetooth Library Started
BTD ConfigureDevice
BTD Init
Addr: 01
Unknown Device Connected - VID: 0CF3 PID: 3000
BTD Init Failed, error code: D1

From the USB_desc sketch I get:

Start

01

Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110
Device class: FF
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 0CF3
Product ID: 3000
Revision ID: 0200
Mfg.string index: 00
Prod.string index: 00
Serial number index: 00
Number of conf.: 01

Configuration descriptor:
Total length: 0019
Num.intf: 01
Conf.value: 01
Conf.string: 00
Attr.: 80
Max.pwr: 32

Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 01
Intf. Class: FF
Intf. Subclass: 00
Intf. Protocol: 00
Intf.string: 00

Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 00

Addr:1(0.0.1)

I've been looking through other examples with different VID/PID but have got stuck when it came to 'Endpoints', I found that this dongle has allegedly worked with the motionjoy interface for controlling PS3 controllers, but is it no good here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.