How to change gadget_multi standard configuration?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change gadget_multi standard configuration?

1,078 Views
trongthinh
Contributor IV

I modprobe g_multi driver

$ modprobe g_multi file=/dev/mmcblk2p1

On Linux host machine. I found 1 CDC ACM (ttyACM0), 1 RNDS (Ethernet), and Mass Storage. It seems that the driver work correctly, but I need 2 CDC ACM and I don't need MASS STORAGE

How to disable MASS STORAGE and enable 2 CDC ACM (ttyACM0, ttyACM1)?

Labels (3)
Tags (1)
0 Kudos
2 Replies

949 Views
nxf63675
NXP TechSupport
NXP TechSupport

Hello trongthinh,
Could you please say me which Kernel version are you using?
Best regards,
Israel.

0 Kudos

949 Views
trongthinh
Contributor IV

Hi Israel,

My kernel version is 4.19.35-1.1.0+g9370aa309eaf. I have modified some thing in driver, please see patch file below

--- /home/thinhnguyen/***/***/sourceCode/linux-imx/drivers/usb/gadget/legacy/multi.c
+++ /home/thinhnguyen/***/***/Sources/linux-4.19/drivers/usb/gadget/legacy/multi.c
@@ -44,8 +44,8 @@

/***************************** Device Descriptor ****************************/

-#define MULTI_VENDOR_NUM 0x2d6b
-#define MULTI_PRODUCT_NUM 0X0201 /* Multifunction Composite Gadget */
+#define MULTI_VENDOR_NUM 0x1d6b /* Linux Foundation */
+#define MULTI_PRODUCT_NUM 0x0104 /* Multifunction Composite Gadget */


enum {
@@ -363,37 +363,31 @@
goto fail0;
}

- fi_msg = usb_get_function_instance("acm");
+ /* set up mass storage function */
+ fi_msg = usb_get_function_instance("mass_storage");
if (IS_ERR(fi_msg)) {
status = PTR_ERR(fi_msg);
goto fail1;
}
-
- /* set up mass storage function */
- // fi_msg = usb_get_function_instance("mass_storage");
- // if (IS_ERR(fi_msg)) {
- // status = PTR_ERR(fi_msg);
- // goto fail1;
- // }
- // fsg_config_from_params(&config, &fsg_mod_data, fsg_num_buffers);
- // fsg_opts = fsg_opts_from_func_inst(fi_msg);
-
- // fsg_opts->no_configfs = true;
- // status = fsg_common_set_num_buffers(fsg_opts->common, fsg_num_buffers);
- // if (status)
- // goto fail2;
-
- // status = fsg_common_set_cdev(fsg_opts->common, cdev, config.can_stall);
- // if (status)
- // goto fail_set_cdev;
-
- // fsg_common_set_sysfs(fsg_opts->common, true);
- // status = fsg_common_create_luns(fsg_opts->common, &config);
- // if (status)
- // goto fail_set_cdev;
-
- // fsg_common_set_inquiry_string(fsg_opts->common, config.vendor_name,
- // config.product_name);
+ fsg_config_from_params(&config, &fsg_mod_data, fsg_num_buffers);
+ fsg_opts = fsg_opts_from_func_inst(fi_msg);
+
+ fsg_opts->no_configfs = true;
+ status = fsg_common_set_num_buffers(fsg_opts->common, fsg_num_buffers);
+ if (status)
+ goto fail2;
+
+ status = fsg_common_set_cdev(fsg_opts->common, cdev, config.can_stall);
+ if (status)
+ goto fail_set_cdev;
+
+ fsg_common_set_sysfs(fsg_opts->common, true);
+ status = fsg_common_create_luns(fsg_opts->common, &config);
+ if (status)
+ goto fail_set_cdev;
+
+ fsg_common_set_inquiry_string(fsg_opts->common, config.vendor_name,
+ config.product_name);

/* allocate string IDs */
status = usb_string_ids_tab(cdev, strings_dev);

I have 2 ttyGS0/ttyGS1 in /dev/ttyGS* . Both of them work.

0 Kudos