Merge pull request #15 from tiopex/master

add libusbgx, add miyooctl
This commit is contained in:
tiopex
2023-03-22 15:52:28 +01:00
committed by GitHub
10 changed files with 170 additions and 21 deletions

View File

@@ -1,3 +1,2 @@
#!/bin/busybox sh
echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode

View File

@@ -1,16 +0,0 @@
#!/bin/busybox sh
LUN_DIR=/sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/gadget
if (grep -q mmcblk0p1 "${LUN_DIR}/lun0/file"); then
echo /dev/mmcblk0p4 > "${LUN_DIR}/lun0/file"
echo /dev/mmcblk0p1 > "${LUN_DIR}/lun1/file"
elif (grep -q mmcblk0p4 "${LUN_DIR}/lun0/file"); then
echo /dev/mmcblk0p1 > "${LUN_DIR}/lun0/file"
echo /dev/mmcblk0p4 > "${LUN_DIR}/lun1/file"
else
sleep 2
echo " "
echo "No FAT partition assigned to LUN!"
echo " "
fi

View File

@@ -1,3 +1,2 @@
#!/bin/busybox sh
echo peripheral > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
echo peripheral > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode

View File

@@ -34,7 +34,10 @@ else
fi
# load kernel modules
modprobe "g_acm_ms" file=/dev/mmcblk0p4,/dev/mmcblk0p1,/dev/mmcblk0p2 removable=1,1 ro=0,0 >> "${LOGS}" 2>&1
# load usb gadget
mount -t configfs none /sys/kernel/config >> "${LOGS}" 2>&1
gadget-ms /dev/mmcblk0p1 /dev/mmcblk0p4 >> "${LOGS}" 2>&1
# just load the expected ones (screen driver) from here

View File

@@ -95,6 +95,7 @@ BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBSVG_CAIRO=y
BR2_PACKAGE_PANGO=y
BR2_PACKAGE_LIBPCIACCESS=y
BR2_PACKAGE_LIBUSBGX=y
BR2_PACKAGE_TSLIB=y
BR2_PACKAGE_JSON_C=y
BR2_PACKAGE_LIBXMLPP=y
@@ -131,6 +132,7 @@ BR2_PACKAGE_XUTIL_UTIL_MACROS=y
BR2_PACKAGE_GMENU2X=y
BR2_PACKAGE_MIYOO_DAEMON=y
BR2_PACKAGE_MIYOO_LOGO=y
BR2_PACKAGE_MIYOO_CTL=y
BR2_PACKAGE_DIALOG=y
BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y
BR2_PACKAGE_NANO=y

View File

@@ -91,6 +91,7 @@ BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBSVG_CAIRO=y
BR2_PACKAGE_PANGO=y
BR2_PACKAGE_LIBPCIACCESS=y
BR2_PACKAGE_LIBUSBGX=y
BR2_PACKAGE_TSLIB=y
BR2_PACKAGE_JSON_C=y
BR2_PACKAGE_LIBXMLPP=y
@@ -107,6 +108,7 @@ BR2_PACKAGE_XUTIL_UTIL_MACROS=y
BR2_PACKAGE_GMENU2X=y
BR2_PACKAGE_MIYOO_DAEMON=y
BR2_PACKAGE_MIYOO_LOGO=y
BR2_PACKAGE_MIYOO_CTL=y
BR2_PACKAGE_DIALOG=y
BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y
BR2_PACKAGE_NANO=y

View File

@@ -2132,6 +2132,8 @@ menu "Miscellaneous"
source "package/gmenu2x/Config.in"
source "package/miyoo-daemon/Config.in"
source "package/miyoo-logo/Config.in"
source "package/miyoo-ctl/Config.in"
endmenu
menu "Networking applications"

View File

