I found out that it is possible to create a very simple USB device with two 
bulk endpoints with the g-serial kernel driver with ACM mode turned off:
*modprobe g-serial idVendor=0x18D1 idProduct=0x2D00 use_acm=0*

See attached "lsusb -v" output of the created gadget device. On the host 
side, a very simple "Hello World" program works (to write "Hello World" to 
the gadget, which can be read from /dev/ttyGS0 on the gadget side), see 
attached source file.

But the IOIO does unfortunately not connect to this gadget. Do you have any 
idea why? Does it require special endpoint addresses or other device 
descriptor properties? Tried idProduct=0x2D01, but it does not work as well.

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.
#include <stdio.h>

#include <libusb.h>

int main(void)
{
  libusb_context *ctx = NULL;
  int r = libusb_init(&ctx); //initialize a library session
  if(r < 0)
  {
    fprintf(stderr, "libusb_init failed: %d\n", r);
    return 1;
  }
  libusb_set_debug(ctx, 3);
  libusb_device_handle* dev = libusb_open_device_with_vid_pid(ctx, 0x18D1, 0x2D00);
  if (!dev)
  {
    fprintf(stderr, "USB device with VID 0x18D1 / PID 0x2D00 not found or not accessible!\n");
    return 1;
  }
  r = libusb_claim_interface(dev, 0);
  if(r != 0)
  {
    fprintf(stderr, "libusb_claim_interface failed: %d\n", r);
    return 1;
  }
  unsigned char data[] = "Hello World!";
  int transferred = 0;
  r = libusb_bulk_transfer(dev, 0x01, data, sizeof(data), &transferred, 1000);
  if ((r != 0) || (transferred == 0))
  {
    fprintf(stderr, "libusb_bulk_transfer failed: %d\n", r);
    return 1;
  }
  libusb_close(dev);
  return 0;
}

Bus 001 Device 006: ID 18d1:2d00 Google Inc. Android-powered device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x18d1 Google Inc.
  idProduct          0x2d00 Android-powered device in accessory mode
  bcdDevice            3.08
  iManufacturer           1 Linux 3.8.13 with usb338x
  iProduct                2 Gadget Serial v2.4
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 Generic Serial config
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000f
      Device can operate at Low Speed (1Mbps)
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat           1 micro seconds
    bU2DevExitLat         500 micro seconds
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

Reply via email to