/*
 * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <stdio.h>
#include <usbg/usbg.h>

#include "backend.h"
#include "udc.h"

static int udc_func(void *data)
{
	usbg_udc *u;
	const char *name;

	usbg_for_each_udc(u, backend_ctx.libusbg_state) {
		name = usbg_get_udc_name(u);
		if (name == NULL) {
			fprintf(stderr, "Error getting udc name\n");
			return -1;
		}

		puts(name);
	}

	return 0;
}

struct gt_udc_backend gt_udc_backend_libusbg = {
	.udc = udc_func,
};

/*
 * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#include "udc.h"
#include <stdlib.h>

struct gt_udc_backend gt_udc_backend_libusbg = {
	.udc = NULL,
};

--- 
+++ 
@@ -14,10 +14,30 @@
  * limitations under the License.
  */
 
+#include <stdio.h>
+#include <usbg/usbg.h>
 
+#include "backend.h"
 #include "udc.h"
-#include <stdlib.h>
+
+static int udc_func(void *data)
+{
+	usbg_udc *u;
+	const char *name;
+
+	usbg_for_each_udc(u, backend_ctx.libusbg_state) {
+		name = usbg_get_udc_name(u);
+		if (name == NULL) {
+			fprintf(stderr, "Error getting udc name\n");
+			return -1;
+		}
+
+		puts(name);
+	}
+
+	return 0;
+}
 
 struct gt_udc_backend gt_udc_backend_libusbg = {
-	.udc = NULL,
+	.udc = udc_func,
 };
udc: Add gadget udc command at libusbg backend

Change-Id: If1510069df2e6cd2620c89576ebba80685cb07d7
Signed-off-by: Pawel Szewczyk <1691dcf8dab804b326e5e4b9ab228a1c3b23a2f2@samsung.com>
