<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Usb – Yeri Tiete</title>
    <link>https://yeri.be/tag/usb/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Sun, 21 Jun 2020 01:15:02 +0200</lastBuildDate>
    <atom:link href="https://yeri.be/tag/usb/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Raspberry Pi 4 &#43; SSD</title>
      <link>https://yeri.be/raspberry-pi-4-ssd/</link>
      <pubDate>Sun, 21 Jun 2020 01:15:02 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/raspberry-pi-4-ssd/</guid><enclosure url="https://static.yeri.be/2020/06/IMG_9881.jpg" length="0" type="image/jpeg" />
      <description>&lt;p&gt;All right. With the release of the new &lt;a href=&#34;https://www.raspberrypi.org/blog/8gb-raspberry-pi-4-on-sale-now-at-75/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;RPi4 with 8Gb of RAM&lt;/a&gt; I had to get myself one to see if it was already a viable desktop replacement for surfing and emails. &lt;/p&gt;&#xA;&lt;p&gt;While a SD card works fine for certain tasks (things that don&#39;t require a lot of IO) -- for a desktop that&#39;s a no-go... It&#39;s just too slow.&lt;/p&gt;&#xA;&lt;p&gt;I still had an old Macbook Pro 13&#34; (2o15?) SSD lying around that was collecting dust. Why not use that one to use as root for the RPi? &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2020/06/IMG_9881.jpg" alt="Raspberry Pi 4 + SSD"></p><p>All right. With the release of the new <a href="https://www.raspberrypi.org/blog/8gb-raspberry-pi-4-on-sale-now-at-75/" target="_blank" rel="noreferrer noopener">RPi4 with 8Gb of RAM</a> I had to get myself one to see if it was already a viable desktop replacement for surfing and emails. </p>
