public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>, Matt Colyer <matt@colyer.name>,
	linux-kernel@vger.kernel.org, jeffm@suse.de,
	linux-usb-devel@lists.sourceforge.net
Subject: Re: [linux-usb-devel] [RFC] USB: driver for iphone charging
Date: Fri, 24 Aug 2007 11:35:48 -0700	[thread overview]
Message-ID: <20070824183548.GA14879@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0708241006440.3862-100000@iolanthe.rowland.org>

On Fri, Aug 24, 2007 at 10:08:46AM -0400, Alan Stern wrote:
> On Fri, 24 Aug 2007, Oliver Neukum wrote:
> 
> > 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?
> 
> 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;
> }

Yeah, that would make more sense, if that is what is needed.

Can someone with a iphone test this out?  If you look at how the
berry_charge driver does it, the set_config stuff happens after the
magic command.  As I don't have an iphone, nor have I ever seen any
dumps of the command streams, I don't really know if the set_config
message really is necessary or not.

thanks,

greg k-h

  parent reply	other threads:[~2007-08-24 18:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 22:45 [RFC] USB: driver for iphone charging Greg KH
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 [this message]
2007-08-24 18:55       ` Alan Stern
2007-08-25  2:21         ` Matt Colyer
     [not found] <8VtFd-7mx-51@gated-at.bofh.it>
2007-08-24 10:51 ` Bodo Eggert
2007-08-24 18:33   ` [linux-usb-devel] " Greg KH
2007-08-25  8:51     ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070824183548.GA14879@kroah.com \
    --to=greg@kroah.com \
    --cc=jeffm@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=matt@colyer.name \
    --cc=oliver@neukum.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox