<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>USB &#8211; Wade Tregaskis</title>
	<atom:link href="https://wadetregaskis.com/tags/usb/feed/" rel="self" type="application/rss+xml" />
	<link>https://wadetregaskis.com</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2024 19:10:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wadetregaskis.com/wp-content/uploads/2016/03/Stitch-512x512-1-256x256.png</url>
	<title>USB &#8211; Wade Tregaskis</title>
	<link>https://wadetregaskis.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">226351702</site>	<item>
		<title>Nikon Z9 doesn&#8217;t work with USB power on a flat battery</title>
		<link>https://wadetregaskis.com/nikon-z9-doesnt-work-with-usb-power-on-a-flat-battery/</link>
					<comments>https://wadetregaskis.com/nikon-z9-doesnt-work-with-usb-power-on-a-flat-battery/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Mon, 21 Mar 2022 22:14:40 +0000</pubDate>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[battery]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[Nikon]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[Z9]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=5104</guid>

					<description><![CDATA[The Nikon Z9 is supposed to be able to work using USB power. And it appears to &#8211; if you have a battery installed that&#8217;s not flat. Otherwise, it refuses to function &#8211; showing a &#8220;Shutter release disabled. Recharge battery&#8221; message in the viewfinder for a second or two before turning itself off again. I&#8230; <a class="read-more-link" href="https://wadetregaskis.com/nikon-z9-doesnt-work-with-usb-power-on-a-flat-battery/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>The Nikon Z9 is <em>supposed</em> to be able to work using USB power.  And it appears to &#8211; <em>if</em> you have a battery installed that&#8217;s not flat.</p>



<p>Otherwise, it refuses to function &#8211; showing a &#8220;Shutter release disabled. Recharge battery&#8221; message in the viewfinder for a second or two before turning itself off again.</p>



<p>I know of no technical reason why this has to be.  And it&#8217;s contrary to Nikon&#8217;s documentation.</p>



<p>(it also refuses to show this message on the LCD, just like for the 24-70/4 error message about extending the lens, making it challenging to figure out why the camera&#8217;s not functioning correctly)</p>



<p>I don&#8217;t know how much charge the battery needs before it will allow the camera to operate on USB power, but it&#8217;s more than one minute of charging and ≤20% charge (my two current data points).</p>



<p>This is pretty annoying.  If I leave the camera on accidentally, as I did yesterday, then even on a fully charged battery it&#8217;ll be flat within eight hours or so.  So it&#8217;s not actually uncommon to pick it up and realise it&#8217;s dead flat.  And in that situation it&#8217;s a complete paperweight for some unspecified amount of time, until you&#8217;ve managed to trickle enough juice into the battery.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/nikon-z9-doesnt-work-with-usb-power-on-a-flat-battery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5104</post-id>	</item>
		<item>
		<title>Swift on Raspberry Pi (in 2019)</title>
		<link>https://wadetregaskis.com/swift-on-raspberry-pi/</link>
					<comments>https://wadetregaskis.com/swift-on-raspberry-pi/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 15 Oct 2019 20:31:24 +0000</pubDate>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Raspberry Pi 4]]></category>
		<category><![CDATA[Raspbian]]></category>
		<category><![CDATA[SATA]]></category>
		<category><![CDATA[Snafu]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[USB]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=4440</guid>

					<description><![CDATA[After the horrible experience just acquiring, installing, &#38; configuring a basic Raspberry Pi, I was anticipating much effort &#8211; likely ending in failure &#8211; to get Swift working. I was pleasantly surprised. There are multiple ways to do it, apparently. One would think that there&#8217;d be the correct &#38; working packages already available through apt,&#8230; <a class="read-more-link" href="https://wadetregaskis.com/swift-on-raspberry-pi/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>After <a href="https://wadetregaskis.com/the-dumpster-fire-that-is-the-raspberry-pi/" data-wpel-link="internal">the horrible experience just acquiring, installing, &amp; configuring a basic Raspberry Pi</a>, I was anticipating much effort &#8211; likely ending in failure &#8211; to get Swift working.</p>



<p>I was pleasantly surprised.</p>



<p>There are multiple ways to do it, apparently.  One would think that there&#8217;d be the correct &amp; working packages already available through <em>apt</em>, but just as with Docker, one would be wrong.  In the case of Swift, there is <a href="https://swift-arm.com" data-wpel-link="external" target="_blank" rel="external noopener">the Swift-ARM site</a> &amp; group that does provide a package repo with pre-built binaries (and various <a href="https://lickability.com/blog/swift-on-raspberry-pi-e44c79fc32f3" data-wpel-link="external" target="_blank" rel="external noopener">tutorials on using them</a>), but oddly they don&#8217;t provide the current version of Swift.</p>



<p>An alternative is <a href="https://github.com/uraimo/buildSwiftOnARM" data-wpel-link="external" target="_blank" rel="external noopener">the buildSwiftOnARM Github repo</a>.  They merely provide tarballs, which is slightly suboptimal, but very straightforward and they have tarballs for essentially every version &#8211; major and minor &#8211; of Swift to date.  The git history also indicates that they&#8217;re very prompt about building tarballs as new versions are released.</p>



<p>Better yet, they provide a couple of shell scripts to build Swift from scratch from source.  Only a couple of dependencies (e.g. clang) need be pre-installed, which can be done quickly &amp; painlessly via <em>apt</em>.</p>



<p>Installing from source is presumably the least reliable approach, but since I had already resigned myself to a miserable experience, I figured I might as well go all in.</p>



<p>However, it works.  Perfectly.  Sure, it takes some time to pull down the huge source base for Swift and all its core dependencies, and some time to build it (though not that long &#8211; hours, not days, contrary to what I read online).  But the end result was a working toolchain.</p>



<p>It remains to be seen exactly how good or bad Swift development on Linux is, given the absence of the numerous Apple system libraries which are what <em>actually</em> distinguish macOS development above other platforms, but at least getting Swift itself installed is painless.</p>



<h4 class="wp-block-heading">Sidenote:  SATA to USB</h4>



<p>The <em>only</em> real speedbump in the whole process, for me, had nothing actually to do with installing Swift itself, but rather the external storage situation on the Raspberry Pi.</p>



<p>The Raspberry Pi doesn&#8217;t offer SATA directly, unfortunately (let-alone any form of pluggable PCIe).  MicroSD is a low-performance, low-reliability, and high-cost option.  So to attach any significant storage you&#8217;re basically going either through Ethernet (e.g. NAS) or USB.</p>



<p>USB to SATA adaptors are a shitshow.  I&#8217;ve tried at least half a dozen different vendors&#8217; offerings over the years, and <em>every single one</em> has been super buggy.  The one I newly acquired for my Raspberry Pi use proved to be no exception.</p>



<p>Long story short on that, the symptoms were I/Os taking incredibly long times to complete (many seconds each, serialised), and generally unusable performance.  <em>/var/log/messages</em> contained countless pages of:</p>



<pre class="wp-block-preformatted">Oct 13 11:13:45 applepi kernel: [  234.087294] sd 0:0:0:0: [sda] tag#2 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
Oct 13 11:13:45 applepi kernel: [  234.087306] sd 0:0:0:0: [sda] tag#2 CDB: opcode=0x28 28 00 77 3b ce 00 00 00 d0 00
Oct 13 11:13:45 applepi kernel: [  234.126541] scsi host0: uas_eh_device_reset_handler start
Oct 13 11:13:45 applepi kernel: [  234.277450] usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Oct 13 11:13:45 applepi kernel: [  234.312541] scsi host0: uas_eh_device_reset_handler success
Oct 13 11:14:15 applepi kernel: [  264.805760] sd 0:0:0:0: [sda] tag#7 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD IN
Oct 13 11:14:15 applepi kernel: [  264.805778] sd 0:0:0:0: [sda] tag#7 CDB: opcode=0x28 28 00 77 3b d1 b8 00 00 48 00</pre>



<p>Turns out this is an incredibly common problem with USB to SATA adaptor chipsets, that&#8217;s documented as such all over the web.  Finding how to solve it was less trivial, because a lot of the advice given is either outright wrong or at least doesn&#8217;t work on Raspbian.  The solution I found, via <a href="https://forums.raspberrypi.com/viewtopic.php?f=28&amp;t=245931" data-wpel-link="external" target="_blank" rel="external noopener">this random thread</a>, was to simply add:</p>



<pre class="wp-block-preformatted">usb-storage.quirks=152d:1561:u</pre>



<p>…to the end of the existing line in <em>/boot/cmdline.txt</em> (where 152d:1561 is the vendor &amp; device IDs for the particular chipset used in my case).  All other variations on this, involving adding similar magic incantations to files in <em>/etc/modprobe.d</em> etc, simply do not do anything on Raspbian.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/swift-on-raspberry-pi/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			<media:content url="https://wadetregaskis.com/wp-content/uploads/2019/10/Swift-on-Raspberry-Pi.webp" medium="image" />
<post-id xmlns="com-wordpress:feed-additions:1">4440</post-id>	</item>
	</channel>
</rss>