<p>While a SD card works fine for certain tasks (things that don't require a lot of IO) -- for a desktop that's a no-go... It's just too slow.</p>
<p>I still had an old Macbook Pro 13" (2o15?) SSD lying around that was collecting dust. Why not use that one to use as root for the RPi? </p>
<p>This article will focus on making it work on Raspbian first. Technically this should all work on other distros as well, but <a href="https://www.urbandictionary.com/define.php?term=ymmv" target="_blank" rel="noreferrer noopener">YMMV</a> seeing all this is still beta. </p>
<p>I use Raspbian Lite: I like to work with minimalstic systems and install just what I need. But technically this should work with any flavour. </p>
<p>But first, let's prep the device.</p>
<p><strong>Case</strong></p>
<p>I already have a RPi4 (4Gb) at home running mostly Docker containers (nginx proxy and a few personal things and <a href="https://smokeping-sg.superuser.one/" target="_blank" rel="noreferrer noopener">Smokeping</a>). </p>
<p>And one of the 'best' purchases I made for the RPi4 was the "Raspberry Pi 4 Model B Aluminium Case" (<a href="https://web.archive.org/web/20210125015506/https://www.lazada.sg/products/for-raspberry-pi-4-model-b-aluminum-case-passive-cooling-aluminum-alloy-protective-shell-metal-enclosure-for-raspberry-pi-4-model-b-i738812614-s2377660292.html?mp=1" target="_blank" rel="noreferrer noopener nofollow sponsored">Lazada</a>, <a href="https://www.aliexpress.com/item/33051396297.html?spm=a2g0o.productlist.0.0.125a5bd6Y009xm&amp;algo_pvid=0d7b54ae-8c21-4cee-82ad-201fb4359d0c&amp;algo_expid=0d7b54ae-8c21-4cee-82ad-201fb4359d0c-8&amp;btsid=0ab6fb8315926566848663739ead8c&amp;ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_" target="_blank" rel="noreferrer noopener nofollow sponsored">AliExpress</a>). This case is passive and dissipates enough heat (even in a closed cabinet in Singapore where it's 30°) for the CPU never to throttle back when overclocked at 2Ghz (see below). </p>
<p>Do note that this case (which is pretty much just a massive heat sink) gets pretty hot if the RPi is running at max performance for long periods of time. </p>
<p><strong>USB-SSD</strong></p>
<p>Get one that fits your SSD and that ideally has Linux support. As Apple uses custom SSD connectors (prior to being soldered onto the motherboard) I had to get a converter from China. It was a bit of Russian Roulette to see if it would work or be supported on Linux. I got myself <a href="https://www.aliexpress.com/item/4001014439722.html?spm=a2g0o.productlist.0.0.53e65b1eIgYBZs&amp;algo_pvid=07a65076-95e6-4fe9-962d-7a70c22b8df5&amp;algo_expid=07a65076-95e6-4fe9-962d-7a70c22b8df5-1&amp;btsid=0ab50f4415907422600613293e387b&amp;ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_" rel="noreferrer noopener nofollow sponsored" target="_blank">this one</a> (chipset: Netchip Technology). As I didn't remember what type of Macbook Pro this came from, using <a href="https://beetstech.com/product/solid-state-drive-256gb-655-1803" target="_blank" rel="noreferrer noopener">this site</a> to compare serial/model was useful. This USB-to-SSD converted also works on Mac and Windows by the way. </p>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/ssd-enclosure.jpg" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/ssd-enclosure-1024x768.jpg" alt="" class="wp-image-9077"/></a><figcaption>The SSD with the PCB that provides the USB interface.</figcaption></figure></div>
<p>In my case, the RPi also did not provider enough power to the USB-SSD converter (although... it really should but whatevs), so be sure to use the provided power cable and plug it into a USB power source. Not doing so will cause the SSD to heat up and show a bunch of disconnects/errors in <code>dmesg</code>. </p>
<pre class="wp-block-code"><code>raspbian ~ # fdisk -l /dev/sda1 
Disk /dev/sda1: 233.8 GiB, 250999127552 bytes, 490232671 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
raspbian ~ # lsusb 
Bus 002 Device 002: ID 0525:622b Netchip Technology, Inc. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
raspbian ~ # lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 2: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M</code></pre>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/ssd.png" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/ssd-1024x628.png" alt="Raspberry Pi 4 with USB SSD connected" class="wp-image-9059"/></a><figcaption>Raspberry Pi 4 with USB SSD connected</figcaption></figure></div>
<p><strong>eeprom update</strong></p>
<p>Disconnect the USB-SSD for now.</p>
<p>At the time of writing we need to <a href="https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md" target="_blank" rel="noreferrer noopener">update</a> the eeprom to boot from USB. I'm using the latest eeprom available to me. Note that the USB-boot eeprom is about to hit stable so you might not need to do this anymore. </p>
<p>There are two methods for updating. We can do it manually:</p>
<pre class="wp-block-code"><code>rpi-update
cd /lib/firmware/raspberrypi/bootloader/beta
rpi-eeprom-update -d -f ./pieeprom-2020-06-15.bin
# BCM2711 detected
# VL805 firmware in bootloader EEPROM
# BOOTFS /boot
# *** INSTALLING ./pieeprom-2020-06-15.bin ***
# BOOTFS /boot
# EEPROM update pending. Please reboot to apply the update.
reboot
# RPi should come back online after a reboot</code></pre>
<p>Or we use <code>rpi-eeprom-update</code> (see <a href="https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md" target="_blank" rel="noreferrer noopener">article</a>, at the bottom):</p>
<pre class="wp-block-code"><code>nano -w /etc/default/rpi-eeprom-update
# edit critical to stable
rpi-eeprom-update
rpi-eeprom-update -a</code></pre>
<p>The good thing is that, even if you boot from a Raspbian that does not have <code>/etc/default/rpi-eeprom-update</code> edited to use <code>stable</code> instead of <code>critical</code>, it will not downgrade your eeprom. </p>
<p>Now you can plug in the SD card in an USB-SD card reader, and test if the RPi boots from USB. Note that the SD card might be slower. </p>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/rpi-boots-usb-sd.png" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/rpi-boots-usb-sd-1024x993.png" alt="" class="wp-image-9062"/></a><figcaption>RPi booting the SD card from USB (<code>/dev/sda</code>)</figcaption></figure></div>
<p>All right -- so everything is working. I am keeping this SD card to update the eeprom again at a later stage (as the one we flashed is beta). If we use <a href="https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4" target="_blank" rel="noreferrer noopener">Archlinux</a> or Ubuntu the eeprom update tools won't be included. </p>
<p>Next step is to flash Raspbian to the USB-SSD. </p>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/flash-to-ssd.png" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/flash-to-ssd-1024x665.png" alt="" class="wp-image-9065"/></a><figcaption>This screenshot shows <a href="https://ubuntu.com/download/raspberry-pi" target="_blank" rel="noreferrer noopener">Ubuntu</a>, but for the sake of this article, we'll use Raspbian still. I'm using <a href="https://www.balena.io/etcher/" target="_blank" rel="noreferrer noopener">Etcher</a> to flash. </figcaption></figure></div>
<p>Boot-up from the USB-SSD. </p>
<p><strong>Errors</strong></p>
<p>In case you are getting an error similar to <code>start4.elf: is not compatible</code> you'll need to copy paste <code>/boot/start4.elf</code> from a Raspbian that ran <code>rpi-update</code> (i.e. the one from the SD card, or see below). </p>
<p>If you are booting (a fresh) Raspbian, it might complain about <code>cma: Failed to reserve 256 MiB</code> (and several other errors). The solution is running <code>rpi-update</code>. </p>
<p>Boot from the working Raspbian (using the SD card):</p>
<pre class="wp-block-code"><code># check which drive is your USB-SSD (i.e. using fdisk -l or dmesg). 
# In my case I booted from USB-SD (/dev/sda) and we'll update the new/clean Raspbian on the SSD (/dev/sdb).
#
# First resize the partition, if the system never booted it'll be 1.5Gb and thus not big enough:
# Device     Boot  Start     End Sectors  Size Id Type
# /dev/sdb1         8192  532479  524288  256M  c W95 FAT32 (LBA)
# /dev/sdb2       532480 3620863 3088384  1.5G 83 Linux
fdisk /dev/sdb
# Type the following:
# p (and visually check it all makes sense)
# d
# 2
# n
# Select (default p): p
# Partition number (2-4, default 2): &lt;enter>
# First sector (2048-490234751, default 2048): 532480 (or whichever is the same "start" from the 2nd partition) 
# Last sector, +/-sectors or +/-size{K,M,G,T,P} (532480-490234751, default 490234751): &lt;enter>
# Created a new partition 2 of type 'Linux' and of size 233.5 GiB.
# Partition #2 contains a ext4 signature.
# Do you want to remove the signature? &#91;Y]es/&#91;N]o: n
# p (visually check once again it makes sense, if not you can cancel/quit by typing q)
# w (if it makes sense)
# The last command will write the changes to the partition table and sync all changes. 
# Then we need to check and resize the filesystem:
e2fsck -f /dev/sdb2
resize2fs /dev/sdb2
# If all that worked we can start mounting everything
mkdir /tmp/ssd
mount /dev/sdb2 /tmp/ssd/
mount /dev/sdb1 /tmp/ssd/boot/
mount /proc/ /tmp/ssd/proc/ -t proc
mount --rbind /sys/ /tmp/ssd/sys/
mount --rbind /dev/ /tmp/ssd/dev/
# Once everything is mounted, we're chrooting into the fresh Raspbian running on the SSD
chroot /tmp/ssd/ /bin/bash
# you can double confirm the partition size using:
df -h
# And we update the system. Again, if all this hits stable it might not be needed.
rpi-update
# say "y" when it's asking you to.
# exit the chroot and turn off the device, remove the USB-SD and leave USB-SSD connected. 
exit 
halt</code></pre>
<p>My first reboot the boot process threw errors about failing to mount the root fs.</p>
<p>We'll need to update <code>/etc/fstab</code> with the correct <code>partuuid</code>. </p>
<pre class="wp-block-code"><code># Boot from the (USB-)SD card again
# In my case sdb became sda and vice versa, so double check
lsblk
# be sure to select the right disk (the SSD, no the SD)!
mkdir /tmp/ssd
mount /dev/sda2 /tmp/ssd/
# And find the SSD here as well.
# look for the last column, partuuid, something like 
"6f6cc2fb-01"
blkid
nano -w /tmp/ssd/etc/fstab
# edit the existing partuuid's with the ones from blkid
# you'll need to edit both /boot (-01) and / (root, -02).
halt
# When rebooting from the SSD it'll go through a fsck. In my case for some reason it failed and dropped to a shell. I did a manual check and everything was fine. Rebooted and it booted normally... *shrug*</code></pre>
<p><strong>Booting</strong></p>
<p>At this stage booting from the USB-SSD should work just fine. You have a working system booting from USB. </p>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/rpi4-booted-from-ssd.png" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/rpi4-booted-from-ssd-1024x714.png" alt="" class="wp-image-9074"/></a><figcaption>It's working! Now I can configure my system. </figcaption></figure></div>
<p><strong>Overclocking</strong></p>
<p>Last thing I'd recommend is getting a bit more juice out of your four cores.</p>
<p>You can quite easily overclock the RPi4 to 2Ghz (per core). It's a pretty nice boost (~25%) and worth going for. I haven't seen any heat issues leading to underclocking (throttling back), and everything runs stable. Note that under real circumstances you are unlikely to be running at 100% for extended period of times. </p>
<p><a href="https://magpi.raspberrypi.org/articles/how-to-overclock-raspberry-pi-4" target="_blank" rel="noreferrer noopener">This guide</a> explains how to overclock Raspbian (but the same applies for <a href="https://ubuntu.com/download/raspberry-pi" target="_blank" rel="noreferrer noopener">Ubuntu RPi</a> -- I'll eventually be using Ubuntu as the OS due to its 64 bit support; at the moment <a href="https://www.raspberrypi.org/forums/viewtopic.php?f=117&amp;t=275370" target="_blank" rel="noreferrer noopener">Raspbian</a> only supports a 64 bit kernel (beta) and the userland still runs 32 bit. But that'll be a follow-up article. </p>
<p>The gist of the article is to edit <code>/boot/config.txt</code> and add:</p>
<pre class="wp-block-code"><code>over_voltage=6
arm_freq=2000</code></pre>
<p>Save the file, reboot and monitor temp (<code>echo $((cat /sys/class/thermal/thermal_zone0/temp/1000))</code>) and core frequency (<code>watch -n 1 vcgencmd measure_clock arm</code>) while running <code>stress -c 4</code> to make sure the cores are running at 100%.</p>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/rpi4-2ghz.png" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/rpi4-2ghz-1024x628.png" alt="Raspberry Pi 4 running at 2Ghz" class="wp-image-9058"/></a><figcaption>Raspberry Pi 4 running at 2Ghz. It never throttled back after running for ~30 minutes.</figcaption></figure></div>
]]></content:encoded>
      <category>hardware</category><category>linux</category><category>software</category>
      <category>raspberrypi</category><category>ssd</category><category>usb</category>
    </item>
    
    <item>
      <title>iPad Pro USB-C Ethernet</title>
      <link>https://yeri.be/ipad-pro-usb-c-ethernet/</link>
      <pubDate>Sat, 23 May 2020 23:58:00 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/ipad-pro-usb-c-ethernet/</guid><enclosure url="https://static.yeri.be/2020/05/IMG_0165.png" length="0" type="image/png" />
      <description>&lt;p&gt;I’ve had an &lt;a aria-label=&#34;iPad Pro (opens in a new tab)&#34; href=&#34;https://www.apple.com/newsroom/2020/03/apple-unveils-new-ipad-pro-with-lidar-scanner-and-trackpad-support-in-ipados/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34; class=&#34;aioseop-link&#34;&gt;iPad Pro&lt;/a&gt; with the new &lt;a aria-label=&#34;Magic Keyboard (opens in a new tab)&#34; href=&#34;https://www.apple.com/ipad-keyboards/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34; class=&#34;aioseop-link&#34;&gt;Magic Keyboard&lt;/a&gt; and one of the things I&#39;ve been wondering... Say I am stuck in a datacenter and I need to ssh through wired networking to a server -- sure I&#39;ll definitely rather use my Mac laptop, but just in case... But would it actually work?&lt;/p&gt;&#xA;&lt;p&gt;The answer is... Yes -- but...&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2020/05/IMG_0165.png" alt="iPad Pro USB-C Ethernet"></p><p>I’ve had an <a aria-label="iPad Pro (opens in a new tab)" href="https://www.apple.com/newsroom/2020/03/apple-unveils-new-ipad-pro-with-lidar-scanner-and-trackpad-support-in-ipados/" target="_blank" rel="noreferrer noopener" class="aioseop-link">iPad Pro</a> with the new <a aria-label="Magic Keyboard (opens in a new tab)" href="https://www.apple.com/ipad-keyboards/" target="_blank" rel="noreferrer noopener" class="aioseop-link">Magic Keyboard</a> and one of the things I've been wondering... Say I am stuck in a datacenter and I need to ssh through wired networking to a server -- sure I'll definitely rather use my Mac laptop, but just in case... But would it actually work?</p>
<p>The answer is... Yes -- but...</p>
<p>So plugging it straight into the USB-C port of the keyboard doesn't do anything. I.e.: the dongle is not recognised, and for what it's worth the switch doesn't even light up to say a cable is connected. So that doesn't work. </p>
<p>But plugging it straight into the iPad works... The network switch lights up, the iPad (under Settings) gets a new option called "Ethernet" (which oddly shows you <a aria-label="a selection of connected adapters first (opens in a new tab)" href="https://static.yeri.be/2020/05/IMG_0166.png" target="_blank" rel="noreferrer noopener" class="aioseop-link">a selection of connected adapters first</a> -- but I don't know how you can have more than one). Clicking through you see <a aria-label="the same options (opens in a new tab)" href="https://static.yeri.be/2020/05/IMG_0165.png" target="_blank" rel="noreferrer noopener" class="aioseop-link">the same options</a> as you would for your WiFi network: IPs, DNS, etc. </p>
<p>Tadaaa! </p>
<p>I used an adapter from work, a Belkin, and I believe it's the same one that's being sold on the <a aria-label="Apple Store (opens in a new tab)" href="https://www.apple.com/shop/product/HJKF2ZM/A/belkin-usb-c-to-gigabit-ethernet-adapter" target="_blank" rel="noreferrer noopener" class="aioseop-link">Apple Store</a>. I don't know if any dongle will work though (driver-wise and stuff). </p>
<p>Probably not that useful but good to know. </p>
]]></content:encoded>
      <category>apple</category><category>networking</category>
      <category>ipad</category><category>usb</category>
    </item>
    
    <item>
      <title>Vodafone Mobile Connect - Incorrect Pin code</title>
      <link>https://yeri.be/vodafone-mobile-connect-incorrect-pin-code/</link>
      <pubDate>Fri, 10 Jul 2009 22:25:49 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/vodafone-mobile-connect-incorrect-pin-code/</guid>
      <description>&lt;p&gt;As I usually use my SIM card in my iPhone, I booted my PC, plugged in the Vodafone USB Mobile Connect modem (HAUWEI 220 or something). I then inserted, with the USB device plugged in, my SIM card, and booted up the Mac (and later on Windows) Vodafone application, to connect my PC to the Proximus 3G network.&lt;/p&gt;&#xA;&lt;p&gt;This resulted in a constant error; &amp;ldquo;&lt;strong&gt;The pin code was not accepted by the mobile device&lt;/strong&gt;&amp;rdquo;.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>As I usually use my SIM card in my iPhone, I booted my PC, plugged in the Vodafone USB Mobile Connect modem (HAUWEI 220 or something). I then inserted, with the USB device plugged in, my SIM card, and booted up the Mac (and later on Windows) Vodafone application, to connect my PC to the Proximus 3G network.</p>
