Fix mbtk from v1265 GSW
Change-Id: I5d8d395616f284bc74c8b9448cfa347164b5a668
diff --git a/mbtk/libgsw_lib/libgsw_usb.c b/mbtk/libgsw_lib/libgsw_usb.c
new file mode 100755
index 0000000..400fcb2
--- /dev/null
+++ b/mbtk/libgsw_lib/libgsw_usb.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#include <termios.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <sys/ioctl.h>
+#include <dlfcn.h>
+
+
+#include "gsw_usb.h"
+
+#define TMP_USB_RESTART "/sbin/tmp_usb_init"
+#define USB_OPEN 3300
+#define USB_CLOSE 3329
+
+int32_t gsw_usb_permanent_switch(EN_GSW_USB_SWITCH_TYPE type)
+{
+ int ret;
+ char cmd[256];
+ if(type != EN_GSW_USB_SWITCH_OPEN && type != EN_GSW_USB_SWITCH_CLOSE)
+ return GSW_HAL_FAIL;
+ sprintf(cmd, "setprop persist.mbtk.usb_pid %d && %s %d &", type?USB_OPEN:USB_CLOSE, TMP_USB_RESTART, type?USB_OPEN:USB_CLOSE);
+ ret = system(cmd);
+ return ret;
+}
+
+int32_t gsw_usb_tempporary_switch(EN_GSW_USB_SWITCH_TYPE type)
+{
+ int ret;
+ char cmd[256];
+ if(type != EN_GSW_USB_SWITCH_OPEN && type != EN_GSW_USB_SWITCH_CLOSE)
+ return GSW_HAL_FAIL;
+ sprintf(cmd, "%s %d &", TMP_USB_RESTART, type?USB_OPEN:USB_CLOSE);
+ ret = system(cmd);
+ return ret;
+}
\ No newline at end of file