I have a USB Modem that I am trying to send AT commands.
I have used modem with Microchip’s Generic host MLA and succeeded using Pic24.
I am trying to switch to .netmf and GHI libraries.
With GHI Code listed last…I can’t see the correct interface with endpoints having 512 packet size.
Using USBVIEW on PC I see them.
[line]
using USBview.exe
Device Descriptor
[/title]bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x12D1
idProduct: 0x1001
bcdDevice: 0x0000
iManufacturer: 0x02
0x0409: "HUAWEI Technology"
iProduct: 0x01
0x0409: "HUAWEI Mobile"
iSerialNumber: 0x00
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 9
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0040 (64)
bInterval: 0x05
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x01 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x83 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x84 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x03 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x04 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x85 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
Configuration Descriptor:
wTotalLength: 0x006C
bNumInterfaces: 0x04
bConfigurationValue: 0x01
iConfiguration: 0x03
0x0409: "Qualcomm Configuration"
bmAttributes: 0xE0 (Bus Powered Self Powered Remote Wakeup)
MaxPower: 0xFA (500 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x03
bInterfaceClass: 0xFF
bInterfaceSubClass: 0xFF
bInterfaceProtocol: 0xFF
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0040 (64)
bInterval: 0x05
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x01 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0xFF
bInterfaceSubClass: 0xFF
bInterfaceProtocol: 0xFF
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x83 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Interface Descriptor:
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0xFF
bInterfaceSubClass: 0xFF
bInterfaceProtocol: 0xFF
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x84 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Endpoint Descriptor:
bEndpointAddress: 0x03 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x20
Interface Descriptor:
bInterfaceNumber: 0x03
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x04 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x85 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00
[line]
Using firware found on Forum— I get Descriptors and Endpoints below…no 512 packet size
[line
Unknown Device connected.
ID = A09F7944
Port = 0
VID = 12D1
PID = 1001
Type = 0
Number of configurations . . . 1
Max Packet size . . . . . . . 64
Protocol code . . . . . . . . 00
Release number . . . . . . . . 00
Serial number index . . . . . 00
Subclass code . . . . . . . . 00
USB sepecification number . . 200
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 0
Protocol: 255
Type: 4
– Endpoint –
Attributes: 3
Address: 0081
Type: 5
Interval: 5
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0082
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0001
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 1
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 0083
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0002
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 2
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 0084
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0003
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Mass Storage
SubClass: 6
Number: 3
Protocol: 80
Type: 4
– Endpoint –
Attributes: 2
Address: 0004
Type: 5
Interval: 0
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0085
Type: 5
Interval: 0
MaxPacket: 64
So far, so good …
Unknown Device connected.
ID = A09F7944
Port = 0
VID = 12D1
PID = 1001
Type = 0
Number of configurations . . . 1
Max Packet size . . . . . . . 64
Protocol code . . . . . . . . 00
Release number . . . . . . . . 00
Serial number index . . . . . 00
Subclass code . . . . . . . . 00
USB sepecification number . . 200
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 0
Protocol: 255
Type: 4
– Endpoint –
Attributes: 3
Address: 0081
Type: 5
Interval: 5
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0082
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0001
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 1
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 0083
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0002
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 2
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 0084
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0003
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Mass Storage
SubClass: 6
Number: 3
Protocol: 80
Type: 4
– Endpoint –
Attributes: 2
Address: 0004
Type: 5
Interval: 0
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0085
Type: 5
Interval: 0
MaxPacket: 64
So far, so good …
Unknown Device connected.
ID = A09F7944
Port = 0
VID = 12D1
PID = 1001
Type = 0
Number of configurations . . . 1
Max Packet size . . . . . . . 64
Protocol code . . . . . . . . 00
Release number . . . . . . . . 00
Serial number index . . . . . 00
Subclass code . . . . . . . . 00
USB sepecification number . . 200
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 0
Protocol: 255
Type: 4
– Endpoint –
Attributes: 3
Address: 0081
Type: 5
Interval: 5
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0082
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0001
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 1
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 0083
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0002
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 2
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 0084
Type: 5
Interval: 32
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0003
Type: 5
Interval: 32
MaxPacket: 64
=== Interface ===
Class: Mass Storage
SubClass: 6
Number: 3
Protocol: 80
Type: 4
– Endpoint –
Attributes: 2
Address: 0004
Type: 5
Interval: 0
MaxPacket: 64
– Endpoint –
Attributes: 2
Address: 0085
Type: 5
Interval: 0
MaxPacket: 64
So far, so good …]
[line]
Code below:
[line]
using GHI.Usb.Host;
using Microsoft.SPOT;
using System.Threading;
using System.Text;
using System.IO;
public class Program
{
private static RawDevice raw;
public static void Main()
{
Controller.UnknownDeviceConnected += Controller_UnknownDeviceConnected;
Controller.UsbSerialConnected += Controller_Serial;
Controller.Start();
Thread.Sleep(-1);
}
static void Controller_Serial(object sender,UsbSerial sc)
{
Debug.Print("Serial Connected");
}
static void Controller_UnknownDeviceConnected(object sender, Controller.UnknownDeviceConnectedEventArgs unknowndevice)
{
Debug.Print("");
Debug.Print("Unknown Device connected.");
Debug.Print(" ID = " + unknowndevice.Id.ToString("X4"));
Debug.Print(" Port = " + unknowndevice.PortNumber);
Debug.Print(" VID = " + unknowndevice.VendorId.ToString("X4"));
Debug.Print(" PID = " + unknowndevice.ProductId.ToString("X4"));
Debug.Print(" Type = " + (BaseDevice.DeviceType)unknowndevice.Type);
raw = new RawDevice(unknowndevice.Id,
unknowndevice.InterfaceIndex,
unknowndevice.VendorId,
unknowndevice.ProductId,
unknowndevice.PortNumber,
BaseDevice.DeviceType.Unknown);
GHI.Usb.Descriptors.Device devdesc = raw.GetDeviceDescriptor();
Debug.Print("Number of configurations . . . " + devdesc.NumberOfConfigurations);
Debug.Print("Max Packet size . . . . . . . " + devdesc.MaximumPacketSize);
Debug.Print("Protocol code . . . . . . . . " + devdesc.ProtocalCode.ToString("X2"));
Debug.Print("Release number . . . . . . . . " + devdesc.ReleaseNumber.ToString("X2"));
Debug.Print("Serial number index . . . . . " + devdesc.SerialNumberIndex.ToString("X2"));
Debug.Print("Subclass code . . . . . . . . " + devdesc.SubclassCode.ToString("X2"));
Debug.Print("USB sepecification number . . " + devdesc.UsbSpecificationNumber.ToString("X2"));
//'raw.SendSetupPacket(0x00, 0x09, 1, 0x00);
// On this device there is only one configuration descriptor
GHI.Usb.Descriptors.Configuration cfgdesc = raw.GetConfigurationDescriptor(0);
// look for the HID device
for (int i = 0; i < cfgdesc.Interfaces.Length; i++)
{
Debug.Print(" === Interface ===");
Debug.Print(" Class: " + ClassToString(cfgdesc.Interfaces[i].ClassCode));
Debug.Print(" SubClass: " + cfgdesc.Interfaces[i].SubclassCode);
Debug.Print(" Number: " + cfgdesc.Interfaces[i].Number);
Debug.Print(" Protocol: " + cfgdesc.Interfaces[i].ProtocolCode);
Debug.Print(" Type: " + cfgdesc.Interfaces[i].Type);
for (int ep = 0; ep < cfgdesc.Interfaces[i].Endpoints.Length; ep++)
{
Debug.Print(" -- Endpoint --");
Debug.Print(" Attributes: " + cfgdesc.Interfaces[i].Endpoints[ep].Attributes);
Debug.Print(" Address: " + cfgdesc.Interfaces[i].Endpoints[ep].Address.ToString("X4"));
Debug.Print(" Type: " + cfgdesc.Interfaces[i].Endpoints[ep].Type);
Debug.Print(" Interval: " + cfgdesc.Interfaces[i].Endpoints[ep].Interval);
Debug.Print(" MaxPacket: " + cfgdesc.Interfaces[i].Endpoints[ep].MaximumPacketSize);
Debug.Print(" ");
}
Debug.Print(" ");
Debug.Print(" ");
}
Debug.Print("So far, so good ...");
}
private static string ClassToString(byte interfaceClass)
{
switch (interfaceClass)
{
case 0x0:
return "Base Class";
case 0x01:
return "Audio";
case 0x02:
return "Communications/CDC";
case 0x03:
return "HID";
case 0x05:
return "Physical";
case 0x06:
return "Image";
case 0x07:
return "Printer";
case 0x08:
return "Mass Storage";
case 0x09:
return "Hub";
case 0x0A:
return "CDC-Data";
case 0x0B:
return "Smart Card";
case 0x0D:
return "Content Security";
case 0x0E:
return "Video";
case 0x0F:
return "Personal Healthcare";
case 0xDC:
return "Diagnostic Device";
case 0xE0:
return "Wireless Controller";
case 0xEF:
return "Misc";
case 0xFE:
return "Application Specific";
case 0xFF:
return "Vendor Specific";
default:
return "unknown";
}
}
}