<p>This resulted in a constant error; &ldquo;<strong>The pin code was not accepted by the mobile device</strong>&rdquo;.</p>
<p>I of course removed the SIM card each time, and inserted it back in my iPhone, and unlocked it by inserting my code. I didn&rsquo;t want to lock my SIM card, and made sure I had at least 2 good tries left each time.</p>
<p>As you can let the application remember the pin code, I was 100% sure it were wrong settings. The worst part, was that the application quits after prompting  that message. I reinstalled, searching in the config files, removed all <em>vodafone</em> files, tried in Windows, changed my pin code a couple of times (the default 0000 one too), updated the HAUWEI firmware, updated the Mobile Connect client software, rebooted, and when I was about to give up, it hit me like a truck. I&rsquo;m from the bloody &ldquo;hotswap generation&rdquo;. And Vodafone sucks. Seriously. Wasted 2 hours on that. Such a waste of time, such a simple solution.</p>
<p>When inserting the SIM card into the device. UNPLUG THE USB MODEM. INSERT SIM. THEN, NOT BEFORE, INSERT IT IN THE DAMN PC. Start the application. Enjoy. No more dodgy error messages, the application works, and you can connect to the bloody internet.</p>
<p>GG Vodafone. GG hotswap.</p>
]]></content:encoded>
      <category>errors</category><category>hardware</category><category>networking</category><category>software</category>
      <category>hotswap</category><category>iphone</category><category>usb</category><category>vodafone</category>
    </item>
    
  </channel>
</rss>
