Re: [PATCH 07/10] usb: gadget: Add Android Composite Gadget driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 18 Apr 2012 15:00:09 +0200, Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx> wrote:

> +static int android_bind(struct usb_composite_dev *cdev)
> +{
> +	struct android_dev *dev = _android_dev;
> +	struct usb_gadget	*gadget = cdev->gadget;
> +	int			gcnum, id, ret;
> +
> +	/*
> +	 * Start disconnected. Userspace will connect the gadget once
> +	 * it is done configuring the functions.
> +	 */
> +	usb_gadget_disconnect(gadget);
> +
> +	ret = android_init_functions(dev->functions, cdev);
> +	if (ret)
> +		return ret;
> +
> +	/* Allocate string descriptor numbers ... note that string
> +	 * contents can be overridden by the composite_dev glue.
> +	 */
> +	id = usb_string_id(cdev);
> +	if (id < 0)
> +		return id;
> +	strings_dev[STRING_MANUFACTURER_IDX].id = id;
> +	device_desc.iManufacturer = id;
> +
> +	id = usb_string_id(cdev);
> +	if (id < 0)
> +		return id;
> +	strings_dev[STRING_PRODUCT_IDX].id = id;
> +	device_desc.iProduct = id;
> +
> +	/* Default strings - should be updated by userspace */
> +	strncpy(manufacturer_string, "Android", sizeof(manufacturer_string)-1);
> +	strncpy(product_string, "Android", sizeof(product_string) - 1);

usb_composite_dev::iProduct and usb_composite_dev::iManufacturer are there so
that
gadget drivers don't have to deal with those strings directly.  The above
should
be removed from android composite gadget as it can be handled by regular
composite
gadget.

The purpose of a number of sysfs attributes found in this driver is to enable
configuration at runtime while the driver is compiled-in. Module parameters
are no good in such a situation provided we don't want to/can't pass kernel
command line parameters. Please note that future works will probably be aimed
at switching to configfs, as Felipe suggests.

Either way, instead of using it's own code for getting string IDs and such,
the code should take advantage of what composite.c provides.

--
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux