Re: [RFC] USB: driver for iphone charging
Oliver Neukum <[email protected]>
| Newsgroups | gmane.linux.usb.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
Am Freitag 24 August 2007 schrieb Greg KH:
Hi,
> +static int select_configuration(struct usb_device *udev)
> +{
> + char *dummy_buffer = kzalloc(2, GFP_KERNEL);
> + int retval;
> +
> + if (!dummy_buffer)
> + return -ENOMEM;
> +
> + dbg(&udev->dev, "Calling set_configuration\n");
> + retval = usb_driver_set_configuration(udev, 3);
> + if (retval) {
> + dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval);
> + goto exit;
> + }
> +
> + dbg(&udev->dev, "Sending first magic command\n");
> + retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x40, 0x40,
> + 0x6400, 0, dummy_buffer, 0, 100);
> +
int usb_driver_set_configuration(struct usb_device *udev, int config)
{
struct set_config_request *req;
req = kmalloc(sizeof(*req), GFP_KERNEL);
if (!req)
return -ENOMEM;
req->udev = udev;
req->config = config;
INIT_WORK(&req->work, driver_set_config_work);
usb_get_dev(udev);
schedule_work(&req->work);
return 0;
}
This schedules the change via a workqueue, so you'll be reprobed. If you
fire of the first vendor command you are doing so before the configuration
is changed. How is this supposed to work?
Regards
Oliver
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel