public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC] USB: driver for iphone charging
@ 2007-08-24  7:20 Oliver Neukum
  2007-08-24 14:08 ` [linux-usb-devel] " Alan Stern
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Neukum @ 2007-08-24  7:20 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, linux-usb-devel, Matt Colyer, jeffm

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-08-25  8:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <8VtFd-7mx-51@gated-at.bofh.it>
2007-08-24 10:51 ` [RFC] USB: driver for iphone charging Bodo Eggert
2007-08-24 18:33   ` [linux-usb-devel] " Greg KH
2007-08-25  8:51     ` Bodo Eggert
2007-08-24  7:20 Oliver Neukum
2007-08-24 14:08 ` [linux-usb-devel] " Alan Stern
2007-08-24 14:23   ` Oliver Neukum
2007-08-24 18:36     ` Greg KH
2007-08-24 18:35   ` Greg KH
2007-08-24 18:55     ` Alan Stern
2007-08-25  2:21       ` Matt Colyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox