{"id":1524,"date":"2016-05-03T23:28:01","date_gmt":"2016-05-03T15:28:01","guid":{"rendered":"http:\/\/kaoru.tech\/?p=1524"},"modified":"2016-05-03T23:28:01","modified_gmt":"2016-05-03T15:28:01","slug":"how-to-use-cdc-composite-device-ethernet-and-acm","status":"publish","type":"post","link":"http:\/\/kaoru.tech:7000\/wordpress\/?p=1524","title":{"rendered":"How to use CDC Composite Device (Ethernet and ACM)"},"content":{"rendered":"<h1>Kernel Configuration<\/h1>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Kernel-Config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1531\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Kernel-Config.png\" alt=\"CDC Composite Gadget Kernel Config\" width=\"675\" height=\"900\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Kernel-Config.png 675w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Kernel-Config-225x300.png 225w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/a><\/p>\n<h1>On Embedded Platform<\/h1>\n<h2>Insmod Drivers<\/h2>\n<p>After that, you will see a new ethernet adapter and a serial node named &#8216;\/dev\/ttyGS0&#8217;.<\/p>\n<pre class=\"lang:default decode:true\"># create mod.sh file and input followed command\r\n \r\n#\/bin\/sh\r\n \r\ninsmod mii.ko\r\ninsmod usbnet.ko\r\ninsmod cdc_ether.ko\r\ninsmod configfs.ko\r\ninsmod libcomposite.ko\r\ninsmod u_ether.ko\r\ninsmod usb_f_ecm.ko\r\ninsmod usb_f_rndis.ko\r\ninsmod u_serial.ko\r\ninsmod usb_f_acm.ko\r\ninsmod g_cdc.ko\r\n\r\n# .\/mod.sh \r\nusbcore: registered new interface driver cdc_ether\r\nusing random self ethernet address\r\nusing random host ethernet address\r\nusb0: HOST MAC 3e:e0:f8:43:d7:42\r\nusb0: MAC 5a:b8:1d:9a:73:15\r\ng_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008\r\ng_cdc gadget: g_cdc ready<\/pre>\n<h2>Connect Target to Host with a USB cable<\/h2>\n<p>You will see Windows notice found a new hardware and try to search and install driver.<\/p>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Driver-installing.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1527 alignnone\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Driver-installing.png\" alt=\"CDC Composite Gadget Driver installing\" width=\"536\" height=\"214\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Driver-installing.png 536w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/CDC-Composite-Gadget-Driver-installing-300x120.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/a><\/p>\n<h1>On Host Platform<\/h1>\n<p>Because there is no associated device driver on Windows, so we use a virtual PC to validate it.<\/p>\n<h2>Connect it to Virtual PC<\/h2>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Netchip-CDC-Composite-on-VMware.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1528\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Netchip-CDC-Composite-on-VMware.png\" alt=\"Netchip CDC Composite on VMware\" width=\"766\" height=\"551\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Netchip-CDC-Composite-on-VMware.png 766w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Netchip-CDC-Composite-on-VMware-300x216.png 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/a><\/p>\n<p>And you\u00a0will see kernel print on virtual PC such as<\/p>\n<pre class=\"lang:sh decode:true\">[ 8324.071831] usb 1-2: new high-speed USB device number 8 using xhci_hcd\r\n[ 8324.427906] usb 1-2: New USB device found, idVendor=0525, idProduct=a4aa\r\n[ 8324.427913] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0\r\n[ 8324.427917] usb 1-2: Product: CDC Composite Gadget\r\n[ 8324.427920] usb 1-2: Manufacturer: Linux 3.14.38+ with 2184000.usb\r\n[ 8324.489574] cdc_ether 1-2:1.0 usb0: register 'cdc_ether' at usb-0000:03:00.0-2, CDC Ethernet Device, de:60:bd:56:bd:c3\r\n[ 8324.493219] cdc_acm 1-2:1.2: This device cannot do calls on its own. It is not a modem.\r\n[ 8324.493435] cdc_acm 1-2:1.2: ttyACM0: USB ACM device<\/pre>\n<p>On embedded platform, kernel may print such as<\/p>\n<pre class=\"lang:sh decode:true\">g_cdc gadget: high-speed config #1: CDC Composite (ECM + ACM)<\/pre>\n<p>Then you can test it.<\/p>\n<h1>Reference<\/h1>\n<ul>\n<li>http:\/\/kaoru.tech\/archives\/1508<\/li>\n<li>http:\/\/kaoru.tech\/archives\/1509<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Kernel Configuration On Embedded Platform Insmod Drivers After that, you will see a new ethernet adapter and a serial node named &#8216;\/dev\/ttyGS0&#8217;. # create mod.sh file and input followed command&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[240],"tags":[278,279,68,276],"class_list":["post-1524","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-cdc","tag-cdc-composite","tag-usb","tag-usb-gadget"],"_links":{"self":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1524"}],"version-history":[{"count":4,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1524\/revisions"}],"predecessor-version":[{"id":1535,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1524\/revisions\/1535"}],"wp:attachment":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1524"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}