USB Mode Switch for Huawei Modem on FEZ Domino

Hey guys,

I am a bit stumped, I have read and tried the code/tips in this thread here:

Here is my little mode flipping function:

static void ResetUsbDevice(USBH_Device device,int first, int second)
            byte[] MessageBits = { 85, 83, 66, 67, 18, 52, 86, 120, 0, 0, 0, 0, 0, 0, 0, 17, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            USBH_RawDevice u = new USBH_RawDevice(device);
            USBH_Descriptors.Configuration cd = u.GetConfigurationDescriptors(0);
            u.SendSetupTransfer(0x00, 0x09, cd.bConfigurationValue, 0x00);
            // you have look for endpoint # 5 (bEndpointAddress must be 5), look into the "cd" in Visual Studio debugger or write a a for loop...
            USBH_Descriptors.Endpoint e = cd.interfaces[first].endpoints[second];
            USBH_RawDevice.Pipe p = u.OpenPipe(e);

The first and second parameters just allow me to selectively pick the endpoints while I am debugging.

The part I am struggling with is that on my Ubuntu machine, I can get it to switch from mass storage to a serial modem using usb_modeswitch, but it only ever turns up as an unknown device in the Fez. I’ve tried casting the device to every possible serial device, each throwing an exception.

  1. How do you know which endpoints are the read and write endpoints? I see examples but it just seems like you’re arbitrarily picking them. I know this is the way I’ll have to go.

  2. Has anyone successfully mode switched a Huawei modem and then used it as a serial modem?