{"id":962,"date":"2022-05-31T12:05:13","date_gmt":"2022-05-31T03:05:13","guid":{"rendered":"https:\/\/derrylab.com\/?p=962"},"modified":"2022-05-31T12:15:16","modified_gmt":"2022-05-31T03:15:16","slug":"how-to-access-som9331-serial-console-in-linux","status":"publish","type":"post","link":"https:\/\/blog.derrylab.com\/index.php\/2022\/05\/31\/how-to-access-som9331-serial-console-in-linux\/","title":{"rendered":"How to Access SOM9331 Serial Console in Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I got this old hackable mini router board. It comes with OpenWRT but I can&#8217;t seem to connect this via USB Serial. It turns out that the driver is not installed. Installation is quick but there is a minor change needed in order to build the driver on a recent kernel. So will write here in case someone facing the same problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Connect the micro-USB of SOM9331 to your Linux PC. This module has Silicon Labs CP2104 USB to TTL serial converter chip built-in. Go to the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.silabs.com\/developers\/usb-to-uart-bridge-vcp-drivers\" target=\"_blank\">vendor website <\/a>and download the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.silabs.com\/documents\/login\/software\/Linux_3.x.x_4.x.x_VCP_Driver_Source.zip\" target=\"_blank\">CP210x USB to UART Bridge VCP Drivers<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Extract it with<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ unzip Linux_3.x.x_4.x.x_VCP_Driver_Source.zip -d cp210xdriver<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And move to that folder<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd cp210xdriver<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, there is a minor issue with compilation on my Kernel 5.17. The <code>int<\/code> is not compatible with <code>void<\/code>. So we have to do minor modifications.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In <code>cp210x.c<\/code> file, this line at 52:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>static int cp210x_port_remove(struct usb_serial_port *);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">needs to be changed to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>static void cp210x_port_remove(struct usb_serial_port *);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and this one is also in the same file at line 2414:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>static int cp210x_port_remove(struct usb_serial_port *port)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">change it to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>static void cp210x_port_remove(struct usb_serial_port *port)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Also in the same function, line 2421, comment the<br>\/<code>\/return 0;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now we can start building the driver.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ make<br>$ sudo cp cp210x.ko \/lib\/modules\/$(uname -r)\/kernel\/drivers\/usb\/serial<br>$ sudo insmod \/lib\/modules\/$(uname -r)\/kernel\/drivers\/usb\/serial\/usbserial.ko<br>$ sudo insmod cp210x.ko<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now if you can&#8217;t find <code>\/dev\/ttyUSB0<\/code> and you have this message:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dmesg | tail\nusbfs: interface 0 claimed by cp210x while 'brltty' sets config #1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The problem here is BRLTTY, a program that &#8220;provides access to the Linux\/Unix console (when in text mode) for a blind person using a refreshable braille display&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re not blind then you can disable it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can find out about <code>brltty<\/code> service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ systemctl list-units | grep brltty<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In my case its <code>brltty-udev.service<\/code>. Then let&#8217;s disable them<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl mask brltty-udev.service<br>$ sudo systemctl stop brltty-udev.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now check again my kernel message<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dmesg | tail<br>&#91;sudo] password for derry:<br>&#91;58966.197632] usb 1-8: Product: CP2104 USB to UART Bridge Controller<br>&#91;58966.197633] usb 1-8: Manufacturer: Silicon Labs<br>&#91;58966.197633] usb 1-8: SerialNumber: 00E2684C<br>&#91;58966.198805] cp210x 1-8:1.0: cp210x converter detected<br>&#91;58966.199598] usb 1-8: cp210x converter now attached to ttyUSB0<br>&#91;58967.773130] e1000e 0000:05:00.0 enp5s0: NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx\/Tx<br>&#91;58967.773252] e1000e 0000:05:00.0 enp5s0: 10\/100 speed: disabling TSO<br>&#91;58973.180382] e1000e 0000:05:00.0 enp5s0: NIC Link is Down<br>&#91;58975.025293] e1000e 0000:05:00.0 enp5s0: NIC Link is Up 100 Mbps Full Duplex, Flow Control: None<br>&#91;58975.025415] e1000e 0000:05:00.0 enp5s0: 10\/100 speed: disabling TSO<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the serial<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls \/dev\/ttyUSB0\n\/dev\/ttyUSB0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Seems good, and now login:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo picocom -b 115200 \/dev\/ttyUSB0                                                  \npicocom v3.1\n\nport is        : \/dev\/ttyUSB0\nflowcontrol    : none\nbaudrate is    : 115200\nparity is      : none\ndatabits are   : 8\nstopbits are   : 1\nescape is      : C-a\nlocal echo is  : no\nnoinit is      : no\nnoreset is     : no\nhangup is      : no\nnolock is      : no\nsend_cmd is    : sz -vv\nreceive_cmd is : rz -vv -E\nimap is        : \nomap is        : \nemap is        : crcrlf,delbs,\nlogfile is     : none\ninitstring     : none\nexit_after is  : not set\nexit is        : no\n\nType &#91;C-a] &#91;C-h] to see available commands\nTerminal ready\n\nroot@OpenWrt:\/# uname -a\nLinux OpenWrt 3.3.8 #1 Sat Mar 23 16:49:30 UTC 2013 mips GNU\/Linux\nroot@OpenWrt:\/# <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Hope this helps! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got this old hackable mini router board. It comes with OpenWRT but I can&#8217;t seem to connect this via USB Serial. It turns out that the driver is not installed. Installation is quick but there is a minor change needed in order to build the driver on a recent kernel. So will write here [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":965,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,5],"tags":[18,36,165,164,64,66],"class_list":["post-962","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-programming","tag-development","tag-linux","tag-openembedded","tag-som9331","tag-tutorial","tag-ubuntu"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/05\/81IfBiOdCvL._AC_SL1500_.jpg?fit=1500%2C1227&ssl=1","jetpack-related-posts":[{"id":92,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/07\/18\/how-to-create-identical-image-of-usb-device\/","url_meta":{"origin":962,"position":0},"title":"How to Create Identical Image of USB Device","author":"derry","date":"July 18, 2020","format":false,"excerpt":"Hi, currently I am backing up my micro SD card contents and I'm using dd for that. You can start listing your usb device using: $ sudo fdisk -l After you get the USB address, for example mine is \/dev\/sdb, you can start creating a copy images. Here I tried\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2538,"url":"https:\/\/blog.derrylab.com\/index.php\/2023\/01\/31\/how-to-install-alfa-awus036nh-driver-for-kali-linux\/","url_meta":{"origin":962,"position":1},"title":"How to Install Alfa AWUS036NH Driver for Kali Linux","author":"derry","date":"January 31, 2023","format":false,"excerpt":"This wifi adapter is an important weapon for penetration testers due to its feature that supports monitor and packet injection mode on a 2.4Ghz network. However, even if Alfa said it is already supported out of the box in Kali Linux, I found it unstable out of the box. Sometimes\u2026","rel":"","context":"In &quot;Hardware&quot;","block_context":{"text":"Hardware","link":"https:\/\/blog.derrylab.com\/index.php\/category\/hardware\/"},"img":{"alt_text":"Computer desktop","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/01\/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvZnJ3bGFuX3dpZmlfbmV0d29ya19tb2RlbS1pbWFnZS1reWJjZThvZC5qcGc.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/01\/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvZnJ3bGFuX3dpZmlfbmV0d29ya19tb2RlbS1pbWFnZS1reWJjZThvZC5qcGc.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/01\/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvZnJ3bGFuX3dpZmlfbmV0d29ya19tb2RlbS1pbWFnZS1reWJjZThvZC5qcGc.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/01\/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvZnJ3bGFuX3dpZmlfbmV0d29ya19tb2RlbS1pbWFnZS1reWJjZThvZC5qcGc.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/01\/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvZnJ3bGFuX3dpZmlfbmV0d29ya19tb2RlbS1pbWFnZS1reWJjZThvZC5qcGc.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2572,"url":"https:\/\/blog.derrylab.com\/index.php\/2023\/02\/08\/how-to-install-the-latest-openwrt-on-arduino-yun\/","url_meta":{"origin":962,"position":2},"title":"How to Install the Latest OpenWRT on Arduino Yun","author":"derry","date":"February 8, 2023","format":false,"excerpt":"By the time I am writing this, this might be the first article that tells you how to install OpenWRT on Arduino Yun because no one talks about it. Also, Arduino Yun is already reached its end of life, and the version history is not well documented in each article\u2026","rel":"","context":"In &quot;Hardware&quot;","block_context":{"text":"Hardware","link":"https:\/\/blog.derrylab.com\/index.php\/category\/hardware\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/02\/ArduinoYunFront_2.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/02\/ArduinoYunFront_2.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/02\/ArduinoYunFront_2.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/02\/ArduinoYunFront_2.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/02\/ArduinoYunFront_2.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2789,"url":"https:\/\/blog.derrylab.com\/index.php\/2023\/04\/25\/how-to-ssh-with-proxyjump-in-linux\/","url_meta":{"origin":962,"position":3},"title":"How to SSH with ProxyJump in Linux","author":"derry","date":"April 25, 2023","format":false,"excerpt":"Secure Shell (SSH) is a widely used protocol for remotely connecting to a computer system, typically over a network. It provides encrypted communication and authentication to ensure secure access to a remote machine. In this article, we will discuss how to SSH with ProxyJump in Linux. ProxyJump is a feature\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"photo of jumping man","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-2736809.jpeg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-2736809.jpeg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-2736809.jpeg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-2736809.jpeg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-2736809.jpeg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":552,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/03\/15\/how-to-run-linux-on-riscv-in-arty-a7-100t-fpga\/","url_meta":{"origin":962,"position":4},"title":"How to Run Linux on RISCV in Arty A7-100T FPGA","author":"derry","date":"March 15, 2022","format":false,"excerpt":"It's been tempting for me to try running open-source software on top of open-source hardware. SiFive provides a bitstream for Arty A7 called Freedom, but it seems that the repository is dead now. The other interesting alternative to try is VexRiscv, and everyone keeps posting about Arty A7 35T while\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/03\/pexels-rone-ferreira-3690005-1-scaled.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":127,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/11\/17\/how-to-fix-raspberry-pi-ssh-hangs-or-not-responding\/","url_meta":{"origin":962,"position":5},"title":"How to Fix Raspberry Pi SSH Hangs or Not Responding","author":"derry","date":"November 17, 2020","format":false,"excerpt":"I just set up a Raspberry PI 4 Model B in the laboratory to automatically connect to the lab's router. I found that each random minutes the SSH is hangs and not responding. Adding IPQoS cs0 cs0 line to the end of \/etc\/ssh\/sshd_config file will fix the issue. :)","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/comments?post=962"}],"version-history":[{"count":3,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/962\/revisions"}],"predecessor-version":[{"id":967,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/962\/revisions\/967"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/media\/965"}],"wp:attachment":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/media?parent=962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/categories?post=962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/tags?post=962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}