From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9FJE-0003pz-DY for barebox@lists.infradead.org; Mon, 21 Jul 2014 15:15:28 +0000 From: Sascha Hauer Date: Mon, 21 Jul 2014 17:14:44 +0200 Message-Id: <1405955687-27433-21-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1405955687-27433-1-git-send-email-s.hauer@pengutronix.de> References: <1405955687-27433-1-git-send-email-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 20/23] USB: gadget: Add a multi function gadget To: barebox@lists.infradead.org U2ltaWxhciB0byB0aGUgS2VybmVsIG11bHRpIGZ1bmN0aW9uIHRoaXMgZ2FkZ2V0IGRyaXZlciBp cyB1c2VkCmZvciBjcmVhdGluZyBhIFVTQiBkZXZpY2Ugd2l0aCBtdWx0aXBsZSBmdW5jdGlvbnMu IFRoaXMgaXMKY3JlYXRlZCBhbmQgcmVtb3ZlZCB3aXRoIHRoZSBuZXdseSBjcmVhdGVkICd1c2Jn YWRnZXQnIGNvbW1hbmQuCkJhc2VkIG9uIHRoZSBvcHRpb25zIGl0IGNyZWF0ZXMgY29tYmluYXRp b25zIG9mIERGVSwgZmFzdGJvb3QKYW5kIHNlcmlhbCBVU0IgZnVuY3Rpb25zLgoKU2lnbmVkLW9m Zi1ieTogU2FzY2hhIEhhdWVyIDxzLmhhdWVyQHBlbmd1dHJvbml4LmRlPgotLS0KIGNvbW1hbmRz L0tjb25maWcgICAgICAgICAgICB8ICAgNSArCiBjb21tYW5kcy9NYWtlZmlsZSAgICAgICAgICAg fCAgIDEgKwogY29t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