Re: [linux-usb-devel] [RFC] USB: driver for iphone charging

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Stern
Date: Friday, August 24, 2007 - 7:08 am

On Fri, 24 Aug 2007, Oliver Neukum wrote:


I would do it like this:

static int iphone_probe(struct usb_interface *intf,
			const struct usb_device_id *id)
{
	struct usb_device *udev = interface_to_usbdev(intf);
	int rc;

	if (udev->actconfig->desc.bConfigurationValue != 3) {
		dbg(&udev->dev, "Calling set_configuration\n");
		rc = usb_driver_set_configuration(udev, 3);
	} else {
		dbg(&udev->dev, "Configuration set, sending magic comand\n");
		rc = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
				0x40, (USB_DIR_OUT | USB_TYPE_VENDOR |
					USB_RECIP_DEVICE),
				0x6400, 0, NULL, 0, 1000);
	}
	if (rc)
		dev_err(&udev->dev, "Command failed: %d\n", rc);

	/* we don't really want to bind to the device, userspace programs can
	 * handle the syncing just fine, so get outta here. */
	return -ENODEV;
}

Alan Stern

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] USB: driver for iphone charging, Greg KH, (Thu Aug 23, 3:45 pm)
Re: [RFC] USB: driver for iphone charging, Oliver Neukum, (Fri Aug 24, 12:20 am)
Re: [linux-usb-devel] [RFC] USB: driver for iphone charging, Alan Stern, (Fri Aug 24, 7:08 am)