Add fs_full usb_check test
Change-Id: Ib9fec9c1d9c1e316657d21c3a12f8294b6235698
diff --git a/mbtk/test/fs_full.c b/mbtk/test/fs_full.c
new file mode 100755
index 0000000..88bf28a
--- /dev/null
+++ b/mbtk/test/fs_full.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#define BUFF_SIZE 4096
+
+int main(int argc, char *argv[])
+{
+ int fd = open("/test.data", O_WRONLY | O_CREAT | O_APPEND);
+ if(fd < 0) {
+ printf("open() fail:%d", errno);
+ return -1;
+ }
+
+ char buff[BUFF_SIZE];
+ while(1) {
+ if(write(fd, buff, BUFF_SIZE) < 0) {
+ printf("write() fail:%d", errno);
+ break;
+ }
+ }
+
+ close(fd);
+ return 0;
+}
+
diff --git a/mbtk/test/usb_check.c b/mbtk/test/usb_check.c
new file mode 100755
index 0000000..7d81a7c
--- /dev/null
+++ b/mbtk/test/usb_check.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <fcntl.h>
+
+#include "mbtk_utils.h"
+
+static int running = 0;
+
+static void sig_handler(int sig)
+{
+ printf("Signal : %d\n", sig);
+ running = 0;
+}
+
+
+int main(int argc, char *argv[])
+{
+ int fd = open("/tmp/usb.info", O_CREAT | O_WRONLY);
+ signal(SIGINT, sig_handler);
+ signal(SIGTERM, sig_handler);
+ if(fd > 0) {
+ char buff[1024];
+ running = 1;
+ while(running){
+ memset(buff, 0, 1024);
+ if(mbtk_cmd_line("cat /sys/class/android_usb/android0/state", buff, 1024)) {
+ write(fd, buff, strlen(buff));
+ write(fd, "\n", 1);
+ }
+ sleep(1);
+ }
+ close(fd);
+ }
+ return 0;
+}
+