예제 #1
0
static int init_device(struct libusb_device *dev, UKW_DEVICE drv_dev,
					   unsigned char bus_addr, unsigned char dev_addr)
{
	struct wince_device_priv *priv = _device_priv(dev);
	int r = LIBUSB_SUCCESS;

	dev->bus_number = bus_addr;
	dev->device_address = dev_addr;
	priv->dev = drv_dev;

	if (!UkwGetDeviceDescriptor(priv->dev, &(priv->desc))) {
		r = translate_driver_error(GetLastError());
	}
	return r;
}
예제 #2
0
static BOOL findAAPEndpoints(UKW_DEVICE& device, UCHAR& epin, UCHAR& epout)
{
    // Device must be in AAP mode:
    // vendorID = 0x18D1, productID = 0x2D00 or 0x2D01
    UKW_DEVICE_DESCRIPTOR desc;
    if (!UkwGetDeviceDescriptor(device, &desc)) {
        printf("Failed to retrieve device descriptor: error %d\n", GetLastError());
        return FALSE;
    }

    if (desc.idVendor != 0x18D1 || (desc.idProduct != 0x2D00 && desc.idProduct != 0x2D01)) {
        printf("Device is not in AAP mode (idVendor = 0x%.2x, idProduct = 0x%.2x)\n", desc.idVendor, desc.idProduct);
        return FALSE;
    }

    // Really, we should scan the interface descriptor for this info.
    // Fake up (based on LG Optimus 2X P990 (CyanogenMod7 OS)) for now.
    epin = 8;
    epout = 6;
    return TRUE;
}
예제 #3
0
static void printDeviceList()
{
    printf("\n%d available devices:\n", gDeviceListSize);
    for(DWORD i = 0; i < gDeviceListSize; ++i) {
        printf("Device % 3d: ", i);
        UKW_DEVICE dev = gDeviceList[i];
        unsigned char bus, devAddr;
        unsigned long sessionId;
        if (!UkwGetDeviceAddress(dev, &bus, &devAddr, &sessionId)) {
            printf("Failed to retrieve address\n");
            continue;
        }
        printf("bus %d, device address %d, session id %d\n", bus, devAddr, sessionId);
        printf("\t");
        UKW_DEVICE_DESCRIPTOR desc;
        if (!UkwGetDeviceDescriptor(dev, &desc)) {
            printf("Failed to retrieve device descriptor\n");
            continue;
        }
        printf("vid: 0x%04x pid: 0x%04x\n", desc.idVendor, desc.idProduct);
    }
    printf("\n");
}