@@ -0,0 +1,141 @@
Index: examples/gadget-acm-ecm.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/examples/gadget-acm-ecm.c b/examples/gadget-acm-ecm.c
--- a/examples/gadget-acm-ecm.c (revision 721e3a1cbd7e2b6361bb439d3959e7403e4f0092)
+++ b/examples/gadget-acm-ecm.c (date 1679314494083)
@@ -38,7 +38,7 @@
usbg_state *s;
usbg_gadget *g;
usbg_config *c;
- usbg_function *f_acm0, *f_acm1, *f_ecm;
+ usbg_function *f_acm0;
int ret = -EINVAL;
int usbg_ret;
@@ -60,7 +60,7 @@
};
struct usbg_config_strs c_strs = {
- .configuration = "CDC 2xACM+ECM"
+ .configuration = "CDC 1xACM"
};
usbg_ret = usbg_init("/sys/kernel/config", &s);
@@ -86,22 +86,6 @@
usbg_strerror(usbg_ret));
goto out2;
}
-
- usbg_ret = usbg_create_function(g, USBG_F_ACM, "usb1", NULL, &f_acm1);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error creating acm1 function\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name(usbg_ret),
- usbg_strerror(usbg_ret));
- goto out2;
- }
-
- usbg_ret = usbg_create_function(g, USBG_F_ECM, "usb0", NULL, &f_ecm);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error creating ecm function\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name(usbg_ret),
- usbg_strerror(usbg_ret));
- goto out2;
- }
/* NULL can be passed to use kernel defaults */
usbg_ret = usbg_create_config(g, 1, "The only one", NULL, &c_strs, &c);
@@ -119,22 +103,6 @@
usbg_strerror(usbg_ret));
goto out2;
}
-
- usbg_ret = usbg_add_config_function(c, "acm.GS1", f_acm1);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error adding acm.GS1\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name(usbg_ret),
- usbg_strerror(usbg_ret));
- goto out2;
- }
-
- usbg_ret = usbg_add_config_function(c, "ecm.usb0", f_ecm);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error adding ecm.usb0\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name(usbg_ret),
- usbg_strerror(usbg_ret));
- goto out2;
- }
usbg_ret = usbg_enable_gadget(g, DEFAULT_UDC);
if (usbg_ret != USBG_SUCCESS) {
Index: examples/gadget-ms.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/examples/gadget-ms.c b/examples/gadget-ms.c
--- a/examples/gadget-ms.c (revision 721e3a1cbd7e2b6361bb439d3959e7403e4f0092)
+++ b/examples/gadget-ms.c (date 1679314494093)
@@ -36,7 +36,7 @@
usbg_state *s;
usbg_gadget *g;
usbg_config *c;
- usbg_function *f_ms;
+ usbg_function *f_ms, *f_acm0;
int ret = -EINVAL;
int usbg_ret;
@@ -60,18 +60,18 @@
struct usbg_f_ms_lun_attrs f_ms_luns_array[] = {
{
.id = -1, /* allows to place in any position */
- .cdrom = 1,
+ .cdrom = 0,
.ro = 0,
.nofua = 0,
.removable = 1,
- .file = "",
+ .file = argv[1],
}, {
.id = -1, /* allows to place in any position */
.cdrom = 0,
.ro = 0,
.nofua = 0,
.removable = 1,
- .file = argv[1],
+ .file = argv[2],
}
};
@@ -116,6 +116,14 @@
goto out2;
}
+ usbg_ret = usbg_create_function(g, USBG_F_ACM, "usb0", NULL, &f_acm0);
+ if (usbg_ret != USBG_SUCCESS) {
+ fprintf(stderr, "Error creating acm0 function\n");
+ fprintf(stderr, "Error: %s : %s\n", usbg_error_name(usbg_ret),
+ usbg_strerror(usbg_ret));
+ goto out2;
+ }
+
usbg_ret = usbg_create_function(g, USBG_F_MASS_STORAGE, "my_reader",
&f_attrs, &f_ms);
if (usbg_ret != USBG_SUCCESS) {
@@ -133,6 +141,14 @@
usbg_strerror(usbg_ret));
goto out2;
}
+
+ usbg_ret = usbg_add_config_function(c, "acm.GS0", f_acm0);
+ if (usbg_ret != USBG_SUCCESS) {
+ fprintf(stderr, "Error adding acm.GS0\n");
+ fprintf(stderr, "Error: %s : %s\n", usbg_error_name(usbg_ret),
+ usbg_strerror(usbg_ret));
+ goto out2;
+ }
usbg_ret = usbg_add_config_function(c, "some_name_here", f_ms);
if (usbg_ret != USBG_SUCCESS) {

View File

@@ -0,0 +1,4 @@
config BR2_PACKAGE_MIYOO_CTL
bool "miyoo-ctl"
help
miyoo-ctl

View File

@@ -0,0 +1,13 @@
MIYOO_CTL_VERSION = origin/master
MIYOO_CTL_SITE_METHOD = git
MIYOO_CTL_SITE = https://github.com/MiyooCFW/miyooctl.git
define MIYOO_CTL_BUILD_CMDS
"$(TARGET_CC)" $(@D)/main.c -o $(@D)/miyooctl
endef
define MIYOO_CTL_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/miyooctl $(TARGET_DIR)/usr/bin
endef
$(eval $(generic-package))