lkml.org 
[lkml]   [2007]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] USB: driver for iphone charging
Date
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-24 09:23    [W:0.058 / U:2.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site