#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <system_info.h>
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define zalloc(amount) calloc(1, amount)
return gadget->funcs[i];
}
+static int is_tv_profile(void)
+{
+ int ret;
+ char *profile_name = NULL;
+ const char const *tv_profile_name = "tv";
+
+ ret = system_info_get_platform_string("http://tizen.org/feature/profile", &profile_name);
+
+ if (ret == SYSTEM_INFO_ERROR_NONE) {
+ ret = strncmp(profile_name, tv_profile_name, strlen(tv_profile_name));
+ free(profile_name);
+
+ if (ret == 0)
+ return 1;
+ }
+
+ return 0;
+}
+
static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
struct usb_gadget **_gadget)
{
if (ret)
goto out;
+ /* XU3 TV profile does not support mtp */
+ if (is_tv_profile())
+ gadget_id->function_mask &= ~USB_FUNCTION_MTP;
+
/*
* Currently all gadgets use inly single configuration but
* slp-gadget is capable to handle two of them
functions[0][1] = 0;
gadget->attrs.idProduct = 0x685d;
break;
+
case USB_FUNCTION_MTP:
n_configs = 1;
functions[0][0] = USB_FUNCTION_MTP;
functions[0][1] = 0;
gadget->attrs.idProduct = 0x6860;
break;
+
case USB_FUNCTION_RNDIS:
n_configs = 1;
functions[0][0] = USB_FUNCTION_RNDIS;
functions[0][1] = 0;
gadget->attrs.idProduct = 0x6863;
break;
- case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB:
+
+ case USB_FUNCTION_ACM | USB_FUNCTION_SDB:
n_configs = 1;
- functions[0][0] = USB_FUNCTION_MTP;
- functions[0][1] = USB_FUNCTION_ACM;
- functions[0][2] = USB_FUNCTION_SDB;
- functions[0][3] = 0;
+ functions[0][0] = USB_FUNCTION_ACM;
+ functions[0][1] = USB_FUNCTION_SDB;
+ functions[0][2] = 0;
gadget->attrs.idProduct = 0x6860;
break;
- case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB
- | USB_FUNCTION_DIAG:
+
+ case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB:
n_configs = 1;
functions[0][0] = USB_FUNCTION_MTP;
functions[0][1] = USB_FUNCTION_ACM;
functions[0][2] = USB_FUNCTION_SDB;
- functions[0][3] = USB_FUNCTION_DIAG;
- functions[0][4] = 0;
+ functions[0][3] = 0;
gadget->attrs.idProduct = 0x6860;
break;
+
case USB_FUNCTION_RNDIS | USB_FUNCTION_SDB:
n_configs = 1;
functions[0][0] = USB_FUNCTION_RNDIS;
functions[0][2] = 0;
gadget->attrs.idProduct = 0x6864;
break;
+
+#if 0
+ case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_DIAG:
+ n_configs = 1;
+ functions[0][0] = USB_FUNCTION_MTP;
+ functions[0][1] = USB_FUNCTION_ACM;
+ functions[0][2] = USB_FUNCTION_SDB;
+ functions[0][3] = USB_FUNCTION_DIAG;
+ functions[0][4] = 0;
+ gadget->attrs.idProduct = 0x6860;
+ break;
+
case USB_FUNCTION_RNDIS | USB_FUNCTION_SDB | USB_FUNCTION_ACM | USB_FUNCTION_DIAG:
n_configs = 1;
functions[0][0] = USB_FUNCTION_RNDIS;
functions[0][4] = 0;
gadget->attrs.idProduct = 0x6864;
break;
+
case USB_FUNCTION_RNDIS | USB_FUNCTION_DIAG:
n_configs = 1;
functions[0][0] = USB_FUNCTION_RNDIS;
functions[0][2] = 0;
gadget->attrs.idProduct = 0x6864;
break;
+
case USB_FUNCTION_ACM | USB_FUNCTION_SDB | USB_FUNCTION_DM:
n_configs = 1;
functions[0][0] = USB_FUNCTION_ACM;
functions[0][3] = 0;
gadget->attrs.idProduct = 0x6860;
break;
+
case USB_FUNCTION_DIAG | USB_FUNCTION_ACM | USB_FUNCTION_RMNET:
n_configs = 1;
functions[0][0] = USB_FUNCTION_DIAG;
functions[0][3] = 0;
gadget->attrs.idProduct = 0x685d;
break;
+#endif
};
if (n_configs > 2 || n_configs <= 0) {