# usb_gadget **Repository Path**: sunplus-plus1/usb_gadget ## Basic Information - **Project Name**: usb_gadget - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-23 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # How to enable USB gadget 1. If source code isn't compiled with gadget configs, please refer to [How to compile](https://gitee.com/sunplus-plus1/SP7021) >Enable Mass Storage gadget (Ubuntu and Windows is supported) 2. boot your develop board and connect micro usb to PC 3. copy [setup_mass.sh](mass_storage_class/setup_mass.sh) to develop board 4. If you want to use device as medium \ insert sdcard to develop board and it will be /dev/mmcblk1 ``` ./setup_mass.sh /dev/mmcblk1 ``` 5. If you want to use file as medium: \ run below command to create vfat image file in your PC ``` dd if=/dev/zero of=fdev count=100 bs=1M mkfs.vfat fdev ``` copy fdev file to same folder with setup_mass.sh of develop board and run ... ``` ./setup_mass.sh fdev ``` \ ![](mass_storage_class/pic/storage_copy.png) 6. Result\ \ ![](mass_storage_class/pic/storage_result.png) >Enable communication device class gadget 2. boot your develop board and connect micro usb to PC 3. copy [setup_ecm.sh](communication_device_class/setup_ecm.sh) to develop board 4. setup Host (untuntu 14, Windows doesn't yet support) network connections\ 4.1 run 'nm-connection-editor' and Press "Add" in network connections\ \ ![](communication_device_class/pic/network_setting_main.png)\ \ 4.2 Choose Enternet\ \ ![](communication_device_class/pic/network_setting_choose.png)\ \ 4.3 Set connection name and MAC address\ \ ![](communication_device_class/pic/network_setting_mac.png)\ \ 4.4 Set IP\ \ ![](communication_device_class/pic/network_setting_ip.png)\ \ 4.5 New network connection (usb0) will create\ \ ![](communication_device_class/pic/network_setting_ok.png) 5. run setup_ecm.sh 6. Result\ \ ![](communication_device_class/pic/network_setting_work.png)