tag:blogger.com,1999:blog-70984742024-03-09T17:12:28.641+00:00Chris’ MiscellaneaMy place to post silly pictures and rants, even though I’m no longer a PhD-student.Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.comBlogger315125tag:blogger.com,1999:blog-7098474.post-35123207286656063452019-01-17T19:00:00.000+00:002019-01-17T19:00:38.912+00:00local DNS resolver, forwarding LAN/DHCP domain to your plasic routerI have a setup which should be typical of the usual computer-savvy person's home network.<br />
<br />
<ul>
<li>residential DSL line, using a "plastic <i>router</i>" (CPE, customer premises equipment), in my case, a "FritzBOX" from AVM</li>
<li>computers I work on (Laptop, Desktop)</li>
<li>server machines I run services on</li>
</ul>
<div>
The local <i>router</i> provides routing (obviously) and hands out IP addresses via DHCP (V4) and stateless IPv6 autoconfiguration, but it also manages a local DNS server synchronized to the DHCP leases (domain <i>fritz.box.</i>). It also registers its external IP address with a dynamic DNS provider, so that I have an externally visible DNS record point to its IPv4 address. I have a static IPv6 address provided by a tunnel provider.</div>
<div>
<br /></div>
<div>
To my local server machine I can SSH from the outside, using the dynamic IPv4 address updated by the router, but also to the static IPv6 address via my tunnel provider:</div>
<div>
<ul>
<li>IPv4 from the outside, home.<i>dyn.domain</i>. A = 84.39.93.115 (dynamic)</li>
<li>IPv6 from the outside, home.<i>dyn.domain</i>. AAAA = 2001:...:fea3 (static)</li>
</ul>
<div>
<b>Problem 1.</b> When on my local LAN, the local server needs to be acessed using its local IPv4 address, or it's global IPv6 address (e.g. 172.17.2.8 (local) and the IPv6 address above 2001:...:fea3 (static)). I can't connect to the local IPv4 address of my server via the dyndns hostname, as I cannot reach 84.29.93.115 from within my LAN, but that's what the SSL certificate is issued to, so I get a warning when using the local IPv4 address.</div>
</div>
<div>
<br /></div>
<div>
<b>Problem 2.</b> The DNS resolver of the "Fritz!BOX" unfortunately forwards to a stupid DNS server which cannot resolve via IPv6 DNS servers (it can resolve IPv6 addresses via IPv4 servers, though).</div>
<div>
<br /></div>
<div>
What I want, therefore, is a 2nd IPv6 aware DNS server which fowards the local LAN domain (fritz.box) to the plastic router, resolves IPv6 addresses.</div>
<div>
<br /></div>
<div>
<b>Problem 3.</b> My provider's DNS is a single point of failure, and doesn't even support DNSsec.</div>
<div>
<br /></div>
<div>
<b>Solution:</b> Run my own DNS resolver, but the local LAN (fritz.box) domain is below <i>box.</i>, so I have to disable DNSsec for those particular domains.</div>
<div>
<ul>
<li>correctly forwards local LAN domains ("fritz.box") and reverse DNS to plastic router</li>
<li>replaces external dynamic DNS IPv4 with local LAN IPv4 address</li>
<li>acts as a caching resolver, without resorting to broken ISP DNS server</li>
</ul>
</div>
<div>
<b>; local resolver</b></div>
<br />
<div>
$ host home.dyn.vogel.cx</div>
<div>
<div>
home.dyn.vogel.cx has address 192.168.178.117</div>
<div>
home.dyn.vogel.cx has IPv6 address 2001:XXX...</div>
</div>
<div>
<br /></div>
<div>
<b>; google DNS (external)</b></div>
<div>
<div>
$ host home.dyn.vogel.cx 8.8.8.8</div>
<div>
home.dyn.vogel.cx has address 84.39.93.115</div>
<div>
home.dyn.vogel.cx has IPv6 address 2001:XXX...</div>
</div>
<div>
<br /></div>
<br />
<div>
<b>; local LAN domains</b></div>
<br />
<div>
$ host optiplex980.fritz.box</div>
<div>
<div>
optiplex980.fritz.box has address 172.17.2.8</div>
<div>
optiplex980.fritz.box has IPv6 address 2001:XXX...</div>
</div>
<div>
<br /></div>
<div>
<b>; local LAN reverse</b></div>
<div>
<div>
$ host 172.17.2.8</div>
<div>
8.2.17.172.in-addr.arpa domain name pointer optiplex980.fritz.box.</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<br />
<div>
<br /></div>
<div>
<u>Configuration</u></div>
<div>
<br /></div>
<div>
/etc/named.conf</div>
<div>
<br /></div>
<br />
<div>
<span style="font-family: Courier New, Courier, monospace;">logging {</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> category default { default_syslog; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> category unmatched { null; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">key "rndc-key" {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> algorithm "hmac-sha256";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> secret "<b>XXX</b>";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">controls {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> inet 127.0.0.1 port 953 allow {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 127.0.0.1/32;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> } keys {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> "rndc-key";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">options {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> directory "/var/named";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> hostname none;</span></div>
</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> listen-on-v6 { "any"; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> pid-file "/run/named/named.pid";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> querylog no;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> server-id none;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> version none;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> allow-recursion {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 127.0.0.1/32; /* localhost */</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> ::1/128;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 10.0.0.0/8; /* RFC1918 */</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 172.16.0.0/12;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 192.168.0.0/16;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 169.254.0.0/16; /* link-local */</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> fe80::/16;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> fd00::/16;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 2001:<b>XXX:XXX:XXX</b>::/64; /* local IPv6 Prefix */</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> allow-transfer { none; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> allow-update { none; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> empty-zones-enable no;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> stale-answer-enable yes;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> /* didn't find this in the manual, but in the changelog</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> to BIND 9.13.3, this option specifies a list of domains</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> beneath which DNSSEC validation should not be performed */</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <b>validate-except {</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b> "fritz.box";</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b> "fritz.nas";</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b> "wpad.box";</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b> };</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "localhost" IN {</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type master;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "localhost.zone";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "0.0.127.in-addr.arpa" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type master;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "127.0.0.zone";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type master;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "localhost.ip6.zone";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "255.in-addr.arpa" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type master;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "empty.zone";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "0.in-addr.arpa" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type master;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "empty.zone";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "." IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type hint;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "root.hint";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># --- resolve our "dynamic DNS" correctly to the internal ---</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># --- ip addresses (which are obviously not dynamic) ---</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "dyn.XXX.XXX" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type master;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> file "dyn.XXX.XXX.zone";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b># --- local plastic "router" is managing these zones ---</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># fritz.box</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "fritz.box" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type forward;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forward only ;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forwarders { 172.17.2.1; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "wpad.box" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type forward;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forward only ;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forwarders { 172.17.2.1; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "fritz.nas" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type forward;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forward only ;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forwarders { 172.17.2.1; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># 172.17.2/24</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "2.17.172.in-addr.arpa" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type forward;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forward only ;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forwarders { 172.17.2.1; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># 2001:<b><i>XXXXX</i></b>::/64</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.ip6.arpa" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type forward;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forward only ;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forwarders { 172.17.2.1; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># fd00::/64</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f.ip6.arpa" IN {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> type forward;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forward only ;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> forwarders { 172.17.2.1; };</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">};</span></div>
</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>/var/named/dyn.XXX.XXX.zone</b></div>
<div>
<br /></div>
<div>
<div>
<br /></div>
<div>
@ 86400 IN SOA home hostmaster (</div>
<div>
2018110401 ;serial</div>
<div>
10800 ;refresh</div>
<div>
1800 ;retry</div>
<div>
604800 ;expire</div>
<div>
86400 ;minimum</div>
<div>
)</div>
<div>
<br /></div>
<div>
@ IN NS home</div>
<div>
@ IN MX 10 home</div>
<div>
<b><br /></b></div>
<div>
<b>; local addresses of my home server</b></div>
<div>
<b>home IN A 192.168.178.117</b></div>
<div>
<b>home IN AAAA 2001:XXX:XXX:XXX:XXX:XXX:XXX:XXX</b></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-15012801402117558512019-01-05T15:21:00.001+00:002019-01-05T15:26:05.140+00:00i2c on your unused/legacy VGA outputAlmost every PC/notebook still has a <a href="https://en.wikipedia.org/wiki/VGA_connector">VGA connector,</a> which can be used as a very cheap way to quickly test various <a href="https://en.wikipedia.org/wiki/I%C2%B2C">i2c</a> peripherals. On a VGA connector, it would have been used to query the remote monitor for its <a href="https://en.wikipedia.org/wiki/Extended_Display_Identification_Data">supported resolutions,</a> but most graphics drivers in Linux just use the<br />
<a href="https://www.kernel.org/doc/Documentation/i2c/dev-interface">kernel's generic i2c support.</a><br />
<i><br /></i>
<i>This is a quick note for myself, so that I can easily copy & paste whenever needed again ;-).</i><br />
<br />
From the linked Wikipedia page:<br />
<br />
Pin 9<span style="white-space: pre;"> </span>KEY/PWR<span style="white-space: pre;"> </span>formerly key, now +5V DC, powers EDID EEPROM chip on some monitors<br />
Pin 10<span style="white-space: pre;"> </span>GND<span style="white-space: pre;"> </span>Ground (VSync, DDC)<br />
Pin 12<span style="white-space: pre;"> </span>ID1/SDA<span style="white-space: pre;"> </span>formerly Monitor ID bit 1, I²C data since DDC2<br />
Pin 15<span style="white-space: pre;"> </span>ID3/SCL<span style="white-space: pre;"> </span>formerly Monitor ID bit 3, I²C clock since DDC2<br />
<br />
<b>Step 1</b>, make sure your graphics card actually exports this i2c device (check the names of all busses in /sys/bus/i2c/devices).<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ grep "" /sys/bus/i2c/devices/i2c-*/name</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-0/name:SMBus I801 adapter at 0580</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-1/name:i915 gmbus ssc</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-2/name:i915 gmbus vga</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-3/name:i915 gmbus panel</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-4/name:i915 gmbus dpc</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-5/name:i915 gmbus dpb</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-6/name:i915 gmbus dpd</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-7/name:DPDDC-B</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/sys/bus/i2c/devices/i2c-8/name:DPDDC-C</span><br />
<div>
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-3xkpcjgtKTo/XDDIkocjb1I/AAAAAAAAHyU/UAvYB92uCLsERW9xnK4TL8YA8QoESpm0wCLcBGAs/s1600/busses_sysfs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="383" data-original-width="932" height="131" src="https://1.bp.blogspot.com/-3xkpcjgtKTo/XDDIkocjb1I/AAAAAAAAHyU/UAvYB92uCLsERW9xnK4TL8YA8QoESpm0wCLcBGAs/s320/busses_sysfs.png" width="320" /></a></div>
<br />
<b>Step 2</b>, make sure a user can conveniently access this bus without becoming root.<br />
<br />
$<span style="font-family: "courier new" , "courier" , monospace;"> cat /etc/udev/rules.d/99-i2c-vga-chmod.rules </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">ACTION=="add", SUBSYSTEM=="i2c-dev", ATTR{name}=="i915 gmbus vga", MODE="0660", GROUP="users", SYMLINK+="i2c-vga"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">#</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># udevadm info -a -p \$(udevadm info -q path -n /dev/i2c-2)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">#</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># Udevadm info starts with the device specified by the devpath and then</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># walks up the chain of parent devices. It prints for every device</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># found, all possible attributes in the udev rules key format.</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># A rule to match, can be composed by the attributes of the device</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># and the attributes from one single parent device.</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># looking at device '/devices/pci0000:00/0000:00:02.0/i2c-2/i2c-dev/i2c-2':</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># KERNEL=="i2c-2"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># SUBSYSTEM=="i2c-dev"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># DRIVER==""</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># ATTR{name}=="i915 gmbus vga"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># looking at parent device '/devices/pci0000:00/0000:00:02.0/i2c-2':</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># KERNELS=="i2c-2"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># SUBSYSTEMS=="i2c"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># DRIVERS==""</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># ATTRS{name}=="i915 gmbus vga"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">(...)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;"><b>Step 3,</b> make sure the i2c-dev kernel module is loaded upon boot.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">$ cat /etc/modules-load.d/i2c-dev.conf </span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">i2c-dev</span><br />
<div>
<br /></div>
<div>
<b>Step 4,</b> solder a matching cable from 15pin DSUB to whatever is convenient for you, I suggest some individual connectors for pin headers.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-f0mFD82RirA/XDDJ4FIY5XI/AAAAAAAAHyg/n24hOx_64hcDdRB8aeo7i3omBryCvDf7ACLcBGAs/s1600/Dsub-15-Pin-Three-Rows-Female-HDP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="384" data-original-width="538" height="228" src="https://4.bp.blogspot.com/-f0mFD82RirA/XDDJ4FIY5XI/AAAAAAAAHyg/n24hOx_64hcDdRB8aeo7i3omBryCvDf7ACLcBGAs/s320/Dsub-15-Pin-Three-Rows-Female-HDP.png" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<span style="font-family: inherit;"><b>Step5</b>, Profit!</span><br />
<span style="font-family: inherit;"><br /></span>
(I'm using a HYT271 humidity and gemperature sensor for testing, it's showing 39 %rh and 26 °C, the <a href="https://github.com/dpw/hygrochip-linux">small utility is by David Wragg and to be found on github</a>.)<br />
<span style="font-family: inherit;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8V_O0HsLnDIHOd5BZLQw7RmgbZViDtkN5W_51tQfnqfIHQc5Up490CzPxAhXKaclfZm7avGrUAmbBWzzI4p5-8MNZNklDmNfBVgcqU3Y3jfnSNj0FV7oEpqtDP5x0KXl9-9jHOw/s1600/success.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="130" data-original-width="500" height="83" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8V_O0HsLnDIHOd5BZLQw7RmgbZViDtkN5W_51tQfnqfIHQc5Up490CzPxAhXKaclfZm7avGrUAmbBWzzI4p5-8MNZNklDmNfBVgcqU3Y3jfnSNj0FV7oEpqtDP5x0KXl9-9jHOw/s320/success.png" width="320" /></a></div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><br /></span>
<br />
<div>
It should be noted that this will obviously work almost identical on DVI/DisplayPort/HDMI outputs, your motherboard's SMBUS, your random USB peripheral that exposes an i2c bus, ...</div>
<div>
<br />
A quick warning, these i2c-busses are often bit-banged and will consume a considerable amount of cycles on your 3Ghz Octacore i7 while clocking out a few kBits/second via i2c. :-)</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-77777956432396254112018-05-12T09:58:00.003+00:002018-05-12T10:01:42.785+00:00Behringer X32 and S16 Preamp Noise<div class="separator" style="clear: both; text-align: left;">
I got myself a <a href="https://www.musictri.be/Categories/Behringer/Mixers/Digital/X32-COMPACT/p/P0AAP">Behringer X32 Compact </a>mixing desk and B<a href="http://www.musictri.be/Categories/Behringer/Mixers/I-O-Interfaces/S16/p/P0AJA">ehringer S16 Stageboxes</a>. Because sometimes I record classical concerts, or have ambient microphones that get very little signal, I wanted to verify the preamp performance to avoid nasty surprises.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
To establish the voltage scale when recording, a sine-generator generating 1kHz was fed into a passive DI box, and adjusted in amplitude, so that a 1Vrms signal was present on the DI box XLR output. This 1Vrms signal could be easily measured with a TRMS multimeter. Then both the 20dB pad on the DI-box and a 40dB pad on the function generator were engaged, so that a 1mVrms signal is output on the DI box. This sinewave was fed into all devices under test at maximum gain. (See Fig. 2)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Sucessively the XLR connection to the DI box was removed and the input was shorted. A 2nd recording was then made, with identical gain settings only capturing the noise. (See Fig. 1)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Preamps tested were:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>EchoAudio EchoFire 4, which uses a <a href="http://www.analog.com/en/products/obsolete/ssm2017.html">now obsolete SSM2017</a> from which noise performance is known and documented</li>
<li>Preamps within the X32 Compact mixing console, using the local XLR input</li>
<li>Preamps within the two S16 stage boxes</li>
</ul>
<div>
In python (using numpy), the rms of the sinewave-recording was calculated relative to digital full-scale and the noise recording scaled with the resulting factor (e.g. -21.0 dBrms/full-scale for the EchoFire4 recording). From this data the noise density in nV/√Hz was calculated using <a href="https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.welch.html">Scipy's scipy.signal.welch</a> results.</div>
<div>
<br /></div>
<div>
The spikes present are most likely caused by switching voltage regulators within, or in vincinity of, the devices. Generally the Behringer preamps have slightly higher noise than the very respectable SSM2017 within the EchoAudio firewire interface, but all in all the difference is pretty much irrelevant (approx. ~1.5dB more noise than the SSM2017, adds approx. 3 dB to the thermal noise of the 200Ω resistor) for practical use.</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-kHMZhK-zdRs/Wva1Utc-5PI/AAAAAAAAHd0/sz2dW-tqBFchUcjiFBoLAs5-7McB-hK-gCLcBGAs/s1600/preamp_noise.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="640" height="240" src="https://1.bp.blogspot.com/-kHMZhK-zdRs/Wva1Utc-5PI/AAAAAAAAHd0/sz2dW-tqBFchUcjiFBoLAs5-7McB-hK-gCLcBGAs/s320/preamp_noise.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Fig1: Noise Analysis (with inputs shunted by 200Ω)</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-2JjOssbyYck/Wva1VV9d__I/AAAAAAAAHd4/FJfhzSZq_iQZ9OgX8PlFbBy686fOveO6ACLcBGAs/s1600/ref_sine.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="640" height="240" src="https://2.bp.blogspot.com/-2JjOssbyYck/Wva1VV9d__I/AAAAAAAAHd4/FJfhzSZq_iQZ9OgX8PlFbBy686fOveO6ACLcBGAs/s320/ref_sine.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Fig2: Reference Recording of 1mVrms, 1kHz Sine Wave</div>
<br />
Useful Links<br />
<br />
<ul>
<li><a href="http://www.sengpielaudio.com/calculator-db-volt.htm">http://www.sengpielaudio.com/calculator-db-volt.htm</a></li>
<li><a href="http://www.rane.com/note148.html">http://www.rane.com/note148.html</a></li>
<li><a href="https://www.sounddevices.com/tech-notes/microphone-preamp-noise">https://www.sounddevices.com/tech-notes/microphone-preamp-noise</a></li>
</ul>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-24754045659366852032017-09-11T15:27:00.001+00:002017-09-11T15:27:48.972+00:00VHDL Testbench using Oscilloscope WaveformsI got a little tired of writing a generator for synthetic data in a VHDL testbench, so I thought, maybe just use an oscilloscope trace with real-workd data for this purpose.<br />
<br />
So, here's the VHDL code, I've only captured one channel and it's stored as unsigned 8-bit characters, so everything is very easy.<br />
<br />
<br />
<br /><blockquote class="tr_bq">
signal aes3_in : std_logic;<br />signal aes3_analog : natural;<br />type t_stim_file is file of character;<br /> data_in: process<br /> -- waveform captured on a rigol oscilloscope, 1ch, 8bit, 1GS/s<br /> file stim_file : t_stim_file open read_mode is "aes_48khz_24bit.wfm";<br /> variable v : character;<br /> variable n : natural range 0 to 255;<br /> begin<br /> -- skip over the first 3300 bytes, header of the wfm file<br /> for i in 0 to 3300 loop<br /> read(stim_file, v);<br /> end loop;<br /> while not endfile(stim_file) loop<br /> read(stim_file, v);<br /> n := character'pos(v);<br /> aes3_analog <= n;<br /> aes3_in <= '1' when n > 90 else '0';<br /> wait for 1 ns; -- 1GHz sampling rate<br /> end loop;<br /> assert false report "end of test" severity failure; -- end testbench here<br /> end process;</blockquote>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWHYpgiAzMkwCuCu_ePBAigyw3Hn3sy_K0jqm_YEWdMRnN_m5KCaWqRePL5TftVVcZ-TsYJlnzew7ToN9IOy5TRHQQ1IofsEI7uO4RVOYBdKKJhbRe3Yz68BPEf7bbb7_7gk4aBg/s1600/Screenshot_2017-09-11_17-22-58.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="663" data-original-width="909" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWHYpgiAzMkwCuCu_ePBAigyw3Hn3sy_K0jqm_YEWdMRnN_m5KCaWqRePL5TftVVcZ-TsYJlnzew7ToN9IOy5TRHQQ1IofsEI7uO4RVOYBdKKJhbRe3Yz68BPEf7bbb7_7gk4aBg/s320/Screenshot_2017-09-11_17-22-58.png" width="320" /></a></div>
<br />
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-46396624692097416082017-07-24T20:34:00.003+00:002017-07-24T20:34:54.725+00:00Mixing Station X Air Pro XR18 Default LayoutWorking with a <a href="https://www.music-group.com/Categories/Behringer/Mixers/Digital-Mixers/XR18/p/P0BI8">Behringer XR18 Mixer</a> and using the brilliant <a href="https://play.google.com/store/apps/details?id=com.davidgiga1993.mixingstation.xairpro&hl=en">Mixing Station Air</a> software, I've made a custom layout for it. It can be downloaded from <a href="https://github.com/vogelchr/mixing_station_x18_layout">github</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://github.com/vogelchr/mixing_station_x18_layout/raw/master/default.layouts.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="500" data-original-width="800" height="200" src="https://github.com/vogelchr/mixing_station_x18_layout/raw/master/default.layouts.png" width="320" /></a></div>
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-89166592850505556962017-03-23T18:41:00.000+00:002017-03-23T18:52:22.447+00:00Roland TD-25 (Drum Sound Module) Pinout and WaveformsDebugging an issue with a <a href="https://www.roland.com/global/products/td-25k/">Roland TD-25K electronic drum set</a>.<br />
<br />
First, here are the outputs of the trigger-pads. Yellow is "tip" of a TRS connector, cyan is "ring". Both the bell and the dampening signals of the cymbals connect to the ring and there's a constant voltage offset (which you don't see because the 2nd (cyan) channel was AC coupled.<br />
<br />
PDX-100 Snare Pad<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://1.bp.blogspot.com/-vKjE2sgAigc/WNQTYYhPo_I/AAAAAAAAGxk/sCjqu3RTGY0UairY0wRuFjKd_-4mO1SXwCLcB/s1600/DS1Z_QuickPrint1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://1.bp.blogspot.com/-vKjE2sgAigc/WNQTYYhPo_I/AAAAAAAAGxk/sCjqu3RTGY0UairY0wRuFjKd_-4mO1SXwCLcB/s320/DS1Z_QuickPrint1.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioNa-ZFNEHaZV2Dq-jo5T150vIQw48w1ONyv-3oaMHFT9grHOcYXvPTVudavUV303wH0T4ztvqt5r2lNgcjRnJ0ylpAJn72JAs6t5S_gGWq6KU29oHOO2c6uTrJ_uDZ6imeOAHHw/s1600/DS1Z_QuickPrint2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioNa-ZFNEHaZV2Dq-jo5T150vIQw48w1ONyv-3oaMHFT9grHOcYXvPTVudavUV303wH0T4ztvqt5r2lNgcjRnJ0ylpAJn72JAs6t5S_gGWq6KU29oHOO2c6uTrJ_uDZ6imeOAHHw/s320/DS1Z_QuickPrint2.png" width="320" /></a></div>
<br />
CY-13R Ride Cymbal, "Cymbal" connector:<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibxDn0pMaRwg-E1NP_BN1puMLnc0sK3P__cX9btCPXnxt7HfYxeBWsAg2xb4b5_QnHwka6wbGZfiPGvwVBFYlZAYrHNLSQkPOhtdeOC3I1biivE3QaczRAXwZFkou5F2H-QJEJlQ/s1600/DS1Z_QuickPrint5.png" imageanchor="1" style="clear: right; display: inline !important; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibxDn0pMaRwg-E1NP_BN1puMLnc0sK3P__cX9btCPXnxt7HfYxeBWsAg2xb4b5_QnHwka6wbGZfiPGvwVBFYlZAYrHNLSQkPOhtdeOC3I1biivE3QaczRAXwZFkou5F2H-QJEJlQ/s320/DS1Z_QuickPrint5.png" width="320" /></a><br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyqGOpNw_CtGzPSctohHFcZ6bMYMNUB6XZqTsZVeEHSv0S_x-g8ByGmSxia51EebnvMIqYAGGGfP0EE38TfPyl5XxQmd9jST_x2Ln2XPQmV-iK7k0p_z0vAeTbl-cXrFvDv2WWxg/s1600/DS1Z_QuickPrint4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyqGOpNw_CtGzPSctohHFcZ6bMYMNUB6XZqTsZVeEHSv0S_x-g8ByGmSxia51EebnvMIqYAGGGfP0EE38TfPyl5XxQmd9jST_x2Ln2XPQmV-iK7k0p_z0vAeTbl-cXrFvDv2WWxg/s320/DS1Z_QuickPrint4.png" width="320" /></a></div>
<br />
Ride Cymbal, "Bell" connector:<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://3.bp.blogspot.com/-n9E8UL1uzRw/WNQTYCpymiI/AAAAAAAAGxg/U2CJ2DN4SnoQY4giKP5FLWlgI83BiE4sgCLcB/s1600/DS1Z_QuickPrint3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://3.bp.blogspot.com/-n9E8UL1uzRw/WNQTYCpymiI/AAAAAAAAGxg/U2CJ2DN4SnoQY4giKP5FLWlgI83BiE4sgCLcB/s320/DS1Z_QuickPrint3.png" width="320" /></a></div>
<br />
<br />
Also, I traced the pinout of the <a href="https://www.roland.com/global/products/td-25/">Roland TD-25</a> multipin/dsub connector.<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://4.bp.blogspot.com/-cOlI22bOVoA/WNQTYgda9kI/AAAAAAAAGx0/ZCQdLiQhQm0a6-hXKRa5rW1TN8DOUqvzgCLcB/s1600/roland-td25-dsub-pinout.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="314" src="https://4.bp.blogspot.com/-cOlI22bOVoA/WNQTYgda9kI/AAAAAAAAGx0/ZCQdLiQhQm0a6-hXKRa5rW1TN8DOUqvzgCLcB/s320/roland-td25-dsub-pinout.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> /--+</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> +-/ |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 1 KIK-T</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T1-T 14 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 2 KIK gnd</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T1-R 15 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 3 SNR-T</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T1 gnd 16 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 4 SNR-R</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T2-T 17 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 5 SNR gnd</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T2-R 18 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 6 HH+T2 gnd</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T3 gnd 19 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 7 HH-T</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T3-T 20 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 8 HH-R</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> T3-R 21 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 9 HHC gnd</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> RD/RDB gnd 22 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 10 HHC-T</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> RD-R 23 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 11 CR1 gnd</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> RD-T 24 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 12 CR1 T</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> RDB-R 25 | O |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> | O | 13 CR1 R</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> +-\ |</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"> <span class="Apple-tab-span" style="white-space: pre;"> </span> \-+</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
gnd: sleeve/ground, T: tip, R: ring</div>
<div class="separator" style="clear: both; text-align: left;">
T1/T2/T3: Tom 1, 2, 3</div>
<div class="separator" style="clear: both; text-align: left;">
RD: Ride</div>
<div class="separator" style="clear: both; text-align: left;">
RDB: Ride Bell</div>
<div class="separator" style="clear: both; text-align: left;">
HH: Hihat</div>
<div class="separator" style="clear: both; text-align: left;">
HHC: Hihat pedal</div>
<div class="separator" style="clear: both; text-align: left;">
KIK: Kick/Bassdrum</div>
<div class="separator" style="clear: both; text-align: left;">
SNR: Snare</div>
<div class="separator" style="clear: both; text-align: left;">
CR1: Crash Cymbal</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-72185507940466363922016-11-09T10:38:00.003+00:002016-11-09T21:33:21.083+00:00Archlinux on the Toradex T20 (with Archlinux' kernel)This is a followup on my earlier blogpost <a href="http://vogelchr.blogspot.com/2012/12/note-archlinux-on-toradex-t20.html">Archlinux on the Toradex T20</a> from 2012.<br />
<br />
I happened to resurrect my old <a href="https://www.toradex.com/">Toradex</a> <a href="https://www.toradex.com/computer-on-modules/colibri-arm-family/nvidia-tegra-2">NVidia Tegra T20 / Colibri</a> / <a href="http://developer.toradex.com/products/iris-carrier-board">Iris eval-board</a>, which I had running using Toradex' kernel back in 2012 already. And it's amazingly smooth to run the stock Archlinux-Arm distribution for ARM7 CPUs on it, as I found out:<br />
<br />
You'll need:<br />
<br />
<ul>
<li>a SD-card formatted using the EFI partition table format (the stock uboot for whatever reason didn't like it when I had it partitioned as MBR)</li>
<li>two partitions, one for boot, one for the rest (I used vfat / ext4)</li>
<li>mkfs.vfat on the first partition (will be mmcblock0p1 on the Toradex), mkfs.ext4 for the 2nd.</li>
<li>mount the first partition (vfat) as "boot" in the second partition (ext4, rootfs)</li>
<li>unpack http://os.archlinuxarm.org/os/ArchLinuxARM-trimslice-latest.tar.gz in the 2nd partition</li>
<li>in "boot" create a <span style="font-family: "courier new" , "courier" , monospace;">uImage</span> from the <span style="font-family: "courier new" , "courier" , monospace;">zImage</span> (the stock u-boot of Toradex can't boot zimages directly), I use the following script (on the toradex module itself, useful after a kernel upgrade!) You'll need the "mkimage" utility from <a href="https://www.archlinux.org/packages/community/x86_64/uboot-tools/">uboot-tools</a>.</li>
</ul>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">[root@alarm ~]# cat /usr/local/sbin/mkuimage.sh </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#!/bin/sh</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">mkimage -A arm -O linux -T kernel -C none \</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>-a 0x00008000 -e 0x00008000 \</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>-n "Linux Kernel" -d /boot/zImage /boot/UImage</span></div>
</div>
<div>
<br /></div>
<div>
Interrupt the bootloader (in the stock configuration, bootdelay is zero, so you'll have to hit your keys hard to get it to interrupt the boot!) and configure the following environment variables like so:</div>
<div>
<br /></div>
<div>
(copy & paste every line separately, I got lost characters when I paste then as a whole!)</div>
<div>
<br /></div>
<span style="font-family: "courier new", courier, monospace;">env default -f</span><br />
<div>
<span style="font-family: courier new, courier, monospace;">setenv dtaddr 0x1000000</span><br />
<span style="font-family: courier new, courier, monospace;">setenv dtbname tegra20-iris-512</span><br />
<span style="font-family: courier new, courier, monospace;">setenv myload_img fatload mmc 0:1 \${loadaddr} uimage</span><br />
<span style="font-family: courier new, courier, monospace;">setenv myload_fdt fatload mmc 0:1 \${dtaddr} dtbs/\${dtbname}.dtb \; fdt addr \${dtaddr}</span><br />
<span style="font-family: courier new, courier, monospace;">setenv myload mmc part\;run myload_img\;run myload_fdt</span><br />
<span style="font-family: courier new, courier, monospace;">setenv myargs setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootdelay=2</span><br />
<span style="font-family: courier new, courier, monospace;">setenv myboot run myargs \; run myload \; bootm \${loadaddr} - \${dtaddr}</span><br />
<span style="font-family: courier new, courier, monospace;">setenv bootcmd run myboot</span><br />
<span style="font-family: courier new, courier, monospace;">setenv bootdelay 5</span><br />
<span style="font-family: courier new, courier, monospace;">saveenv</span></div>
<div>
<br /></div>
<div>
If you <i><b>just want to test</b></i>, leave out the last "<span style="font-family: "courier new" , "courier" , monospace;">saveenv</span>" and type "<span style="font-family: "courier new" , "courier" , monospace;">run myboot</span>", after a reset, your Toradex module will still be completely unchanged. If you save the environment (u-boot configuration) with "<span style="font-family: "courier new" , "courier" , monospace;">saveenv</span>", the module should boot up archlinux automatically.</div>
<br />
<i><b>Update: </b></i>I just realized, the variable "<span style="font-family: Courier New, Courier, monospace;">fdtaddr</span>" I used initially is used by u-boot internally and overwritten on every boot, don't use it then :-).<br />
<br />
Bootup:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">U-Boot 2011.06-dirty (Dec 18 2014 - 22:27:35)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">TEGRA2</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">DRAM: 512 MiB</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">NAND: 1024 MiB</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">MMC: Tegra2 SD/MMC: 0</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Board: Toradex Colibri T20</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Net: Net Initialization Skipped</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">No ethernet found.</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Hit any key to stop autoboot: 0 </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Partition Map for MMC device 0 -- Partition Type: EFI</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Part Start LBA End LBA</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">gpt1 0x800 0x407FF</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">gpt2 0x40800 0x1D47BDE</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">reading uimage</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">5623992 bytes read</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">reading dtbs/tegra20-iris-512.dtb</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">28979 bytes read</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">## Booting kernel from Legacy Image at 00408000 ...</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Image Name: Linux Kernel</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Created: 2016-11-08 21:31:41 UTC</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Image Type: ARM Linux Kernel Image (uncompressed)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Data Size: 5623928 Bytes = 5.4 MiB</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Load Address: 00008000</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Entry Point: 00008000</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Verifying Checksum ... OK</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">## Flattened Device Tree blob at 01000000</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Booting using the fdt blob at 0x1000000</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Loading Kernel Image ... OK</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">OK</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Loading Device Tree to 01ff5000, end 01fff132 ... OK</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Starting kernel ...</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">[ 0.000000] Booting Linux on physical CPU 0x0</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">[ 0.000000] Linux version 4.8.6-1-ARCH (builduser@leming) (gcc version 6.2.1 20160830 (GCC) ) #1 SMP Mon Oct 31 23:22:19 MDT 2016</span><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-57315363302933224742016-10-22T14:25:00.004+00:002016-10-23T10:27:22.119+00:00Port of William R. Sowerbutts' socz80 to a cheap Spartan6 board (ESPIER_III V105)I've ported <a href="http://sowerbutts.com/socz80/">William R. SOwerbutts socz80: A Z80 retro microcomputer for the Papilio Pro FPGA board</a> to another cheap FPGA board. My port <a href="https://github.com/vogelchr/socz80_espier_iii_v105">can be found on github</a>.<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-17659501895640943932016-04-17T19:24:00.002+00:002016-08-05T10:17:31.747+00:00Yamaha DGX-620 LCD Repair/Retrofit<b>UPDATE:</b> Ulrich Borghoff did his repair slightly different and sent in photos. Thanks Ulrich!<br />
<br />
Here's a <a href="http://usa.yamaha.com/products/musical-instruments/keyboards/digitalkeyboards/dgx_series/dgx-620/">Yamaha DGX-620</a> keyboard with a broken LCD. Judging from the fact that there are quite a few videos and tutorials on how to exchange a broken LCD with the proper spare part, I'd reckon these LCDs break quite easily and often.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-vmGo8EtX0LOk72wx1bcQ7iKf8Mla2vplLmD9Ih2SJnljdH5QUzyB_A-akKS2IdyVe9EOTg_xCl8WQqH5hx7RUcrne0BvCSzMoJhQMvzzD7QxR-aOLRWnt_qIPX1bgwRZMvIAiA/s1600/IMG_20160407_172818.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-vmGo8EtX0LOk72wx1bcQ7iKf8Mla2vplLmD9Ih2SJnljdH5QUzyB_A-akKS2IdyVe9EOTg_xCl8WQqH5hx7RUcrne0BvCSzMoJhQMvzzD7QxR-aOLRWnt_qIPX1bgwRZMvIAiA/s320/IMG_20160407_172818.jpg" width="320" /></a></div>
<div style="text-align: center;">
(Broken LCD)</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-v-Mur9YWYE4/VxPdtvZP4lI/AAAAAAAAF6w/o88EEQJ6vhAVZr61Ptgosolj5JnkenpBQCKgB/s1600/IMG_20160407_182434.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://3.bp.blogspot.com/-v-Mur9YWYE4/VxPdtvZP4lI/AAAAAAAAF6w/o88EEQJ6vhAVZr61Ptgosolj5JnkenpBQCKgB/s320/IMG_20160407_182434.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(Original LCD module: The slightly kink in the flexfoil is enough to ruin the module, this slight damage is, unfortunately, not repairable.) </div>
<br />
<br />
I was a little surprised to get a quote of 130€ ($150) for the replacement (Yamaha Part # WG299100), and I was looking for a replacement that's cheaper. As this is a fill-in instrument, and long out of warranty, I wouldn't mind not getting the original part. Also I don't mind the tinkering.<br />
<br />
Enter <a href="http://www.pollin.de/shop/index.html">Pollin</a>, a company selling electronic remnants, such as bags with 1kg of capacitors, sold as “perfect for tinkering”. By chance, they sell a “<a href="http://www.pollin.de/shop/dt/Mjk2ODc4OTk-/Bauelemente_Bauteile/Aktive_Bauelemente/Displays/LCD_Modul_NAN_YA_LTC79H202T50K_240x320.html">LCD-Modul NAN YA LTC79H202T50K, 240x320</a>” (order #121307, €4/$5) which, on closer examination, is electrically 100% compatible to the Yamaha display. Only with a slightly different, smaller shape, and with a different pinout. Also, they sell the exact same flex-cable that Yamaha uses to connect the LCD to the CPU board: <a href="http://www.pollin.de/shop/dt/ODQ3NzM0OTk-/Haustechnik/Kabel_Draehte_Litzen/Kabel_Leitungen/Flexprint_Kabel_AXON_FFC1_00A14_0200L5_5_10_10.html">Flexprint-Kabel AXON FFC1.00A14/0200L5-5-10-10 (#562251)</a> (€1).<br />
<br />
<a href="http://2.bp.blogspot.com/--lIG_WYYI1Y/VxPcBgc2WOI/AAAAAAAAF5o/jOotTlQD6ZQ_2uxjj5irzudFe00-KY-TACK4B/s1600/pollin_lcd.png" imageanchor="1"><img border="0" height="173" src="https://2.bp.blogspot.com/--lIG_WYYI1Y/VxPcBgc2WOI/AAAAAAAAF5o/jOotTlQD6ZQ_2uxjj5irzudFe00-KY-TACK4B/s400/pollin_lcd.png" width="400" /></a><br />
(Pollin: Product Page)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhntVfoQYf3ffP22_k2JOZD5JT70_8_EGUHDKLE0nw0aidC42S6-9ag8bbtg9YgPGBUtpwUOUcSdQaCMEGadT6apavSd_znHItrObOhTwH194mVKE6C9OCqJYQT7hGaM_urkFYgwg/s1600/IMG_20160413_180935.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhntVfoQYf3ffP22_k2JOZD5JT70_8_EGUHDKLE0nw0aidC42S6-9ag8bbtg9YgPGBUtpwUOUcSdQaCMEGadT6apavSd_znHItrObOhTwH194mVKE6C9OCqJYQT7hGaM_urkFYgwg/s320/IMG_20160413_180935.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-yS4QQb7m8Jc/VxPd4DcpebI/AAAAAAAAF78/7zVOCgsQVhUhnxJLxCUXSTcPlMFYI63uQCKgB/s1600/IMG_20160413_180945.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://1.bp.blogspot.com/-yS4QQb7m8Jc/VxPd4DcpebI/AAAAAAAAF78/7zVOCgsQVhUhnxJLxCUXSTcPlMFYI63uQCKgB/s320/IMG_20160413_180945.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-nC2PmlRaaj0/VxPd5FNrn3I/AAAAAAAAF70/lmC1FLoBYAgekaPYucsM23BcIIV8eeF_QCKgB/s1600/IMG_20160413_180951.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://3.bp.blogspot.com/-nC2PmlRaaj0/VxPd5FNrn3I/AAAAAAAAF70/lmC1FLoBYAgekaPYucsM23BcIIV8eeF_QCKgB/s320/IMG_20160413_180951.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(cheap replacement LCD)</div>
<br />
<br />
<br />
Looking into the datasheet of the LCD provided by Pollin and the Yamaha DGX-620 service manual easily found online, it's clear that electrically the display is compatible.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-KL1aWKTgzro/VxPe0cXkzZI/AAAAAAAAF7s/tLxA35Qe9so4_ldltWDdI6-S7Iva2QSDwCKgB/s1600/service_manual.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="242" src="https://2.bp.blogspot.com/-KL1aWKTgzro/VxPe0cXkzZI/AAAAAAAAF7s/tLxA35Qe9so4_ldltWDdI6-S7Iva2QSDwCKgB/s320/service_manual.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(Yamaha)</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-gP9GVbg7rhc/VxPfAhvhbgI/AAAAAAAAF7s/Go1Qm9J0HwE8d1NXJ5szV8a7v_REQ7LqQCKgB/s1600/lcd.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-gP9GVbg7rhc/VxPfAhvhbgI/AAAAAAAAF7s/Go1Qm9J0HwE8d1NXJ5szV8a7v_REQ7LqQCKgB/s320/lcd.png" width="281" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(Pollin LCD Module)</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
FR (first row) is FLM (first line marker), LP (line pulse?) is CL1 (data latch), XCK (x? clock) is CL2 (shift clock). Everything else has identical designators. Sanding off the back of the replacement LCDs PCB a little to have good bonding to epoxy glue...</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyzO-BaEtWATuPWUnPgcdBHNx5_g2rrrfujg3N0vYHFTR9Edu1i_DohhtTqtBXI_xg2lQPS-cIt0rux5B0uEpIrrewd3LSecHhjCCLbP8uyhm8k_tICE86S9KHeTjuvNVRQqrstg/s1600/IMG_20160413_181943.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyzO-BaEtWATuPWUnPgcdBHNx5_g2rrrfujg3N0vYHFTR9Edu1i_DohhtTqtBXI_xg2lQPS-cIt0rux5B0uEpIrrewd3LSecHhjCCLbP8uyhm8k_tICE86S9KHeTjuvNVRQqrstg/s320/IMG_20160413_181943.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(replacement LCD, before gluing down flex cable)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
(sanding off the back of the PCB and the white flex-cable, so that the epoxy sticks better, you can see the residue from a first attempt: The blue plastic on the flex cable didn't stick)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE5pvVFeEO5L0abnpEj0q7J_HuI19cfnYgwS-Rlhp2KfYetwHiRiu-n24iZMFyJYSruQBGCzqRr-lasWOu9ngOk0afJLLw2f3nRRoovW3-j67YzEIMo8SXfbzLRlI4TyxVKdMjDg/s1600/IMG_20160414_191418.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE5pvVFeEO5L0abnpEj0q7J_HuI19cfnYgwS-Rlhp2KfYetwHiRiu-n24iZMFyJYSruQBGCzqRr-lasWOu9ngOk0afJLLw2f3nRRoovW3-j67YzEIMo8SXfbzLRlI4TyxVKdMjDg/s320/IMG_20160414_191418.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(jumper wires)</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Ugly patching of wires from the 14-in cable to the pads on the LCD according to pinouts shown above. After soldering the wires (which is hard on the flexfoil, as the plastic melts and the copper traces of the flexfoil will move around, creating shorts) and emitting a few prayers to the deity of choice, a picture appears! :-)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhymjD55VQClmehgGvwNem7pQx-AGKQMeMKUKUHxWxfS2dgQdDACFHhw44EuEbV1bAk7w-RQYswjl6TROthR3sjjfNKoo5UlLZE4RBV4eWp0MKV-5vxeVoaC0WPYoIXK96NRDiEbg/s1600/IMG_20160414_191259.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhymjD55VQClmehgGvwNem7pQx-AGKQMeMKUKUHxWxfS2dgQdDACFHhw44EuEbV1bAk7w-RQYswjl6TROthR3sjjfNKoo5UlLZE4RBV4eWp0MKV-5vxeVoaC0WPYoIXK96NRDiEbg/s320/IMG_20160414_191259.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(first signal on replacement LCD screen)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Then I added the display to the original plastic part from which I removed both the LCD logic and all the light spreading works. The complete LCD module almost fits in the cutout for the old glass, only a small plastic ridge had to be removed with a xacto-knive. I had to add a small slot for the flexcable, to feed through and added a hole for the big blob of goo by which I glued down the cables so that they don't become loose.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-fOuNQu8loX0/VxPeIet1q4I/AAAAAAAAF8E/sVRTdBKwZeEnc-sKSTPdaY3bFrwGs_4hwCKgB/s1600/IMG_20160417_171506.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://2.bp.blogspot.com/-fOuNQu8loX0/VxPeIet1q4I/AAAAAAAAF8E/sVRTdBKwZeEnc-sKSTPdaY3bFrwGs_4hwCKgB/s320/IMG_20160417_171506.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(cutout for big lump of wires and goo)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The end result: A replaced LCD screen for €4. But I had to invest a few hours of work, which in this case I didn't mind.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXcrfvNF-qgWZg2Bhs4koGPcEJ6h-KrIvHk6F_82hs7Bie427qpGobS00dc0rYKTs8yukPuu9eNEGlgjR-bN6nY3f446TFQ06ZqAOLKfKUwxlVIK03FtvDK5HWzWy7vsNuuTpvaA/s1600/IMG_20160417_171826.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXcrfvNF-qgWZg2Bhs4koGPcEJ6h-KrIvHk6F_82hs7Bie427qpGobS00dc0rYKTs8yukPuu9eNEGlgjR-bN6nY3f446TFQ06ZqAOLKfKUwxlVIK03FtvDK5HWzWy7vsNuuTpvaA/s320/IMG_20160417_171826.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
(replaced screen on the Yamaha keyboard)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<b>Update:</b> As Ulrich pointed out, one can directly solder the cables for the LCD backlight to the cables going to the two-bin connector on the power supply on more recent models of the keyboard. Some onlder ones have high-voltage for an electroluminiscent foil, though, so beware.</div>
<br />
Here are Ulrich's Photos:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHttKwfaKQxLmc9ZXsjiPHcaEcaeXoqOoChKA0t9gT1U1Q0v4OT7ugvoPZ1nTAhaRokPRu44GZtdydp2zSMO1dyHxvJ4HqiKkqKBgWzIjMtJ5zeRtp4TxIhRGeNeuLnavmuHzVcQ/s1600/IMG_1041.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHttKwfaKQxLmc9ZXsjiPHcaEcaeXoqOoChKA0t9gT1U1Q0v4OT7ugvoPZ1nTAhaRokPRu44GZtdydp2zSMO1dyHxvJ4HqiKkqKBgWzIjMtJ5zeRtp4TxIhRGeNeuLnavmuHzVcQ/s320/IMG_1041.JPG" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-czu64RgYu4s/V6Rnohn8EdI/AAAAAAAAGFE/E0-gAdhMIHk6g5RhZrMdPXcsacZFvDr7wCLcB/s1600/IMG_1042.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://3.bp.blogspot.com/-czu64RgYu4s/V6Rnohn8EdI/AAAAAAAAGFE/E0-gAdhMIHk6g5RhZrMdPXcsacZFvDr7wCLcB/s320/IMG_1042.JPG" width="240" /></a></div>
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com9tag:blogger.com,1999:blog-7098474.post-74411672823747132392016-04-02T13:00:00.002+00:002016-04-02T14:52:48.770+00:00Superlux HMC660 Headset and PS 418-S Phantom Power AdapterThe <a href="http://www.thomann.de/gb/superlux_hmc_660_x.htm">HMC660 Headset</a> made by Superlux is dirt-cheap, and not that bad, for the price. Certainly beats some other headphones sold for €39. But even though it has a XLR connector, it doesn't really work that well with phantom powered microphone inputs. That's because its Electret Capsule is directly connected to the XLR pins, which sometimes works, but generally doesn't.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/IvZIsjioodK2lFFm_OaEiNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="118" src="https://lh3.googleusercontent.com/-IgqAUTcTea0/Vv_DlNMIOjI/AAAAAAAAF3U/S-XE_gfMOJI6jlojU46VW37K2mwYStTRgCCo/s144-Ic42/superlux-hmc660-schematics.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
The microphone part is glued, but after heating it gently to about ~40..50 °C with a hair-dryer or a heating gun used for heat-shrink-tubing, it can just be pulled apart by hand.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/xw9xpDI7-B7m9ueAZH3BA9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh3.googleusercontent.com/-y_Rt6QPeTyI/Vv-_O5ryWqI/AAAAAAAAF28/SNH9jRfJpbUs15qvLkpKWIEjlUGYeH2eQCCo/s144-Ic42/hmc660_electret_capsule.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
The proper way to adress the connection issue is to use a proper phantom-power adapter for electret microphones, luckily this taiwanese producer of cheap (and a little crappy) audio electronics also has something in store. The <a href="http://www.thomann.de/de/superlux_ps_418_s.htm">Superlux PS 418-S</a> adapter!<br />
<br />
Inside, this little marvel looks like this: Mostly through hole, one-sided PCB, waves-soldered.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/kTcGZi0KlPAfnq2acChjrNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="61" src="https://lh3.googleusercontent.com/-WFto_BCTu7Q/Vv-_TRGl53I/AAAAAAAAF28/ZevTwtTilDwloVANZRd3-DL9n-QwtlbRQCCo/s144-Ic42/img_20160331_194728_labeled.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
The schematics mostly adheres to the often copied "Schoeps" design, here's my attempt at the schematics.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/eFbp27WvXMo9tgCF8b-fk9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="112" src="https://lh3.googleusercontent.com/-NmuYvCL0Tko/Vv-_Voyw_QI/AAAAAAAAF3E/o-5-2teqwTw2tS06VOxBh1yStmQECU3TwCCo/s144-Ic42/superlux-ps418s-schematics.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<em>I think I got the type of Q1 wrong. It's probably wired as an emitter follower (the voltage gain of the drawn common emitter amp of 22x would be unreasonably high) with Q1 being a <a href="https://www.fairchildsemi.com/products/discretes/bipolar-transistors/small-signal-bjts/KSA1015.html">KSA1015 PNP Epitaxial Silicon Transistor</a>. Q2 and Q3 are likely <a href="http://www.imrad.kiev.ua/pdf/bipolyarnyy_tranzistor/KTA1267_kec.pdf">KTA1268<br />
EPITAXIAL PLANAR PNP TRANSISTOR</a>.</em><br />
<br />
The PCB is small enough to fit it inside one of the earcups of the HMC660. Just cut open the direct connection that go from the 6-conductor XLR & TRS cable (braided copper, yellow, green) to the 3 wires that make their way into the gooseneck (white, black, red).<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/ajPWWMPBO1GGPyOcIKJmLNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOUkhL9QdC6BcA4uxsEOWhlOxihjSB_emZNU0_HqwZg-JyhinpJMcbemGw9zybCoHZKDquz_trh2Qe6A2OYBEWrGZAuuv3vm0RQ4midSDCNOiHpRpAII57I-4Wj7gVsgA61StXbg/s144-Ic42/phantom_adapter_output_side_img_4330.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/imsVUqPIRpUjxl59mgdlhdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYE-7j9leJTi8qfPcNtgb4Ie3xRv3WXxejd9TWuFuNb_OVrPXWvGT7MQosDMiaA8-SA718_F7yxgCk26i-YAdh2FsQzo2uGewYwU9usvyP8PVTqXSXOr26ERgU7AWo18Pzk2Jj7w/s144-Ic42/phantom_adapter_input_side_img_4331.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
Here's the PCB inside a piece of heat-shrink tubing, but in the end, I opted to just hot-glue the bare PCB into the cup. Also some foam (from inside the PS-418's small shipping box) was added to prevent the whole thing from rattling around.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/9Br1srPViDjK70lF1cqn-9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitqY-NP-xuMhS_X7V8osjXs9Ie935aD5JHmkB7fgC4JvDunnMrvsy-0_WvWC1xbcKuxRBIw3ujnZhHxOQIXkv39aJ5-BXP8bNkUqa8hKq0KEuFa3YLEtD5_8eKywRlz5zWxUk0vw/s144-Ic42/headphone_earcup_with_phantom_adapter_img_4332.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<br />
Here you go. 39€ + 19,90€ for a only halfway crappy headset ;-).Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-81929061105156123482016-03-23T17:07:00.001+00:002016-03-23T17:08:55.483+00:00W&T 36201 Isolated USB to RS485 Interface: Fix "automatic" RS485 Transmit modeSome time ago, I bought three used <a href="https://www.google.de/search?q=W%26T+36201+USB+RS485">W&T 36201</a> isolated USB to <a href="https://en.wikipedia.org/wiki/RS-485">RS485</a> interfaces. They have pretty good build quality and are intended to be mounted in control cabinets (on “<a href="https://en.wikipedia.org/wiki/DIN_rail">DIN Rails</a>”). You can see them in this photograph, it's the blue thing.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/GUNs_4c5XBgBdhlp4Uam2NMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh3.googleusercontent.com/-FAgkU4C4l-8/VRgr9cpLwiI/AAAAAAAAE1A/DTzdn8xwh-4ifGqo77lWaxwSPYWoxBnbQCCo/s144-Ic42/eastron_sdm220_connected.jpg" width="108" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
And while I'm pretty impressed by their build quality, I found out that even for (normally pretty expensive) industrial kit, they get the control of RS485 transmission wrong.<br />
<br />
<a href="https://en.wikipedia.org/wiki/RS-485">RS485</a>, in short, is a pair of cables named A and B which carry a differential signal. This means that the signal in one wire should always be the inverse of the signal in the other wire: If voltage on A increases, the voltage on B should decrease. The state of the bus is “1” when the voltage on B is higher than the voltage on A, and the state of the bus is “0” when the voltage on B is lower than the voltage on A. A RS485 bus, when idle, is kept at the level corresponding to a “1” bit by the termination voltage, which pull B to a higher voltage than A, keeping an impedance of 100 Ohms on the differential pair A and B.<br />
<br />
When data is exchanged over the bus, the first thing being transmitted is the stop bit, at “0” level, then the first byte, ... until transmission is completed. Naively, one would think that a driver only has to supply the “0” level and let go of the wires, making the termination resistors pull them to “1” again.<br />
<br />
Unfortunately, these resistors aren't typically able to do this fast enough, especially for higher baud rates, and active drive of the bus therefore must be maintained throughout the complete transmission.<br />
<br />
Thus, we need some control signal that tells the driver IC when to turn on its output drivers, and there are several methods for this.<br />
<br />
<ol>
<li>some RS485 adapters cheat by only transmitting the “0” in full, and only output a very short “1” runt pulse to charge up the bus, leaving maintaining the idle voltage to the termination resistors,</li>
<li>some RS485 adapters use a serial control line (RTS, DTR) as a control signal and</li>
<li>many USB to RS485 adapters use a signal provided by the USB-UART for exactly this purpose.</li>
</ol>
2 has the downside that one typically has problems being fast enough in switching the control lines over USB, and 3 is obviously the preferred version.<br />
<br />
<div>
Unfortunately the W&T 36201 interfaces only do 1 and 2, so I tried to modify them to provide for 3.</div>
<br />
Here's a (very slow) 9600 baud transmission via the unmodified interface in "automatic" mode. The driver is only activated (blue) during 0-bits.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/8kRn68PvcyykmSdNqeEXw9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="86" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibBV38YixqybJvNuzP4sTIRpn0KV8ukDCNWTMgi4mhmAV-PRSlIo8EMghsV2a9QKTZE2QG5BdFhgK_grHhZ4XQrEh3oObKZbewLSxV_EFMeGJ42UV0mvXFdJpyxUi2eliWKuhOLg/s144-Ic42/DS1104Z_DS1ZA171206620_2016-03-23_17.03.26.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
The used USB to UART bridge fortunately has a TXEN pin (#16), which we jumper over to the line normally carrying the #DTR (inverted) signal that can be used to implement method (2). The chip is mounted on a separate small PCB which makes working on it pretty easy:<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/csJ7g2tzr0UoddHB8fnqktMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHIDyrwKPyk5KSvVa15zeWKJCIh1Zv0QzvJEUSwSnbXzPD0KW7pasIAUXgS2UchXIEaxnTKXJkV1yVvsALznLUW7NRFoQ9t_NZXMMmPWy8Vr64ia7CZaGK3XjIkrmr2ezp2NDRDQ/s144-Ic42/IMG_4284.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/hbT8Uz_3ypsmnfLua3D0DNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-BwhbtjIrmQw/VvLF8ke7CmI/AAAAAAAAFyU/45an5mfgo3w_Z_6ZoEDqrASWMtBa0ctVwCCo/s144-Ic42/IMG_4283.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
Unfortunately the polarity of TXEN is high-active, but as built the converter needs #DTR to go LOW to transmit. So we use a spare gate of the HC04 hex inverter conveniently located on the baseboard. One has to scratch open the very short trace between the pullup for the optocoupler and the via left to it.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/Yoc0d-BYux9Sr6O4V-fCqtMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-yO3HhB-N8KA/VvLF8nYAvVI/AAAAAAAAFyU/KjcXXu-kuXU7vlVqeZ70fIvCxKEifQ1cACCo/s144-Ic42/IMG_4289.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
After this modification, set the device to computer-controlled transmit control (normally DTR, now TXEN). As can be seen on the scope, now the transmitter IC drives the bus for the whole duration of a character.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/BoMJRftF9t-jvqF3dGX6Y9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="86" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLA8uMDSGHSYD9GhaXloXv7S9PXZjVhsLN4HHO4ZJsWI57W07juDrJf7P8UOuhzvgNe6V-7Eh2QgPQ6zUmmdm83HioKGsZ98yJ0cDk9sUPHmxx_TEckWaUlQGrlgDArFDAA5CKRQ/s144-Ic42/DS1104Z_DS1ZA171206620_2016-03-23_17.03.51.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-59001614879132175062016-02-28T10:44:00.000+00:002016-02-28T10:44:08.986+00:00ASUS RT N12E BootupDebugging a problem with a ASUS RT-N12E 300Mbps Wireless N Router, I soldered a pin header to J15 (next to the ethernet magnetics handling the yellow "LAN" ports).<br />
<br />
Pinout is Vcc, GND, Tx, Rx. Vcc is the square pad, Rx and Tx as seen from the N12E soc. Port runs at 38400 bps.<br />
<br />
Here's the bootup messages, just in case anyone is interested.<br />
<br />
$ cu -l ttyUSB0 -s 38400<br />
Connected.<br />
<br />
========== SPI =============<br />
SDRAM CLOCK:156MHZ<br />
------------------------- Force into Single IO Mode ------------------------<br />
|No chipID Sft chipSize blkSize secSize pageSize sdCk opCk chipName |<br />
| 0 c22016h 0h 400000h 10000h 1000h 100h 86 39 MX25L3205D/E|<br />
----------------------------------------------------------------------------<br />
Set 8196C PHY Patch OK<br />
<br />
---RealTek(RTL8196C)at 2013.12.09-17:34+0800 version v1.1f [16bit](390MHz)<br />
<br />
####return_addr: 0x05010000, root_bin_offset: 0x050dd012<br />
Jump to image start=0x80500000...<br />
decompressing kernel:<br />
Uncompressing Linux... done, booting the kernel.<br />
done decompressing kernel.<br />
start address: 0x80003600<br />
RTL8192C/RTL8188C driver version 1.6 (2011-07-18)<br />
<br />
<br />
<br />
Probing RTL8186 10/100 NIC-kenel stack size order[2]...<br />
chip name: 8196C, chip revid: 4<br />
NOT YET<br />
eth0 added. vid=9 Member port 0x10...<br />
eth1 added. vid=8 Member port 0x1...<br />
eth2 added. vid=9 Member port 0x2...<br />
eth3 added. vid=9 Member port 0x4...<br />
eth4 added. vid=9 Member port 0x8...<br />
[peth0] added, mapping to [eth1]...<br />
init started: BusyBox v1.13.4 (2014-09-18 18:08:32 CST)<br />
<br />
##flash.c free apmib ##<br />
Init Start...<br />
wan_disconnect: option all<br />
<br />
##system/sysconf.c free apmib ##<br />
<br />
##flash.c free apmib ##<br />
===== Set parameter for BSMI test=====<br />
Init bridge interface...<br />
wait for bridge initialization...<br />
syslog will use 64KB for log(7 rotate, 1 original, 8KB for each)<br />
route: SIOCDELRT: No such process<br />
route: SIOCADDRT: Invalid argument<br />
Init Start...<br />
Init Wlan application...<br />
<br />
##flash.c free apmib ##<br />
<br />
##flash.c free apmib ##<br />
update wps state to -1<br />
<br />
WiFi Simple Config v2.9-wps2.0 (2014.09.18-10:09+0000).<br />
<br />
Init Wlan application...<br />
<br />
##flash.c free apmib ##<br />
<br />
##flash.c free apmib ##<br />
update wps state to -1<br />
<br />
WiFi Simple Config v2.9-wps2.0 (2014.09.18-10:09+0000).<br />
<br />
Register to wlan0<br />
iwcontrol RegisterPID to (wlan0)<br />
Register to wlan0<br />
<br />
##system/sysconf.c free apmib ##<br />
iwcontrol RegisterPID to (wlan0)<br />
Init Firewall Rules....<br />
firewall clean prerouting<br />
firewall add iptables rule<br />
No wan ip currently!<br />
System TZ ENV = GMT-8<br />
<br />
##system/sysconf.c free apmib ##<br />
start infosvr<br />
WLAN0_WLAN_DISABLED=0 ##flash.c free apmib ##<br />
sh: ##flash.c: unknown operand<br />
# Start httpd!<br />
Start wanduck!<br />
<br />
<b># <-- :-="" a="" b="" here="" rootshell="" s=""></--></b><br />
<br />
MemTotal: 11144 kB<br />
MemFree: 5164 kB<br />
Buffers: 224 kB<br />
Cached: 1128 kB<br />
SwapCached: 0 kB<br />
Active: 1672 kB<br />
Inactive: 716 kB<br />
Active(anon): 1036 kB<br />
Inactive(anon): 0 kB<br />
Active(file): 636 kB<br />
Inactive(file): 716 kB<br />
SwapTotal: 0 kB<br />
SwapFree: 0 kB<br />
Dirty: 0 kB<br />
Writeback: 0 kB<br />
AnonPages: 1044 kB<br />
Mapped: 716 kB<br />
Slab: 3064 kB<br />
SReclaimable: 176 kB<br />
SUnreclaim: 2888 kB<br />
PageTables: 164 kB<br />
NFS_Unstable: 0 kB<br />
Bounce: 0 kB<br />
WritebackTmp: 0 kB<br />
CommitLimit: 5572 kB<br />
Committed_AS: 2220 kB<br />
VmallocTotal: 1048404 kB<br />
VmallocUsed: 264 kB<br />
VmallocChunk: 1048136 kB<br />
<br />
# cat /proc/cpuinfo<br />
system type<span class="Apple-tab-span" style="white-space: pre;"> </span>: RTL8196C<br />
processor<span class="Apple-tab-span" style="white-space: pre;"> </span>: 0<br />
cpu model<span class="Apple-tab-span" style="white-space: pre;"> </span>: 52481<br />
BogoMIPS<span class="Apple-tab-span" style="white-space: pre;"> </span>: 389.12<br />
tlb_entries<span class="Apple-tab-span" style="white-space: pre;"> </span>: 32<br />
mips16 implemented<span class="Apple-tab-span" style="white-space: pre;"> </span>: yes<br />
<div>
<br /></div>
<div>
<div>
# busybox</div>
<div>
BusyBox v1.13.4 (2014-09-18 18:08:32 CST) multi-call binary</div>
<div>
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko</div>
<div>
and others. Licensed under GPLv2.</div>
<div>
See source distribution for full notice.</div>
<div>
<br /></div>
<div>
Usage: busybox [function] [arguments]...</div>
<div>
or: function [arguments]...</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>BusyBox is a multi-call binary that combines many common Unix</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>utilities into a single executable. Most people will create a</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>link to busybox for each function they wish to use and BusyBox</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>will act like whatever it was invoked as!</div>
<div>
<br /></div>
<div>
Currently defined functions:</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>arp, ash, bunzip2, bzcat, cat, cp, cut, date, echo, expr, false,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>free, grep, gzip, halt, head, hostname, ifconfig, init, ip, kill,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>killall, klogd, ln, ls, mkdir, mount, ping, poweroff, ps, reboot,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>renice, rm, route, sh, sleep, sync, syslogd, tail, telnetd, top,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>true, umount, vconfig, wc, zcip</div>
<div>
<br /></div>
</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-20955797646823785522016-02-21T18:53:00.000+00:002016-02-21T18:53:01.851+00:00Linux/udev: Unbinding from one kernel driver, and rebinding to a different one. Automatically, using udev.Quite a lot of USB devices claim to be a <a href="https://en.wikipedia.org/wiki/Human_interface_device">human interface device</a>, the rationale being that you can access them on Windows without the need to supply your own "proper" driver.<br />
<br />
Under Linux, one can easily unbind the usbhid driver from a particular usb device, but this gets tedious after a few dozen times. But there's a workaround using udev and a short script to rebind to a different kernel module.<br />
<br />
First, create a <a href="http://www.reactivated.net/writing_udev_rules.html">udev rule</a>, e.g. in <span style="font-family: "courier new" , "courier" , monospace;">/etc/udev/rules.d/99-rebind-driver.sh</span>:<br />
<br />
<hr />
<code>ACTION=="add", DRIVER=="usbhid", SUBSYSTEMS=="usb",<br />
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00de",<br />
RUN+="/usr/local/sbin/rebind_sysfs_driver.sh %p %k /bus/usb/drivers/mcp2210"</code><br />
<hr />
<br />
(all in one line)<br />
<br />
Then use the following small script, stored as /usr/local/sbin/rebind_sysfs_driver.sh to do the actual work:<br />
<br />
<hr />
<span style="font-family: monospace;">#!/bin/sh</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">if [ "$#" != 3 ] ; then</span><br />
<span style="font-family: monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo "Usage: $0 sysfs_path kernel_name new_driver_path" >&2</span><br />
<span style="font-family: monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo "" >&2</span><br />
<span style="font-family: monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo "To be used in udev rules:" >&2</span><br />
<span style="font-family: monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo " RUN+=\"$0 %p %k /bus/usb/drivers/mcp2210\"" >&2</span><br />
<span style="font-family: monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo "which rebinds a particular device to a new driver." >&2</span><br />
<span style="font-family: monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>exit 1</span><br />
<span style="font-family: monospace;">fi</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">set -e</span><br />
<span style="font-family: monospace;">logger -t "$0" "Rebind device $1($2) to driver $3."</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">cd "/sys$1"</span><br />
<span style="font-family: monospace;">echo "$2" >driver/unbind</span><br />
<span style="font-family: monospace;">sleep 1</span><br />
<code>
</code>
<span style="font-family: monospace;">echo "$2" >"/sys$3/bind"</span><br />
<hr />
<br />
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-53181476352319174812015-11-29T11:24:00.000+00:002015-11-29T11:29:45.986+00:00Focusrite Scarlett 6i6 and PulseaudioOh, <a href="http://www.freedesktop.org/wiki/Software/PulseAudio/">pulseaudio</a>, how do I love thee...<br />
<br />
The <a href="http://us.focusrite.com/usb-audio-interfaces/scarlett-6i6">Focusrite Scarlett 6i6</a> is a 2 Mic, 2 Line, 2 Digital input, 4 Line, 2 Digital output audio interface and is presented to the Linux machine as a 12 output, 6 input USB2.0 class compliant soundcard. Strange, but that's what it is. Now, pulseaudio, not very smart in the first place, gets confused and only ever wants to use this card as a "multichannel" output, with outputs 1/2 deprived of bass, and output 6 (typically mapped to the s/pdif output) being a subwoofer. Not useful when listening over headphones.<br />
<br />
After looking through the non-existing pulseaudio-documentation regarding udev, and searching on the web, I've came up with a workaround. This is at least useful to use the card as a normal stereo output.<br />
<br />
To get output on the 2nd headphone output, use <i>alsamixer</i> to map <span style="font-family: Courier New, Courier, monospace;">Master 2L</span> and <span style="font-family: Courier New, Courier, monospace;">Master 2R</span> source to <span style="font-family: Courier New, Courier, monospace;">PCM1</span> and <span style="font-family: Courier New, Courier, monospace;">PCM2</span>. The same applies to the S/PDIF output (<span style="font-family: Courier New, Courier, monospace;">Master 3L/R</span>).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Wy8Mvz7Jwt8/VlrhTxbJRbI/AAAAAAAAFl4/-n4GwOy7GWI/s1600/Screenshot_2015-11-29_12-27-14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="178" src="http://4.bp.blogspot.com/-Wy8Mvz7Jwt8/VlrhTxbJRbI/AAAAAAAAFl4/-n4GwOy7GWI/s320/Screenshot_2015-11-29_12-27-14.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsg4t07lMbFvaKKKlY-boRQFlEn6qqkIJw7ssO7U0BO4gSF2vEjnvxRyPhWgxDotp5DbwXS22MSwYBU7XlHOv9nZzvSrkb_njlZDyX0uQmZQ_DWqobFRdd9RGLh841dZWchueYvw/s1600/alsamixer-focusrite-scarlett-unreadable.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="69" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsg4t07lMbFvaKKKlY-boRQFlEn6qqkIJw7ssO7U0BO4gSF2vEjnvxRyPhWgxDotp5DbwXS22MSwYBU7XlHOv9nZzvSrkb_njlZDyX0uQmZQ_DWqobFRdd9RGLh841dZWchueYvw/s320/alsamixer-focusrite-scarlett-unreadable.png" width="320" /></a></div>
<br />
<br />
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=93163">Bug filed.</a><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>➜ ~ cat /usr/share/pulseaudio/alsa-mixer/profile-sets/focusrite-scarlett-6i6.conf </b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; Based on native-instruments-traktor-audio10.conf</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; Focusrite Scarlett 6i6 has 6 physical inputs/outputs</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; Inputs</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; 2x Microphone/Line on front</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; 2x Line on back</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; 2x S/PDIF coaxial on back</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; Outputs</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; 2x Headphone (Out1/2, Out 3/4) on front</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; 2x Line on back (Out 1..4)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; 2x S/PDIF coaxial on back</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; It's presented as a 6 input, 12 output interface to the PC, so</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; we have to create some mappings. Actual routing is configurable</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">; in ALSA mixer. I prefer a 1:1 mapping to physical outputs.</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">[General]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">auto-profiles = no</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">[Mapping analog-out]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">description = Analog Outputs</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">device-strings = hw:%f</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">channel-map = left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">[Mapping analog-in]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">description = Analog Inputs</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">device-strings = hw:%f</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">channel-map = left,right,aux0,aux1,aux2,aux3</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">direction = input</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">[Profile output:analog-out+input:analog-in]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">description = Analog Duplex</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">output-mappings = analog-out</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">input-mappings = analog-in</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">priority = 100</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">skip-probe = yes</span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><b>➜ ~ cat /etc/udev/rules.d/99-pulseaudio-local.rules </b></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">SUBSYSTEM!="sound", GOTO="pulseaudio_local_end"</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">ACTION!="change", GOTO="pulseaudio_local_end"</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">KERNEL!="card*", GOTO="pulseaudio_local_end"</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">SUBSYSTEMS=="usb", GOTO="pulseaudio_local_check_usb"</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">LABEL="pulseaudio_local_check_usb"</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">##</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># The Focusrite Scarlett 6i6 only runs as 12 playback and 6 capture channels!</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># (mappable using the internal mixer)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># Bus 002 Device 004: ID 1235:8012 Focusrite-Novation Scarlett 6i6</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">##</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">ATTRS{idVendor}=="1235", ATTRS{idProduct}=="8012", ENV{PULSE_PROFILE_SET}="focusrite-scarlett-6i6.conf"</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">LABEL="pulseaudio_local_end"</span></div>
</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com5tag:blogger.com,1999:blog-7098474.post-19488468400245113402015-11-02T23:04:00.004+00:002015-11-02T23:44:05.262+00:00Behringer "X-Air" XR18 Teardown<div>
Here's a teardown of a <a href="http://www.music-group.com/Categories/Behringer/Mixers/Digital-Mixers/XR18/p/P0BI8">Behringer XR18 (sometimes spelled X18R) Compact Digital Mixer</a>. There's a <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=directlink">full album</a> with all pictures I took.</div>
<br />
<div>
To open the device, you have to remove the rubber bumpers on the sides (which can be replaced with rack-ears). Two of the tiny screws on each side don't have to be removed, this lets the bottom shell of the case keep more mechanical strength. Then two halves slide open, an L-shaped top-plus-front-side part, and the rest enclosing sides, bottom and back side.</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/6L8fzidh7iCmJ1qz2UyVfNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-Jv4qY917LK4/VjfVREqwfeI/AAAAAAAAFaI/vf3EyO8Kk9M/s144-Ic42/IMG_4153.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
In the inside, you can find the <u>power supply</u>, a <u>digital board</u> (+ analog outputs) and a stack of <u>three boards</u> mainly responsible for the analog mic/line inputs. The topmost board (which I didn't remove because it's attached to the case by all the XLR connectors) mainly has connectors and the headphone amp. The middle board carries circuitry for the actual mic preamp. The bottom board has a few opamps and the ADCs for the analog inputs.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/BiyS9jLZ0mjpReHfuUMfX9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd7O6y4__uDWPCQqciiPvc_ro936-LwKel3UG9RnLcj0q_E-E1wvMuV4ri1q2KLPjDuzZqAuM9hV1Q4-12e0QsuwWzPNR6aXCTL9QEA2lyRT7-aZX6ESEiI9aGpDZ63szAG89Vpg/s144-Ic42/IMG_4170.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<h2>
Power Supply</h2>
<br />
<div>
Generally the manufacturing is pretty nice and everything looks produced to tight tolerances. I could see no gaps, nothing loose. The only downside I see is the powersupply and the mains connector: The supply gets very hot during normal operation (and no devices running on phantom power were connected during the few hours it was in operation before opening the case). The mains connector is isolated with an additional layer of sticky tape, and fastened with hot glue. This looks rather sloppy.</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/Fzxj_rqDbdrFBQEo3iRk5dMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh3.googleusercontent.com/-I9Rj5AOy-A0/VjfVfAA9ezI/AAAAAAAAFao/ZW1H0E_rJN4/s144-Ic42/IMG_4160.JPG" width="108" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<div>
Interestingly Behringer (the Music Group) designed their own supply!</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/MbQl3R3hAgwHlC4SQcxDHdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-8el4kIDM04Y/VjfVeC5jYmI/AAAAAAAAFag/HBRYNBPVvWU/s144-Ic42/IMG_4161.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<h2>
Digital/DSP (+analog output) PCB</h2>
People are generally annoyed by the lack of support for WPA/WPA2 with the builtin WiFi access point. It's essentially a <a href="http://www.microchip.com/wwwproducts/Devices.aspx?product=MRF24WG0MB">Microchip MRF24WG0MB</a> Module<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/febPMct4hL3nCpew3YE6VdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpKg5RbgwH_7FxhytyhhgJ9dQUqu27RiXwoz6jrE4HvZ3m1HkpQiZNBy9CvXkYfIRJsM0xijBSzAvlJr56fKeD2FEbQGofgHqBJr9QLDvltElbCFpKNVwMS3OBjrMFxlta-3sgBg/s144-Ic42/IMG_4162.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<div>
The USB audio interface seems to be powered by a <a href="http://www.xmos.com/products/silicon">XMOS 16L7C10</a> 1000 MIPS, 128 kB SRAM, 32-bit multicore microcontroller and its associated <a href="http://www.microchip.com/wwwproducts/Devices.aspx?product=USB3340">Microchip USB3340</a> Enhanced Single Supply Hi-Speed USB ULPI Transceiver.</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/hVLa0BSR7h9r0XyMG3_FsNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3kltZqbQzssi9xB-Cn2ZfSJKUcMdEJV4y5UQkqaEhTEdBEluQNOdfJOR06Dsu5ika4nuA7qLNmTgVc3eUffGe9nrpy1P0kLMstIRHPhJHYuFV1XeGGDCof_PMl49IiImNr9Uscw/s144-Ic42/IMG_4187.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<br />
<div>
The actual user-facing functionality obviously is orchestrated by a <a href="http://www.freescale.com/products/arm-processors/i.mx-applications-processors-based-on-arm-cores/i.mx25-processors:IMX25_FAMILY?cof=0&am=0">Freescale MCIMX253DJM4A i.MX25</a> 400 MHz, single core, ARM 926EJ-S, the network is connected with a standard <a href="http://www.microchip.com/wwwproducts/Devices.aspx?product=LAN8720A">Microchip LAN8720A</a> Small Footprint RMII 10/100 Ethernet Transceiver.</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/9wuxv_FlSUkVeexljsJ68NMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-thtMRcMZhPM/VjfV7LnGkEI/AAAAAAAAFbY/bZhXShiVdyU/s144-Ic42/IMG_4169.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/v3zIgHDkR4vN0CgE9kdXp9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-YyBE-mcrcCE/VjfX0hqIjmI/AAAAAAAAFdg/4PHiWQ8TuV8/s144-Ic42/IMG_4190.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
The eight XLR analog outputs are fed by a <a href="https://www.cirrus.com/en/products/cs4365-85-85a.html">CS4385</a> Cirrus Logic octal 24 bit DAC, the<a href="https://www.cirrus.com/en/products/cs4272.html"> CS4272</a> Cirrus Logic 24 bit stereo audio codec feeds the headphone output and digitizes the line input (ch 17/18). [it's the only ADC/DAC left after accounting for the 8 analog outputs and 16 analog inputs and corresponding octal converters].<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/i00_zFq4mk6VLMZxGM2QfNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcASSRREX0fsUqqpBqTD6haRxNWK5nCJr2vkXzl4pTmrjWb1yM6dCXU4q3-DWIoAvTty4AZAi5v4-ahk7uGy5P37sq5aBvkqJcjEiPck7Jp760tzPTgIB8K1WR4q7Xj172EHgdNw/s144-Ic42/IMG_4166.JPG" width="108" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<div>
Routing of signals probably is taken care of by the logic inside this <a href="http://www.xilinx.com/products/silicon-devices/fpga/spartan-6.html">Xilinx XC6SLX4 (Spartan 6)</a> FPGA. It's the smallest of the Spartan 6 family -- and while it has 216 kBit of blockram and 8 "DSP Slices" which feature multipliers, adders and accumulators, I doubt that it does any computational work. Maybe it scales the output level or so, though...</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/fJZKC9f6uc4fSuFW5rZD39MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpF0ji7VtLcqWClC_h1iF-pa_fa-XmDJ85zBIQfR8ohQCO3QdEG6QPdhhNcq-lYF3sOvWkYP4uMwLuweijB_YeSasOot673Siqb3zcjFc7qVvFd483s_SzN3206-nyiAtJrLAqBQ/s144-Ic42/IMG_4167.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<div>
There's a truckload of<a href="http://www.njr.com/semicon/PDF/NJM4580_E.pdf"> New Japan Radio Corporation NJM4580 Dual Opamps</a> used inside the XR18, and<br />
a bunch of them seem to take care of driving the differential XLR analog outputs.</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/tEkCuXLLLWKSqUhr8ZWCsNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-D_fGoycnM3U/VjfYPY4K5cI/AAAAAAAAFeA/ZRZvFkfP9PY/s144-Ic42/IMG_4194.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<h2>
Mic/Line ADC</h2>
<br />
The most interesting chip on the ADC board (bottom-most in the three-board stack) is the Cirrus Logic <a href="https://www.cirrus.com/en/products/cs5364-66-68.html">CS5368 </a>octal 24bit ADC. There are two of them, for 16 inputs in total. There are also a bunch of NJM4580 (1+1/2 for each channel), likely for a final level adjust and to drive the differential inputs of the ADCs. <br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/sabmwi_pj4nY9Ci1Dl1RU9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-zkWZGkr7YJM/VjfWC-XLXQI/AAAAAAAAFbg/X36zPPMIvVc/s144-Ic42/IMG_4171.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<h2>
Mic Preamp</h2>
<br />
The board with the mic preamps is rather interesting. The layout seems to be a conventional frontend using discrete transistors as first stage amplification and a NJM4580 as a differential amplifier. There are two <a href="http://www.coolaudio.com/">Coolaudio V411</a> analog switches per channel to adjust the gain, and quite a few shift registers to provide the control inputs to the analog switches.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/e6dILdMHccQMS1MApFamsdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-Rcj2ODjmo98/VjfWztrNbII/AAAAAAAAFcI/4kOPZDghLKk/s144-Ic42/IMG_4176.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/hsHTBlYBoA0ayirvNmNAntMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-yjrNiiMK988/VjfW-2oiyZI/AAAAAAAAFcQ/3vVWsb8I_50/s144-Ic42/IMG_4178.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/drQq9Mq15tJtl_q6FIqxUNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh3.googleusercontent.com/-tw-ONQ1HbHQ/VjfXEOPdHqI/AAAAAAAAFcc/zjSbbwRWsGQ/s144-Ic42/IMG_4180.JPG" width="108" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/_fu4Fnv80ZGNAyxvNZ6hLNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://lh3.googleusercontent.com/-ebAJ7_m3r6U/VjfXEXMCqPI/AAAAAAAAFcg/rpCIxtmm-o0/s144-Ic42/IMG_4181.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<h2>
Connector PCB</h2>
The connector PCB is very uninteresting. One very thoughtful detail, though, is that they drilled holes beneath the XLR/TRS combo jacks. If you ever had to desolder one of those because the TIP of a TRS connector broke off you appreciate this. I did not remove this board, because it's held in place by dozens of screws on the XLR jacks.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/Osz4GueVFR6g0ceMn6kHGdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIllcXzXzaMJvcTM12dL_4pdGE5TXi7xMgQJ_ZU4q6_C0kigkJ-WoYfERoaIPNdMnAYXhBbsGneE7ZzCbwKD1DUPZuGxTaa_pjgIVPU0vN7WwVMwqLUgmTT6IkyD4YqPNOrb4Grw/s144-Ic42/IMG_4191.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
A OPAMP labeled JRC8074A seems to be the headphone amplifier.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/SWFiYDHW5P92AF4EnbJLz9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSXQs_UveT4ePScMeCrDU1zD9G1J85XBK1z63tzhc1S31b81_zVUSJa2zlRwBSusc6cyVHVNfEWpBMfVKyAplqDiWXuBGl5-WqnkWYVwWkvHChQrsgHO1IMA5KGx1qgQnMYf-YFQ/s144-Ic42/IMG_4192.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/BehringerXR18Teardown?authuser=0&feat=embedwebsite">Behringer XR18 Teardown</a></td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com14tag:blogger.com,1999:blog-7098474.post-72817931919217874802015-08-17T17:41:00.000+00:002015-08-17T17:41:46.928+00:00Logarithmic Sine Sweep for Impulse Reponse Measurements (in Python/Numpy)There's quite a lot of software available to do impulse response measurements, e.g. for doing measurements on loudspeakers or electronic audio equipment. Some also use it to sample the impulse responses of rooms and halls to get realistic reverb.<br />
<br />
To learn about the technique (<a href="https://www.google.de/search?q=determine%20impulse%20response%20sine%20sweep">on which one can find quite a few publications using google</a>) I'm going to implement the analyses in python/numpy.<br />
<br />
The first building block is a small script to generate such a sweep and which I've published, as usual, on github: <a href="https://github.com/vogelchr/sweep_analysis">https://github.com/vogelchr/sweep_analysis</a><br />
<br />
Below you can find a spectrogram made using the <a href="http://www.baudline.com/">magnificent baudline</a>.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/BGFSV7iCFSVGKfg9Qxn9ANMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="800" src="https://lh3.googleusercontent.com/-VkVfGy-rdbk/VdIZ6TnEMXI/AAAAAAAAFP0/HzAZFxDQHio/s800-Ic42/Screenshot_2015-08-17_19-26-35.png" width="743" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-3349315075065554422015-08-08T15:15:00.005+00:002015-08-09T08:14:38.433+00:00Full Disk Encryption with Cyanogenmod CM12.1 on a Samsung Galaxy S4 Mini<div>Update August 9th: Just skip to the last line of this post where we realize that we could have spared us all of the hassles and resize2fs from within the running android system ☺.</div><div><br></div><div><br></div>If you try to enable full disk encryption on Cyanogenmod CM12.1 using the normal settings menu (<i>Security -> Encrypt Phone</i>) it doesn't work, the phone will just soft-reboot and nothing will have happened.<br>
<br>
If you "logcat" the debugging log of your phone (using adb logcat) within the huge amount of data, some hint about what might have gone wrong can be found:<br>
<br>
<span style="font-family: Courier New, Courier, monospace;">➜ ~ grep Cryptfs logcat_encryption.txt </span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 199): Check if PFE is activated on Boot</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 199): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 199): Error getting crypt footer and key</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 199): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata</span><br>
<span style="font-family: Courier New, Courier, monospace;"><b>E/Cryptfs ( 199): Orig filesystem overlaps crypto footer region. Cannot encrypt in place.</b></span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 199): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata</span><br>
<span style="font-family: Courier New, Courier, monospace;"><b>E/Cryptfs ( 199): Orig filesystem overlaps crypto footer region. Cannot encrypt in place.</b></span><br>
<br>
On android, the footer that tells the operating system that an partition is encrypted resides on the end of the filesystem and it needs a little space between the logical end of the filesystem in a partition, and the physical end of the partition to be squeezed in when converting a phone from unencrypted to encrypted.<br>
<br>
<a href="http://forum.xda-developers.com/nexus-4/help/looking-encryption-footer-t2676700">http://forum.xda-developers.com/nexus-4/help/looking-encryption-footer-t2676700</a><br>
<br>
Running the recovery system (boot while keeping Volume-Up and Home pressed), we can have a look at the partition sizes and filesystem details. We learn that on my S4 mini, the userdata partition (mmcblk0p24) has a size of 5685231 1k blocks, and the /data filesystem claims a size of 1421307 4k blocks.<br>
<br>
<span style="font-family: Courier New, Courier, monospace;">$ adb shell</span><br>
<span style="font-family: Courier New, Courier, monospace;">~ # cat /proc/partitions</span><br>
<span style="font-family: Courier New, Courier, monospace;">major minor #blocks name</span><br>
<span style="font-family: Courier New, Courier, monospace;">(...)</span><br>
<span style="font-family: Courier New, Courier, monospace;"> 179 24 5685231 mmcblk0p24</span><br>
<span style="font-family: Courier New, Courier, monospace;">~ # tune2fs -l /dev/block/mmcblk0p24 </span><br>
<span style="font-family: Courier New, Courier, monospace;">(...)</span><br>
<span style="font-family: Courier New, Courier, monospace;">Block count: 1421307</span><br>
<span style="font-family: Courier New, Courier, monospace;">(...)</span><br>
<span style="font-family: Courier New, Courier, monospace;">Block size: 4096</span><br>
<br>
As <span style="font-family: Courier New, Courier, monospace;">5685231-1421307*4 = 3</span>, that's only 3 meager 1k blocks at the end of the filesystem, whereas the encryption footer needs a space of at least 16k, the allmighty internet tells me. So, let's build a filesystem that leaves 128kByte of free space on the end as I don't know if Android 5 has enlarged the footer from what the websites I had found claims, or if there's some alignment requirement for it. So I'll be generous. <span style="font-family: Courier New, Courier, monospace;">(5685231-128)/4=1421275.75</span> so I'll create a ext4 filesystem occupying <b>142127<span style="background-color: yellow;">5</span> 4k blocks</b>:<br>
<br>
<span style="font-family: Courier New, Courier, monospace;">~ # mke2fs -b<b>4096</b> -T ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata <b style="background-color: yellow;">142127</b></span><div><span style="font-family: Courier New, Courier, monospace;"><b style="background-color: yellow;">(note: I made a mistake, ch0pped off the 5!)</b></span><br>
<span style="font-family: Courier New, Courier, monospace;">mke2fs 1.41.14 (22-Dec-2010)</span><br>
<span style="font-family: Courier New, Courier, monospace;">Filesystem label=</span><br>
<span style="font-family: Courier New, Courier, monospace;">OS type: Linux</span><br>
<span style="font-family: Courier New, Courier, monospace;">Block size=4096 (log=2)</span><br>
<span style="font-family: Courier New, Courier, monospace;">Fragment size=4096 (log=2)</span><br>
<span style="font-family: Courier New, Courier, monospace;">Stride=0 blocks, Stripe width=0 blocks</span><br>
<span style="font-family: Courier New, Courier, monospace;">35600 inodes, 142127 blocks</span><br>
<span style="font-family: Courier New, Courier, monospace;">7106 blocks (5.00%) reserved for the super user</span><br>
<span style="font-family: Courier New, Courier, monospace;">First data block=0</span><br>
<span style="font-family: Courier New, Courier, monospace;">Maximum filesystem blocks=146800640</span><br>
<span style="font-family: Courier New, Courier, monospace;">5 block groups</span><br>
<span style="font-family: Courier New, Courier, monospace;">32768 blocks per group, 32768 fragments per group</span><br>
<span style="font-family: Courier New, Courier, monospace;">7120 inodes per group</span><br>
<span style="font-family: Courier New, Courier, monospace;">Superblock backups stored on blocks: </span><br>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>32768, 98304</span><br>
<span style="font-family: Courier New, Courier, monospace;"><br>
</span> <span style="font-family: Courier New, Courier, monospace;">Writing inode tables: done </span><br>
<span style="font-family: Courier New, Courier, monospace;">Creating journal (4096 blocks): done</span><br>
<span style="font-family: Courier New, Courier, monospace;">Writing superblocks and filesystem accounting information: done</span><br>
<span style="font-family: Courier New, Courier, monospace;"><br>
</span> <span style="font-family: Courier New, Courier, monospace;">This filesystem will be automatically checked every 33 mounts or</span><br>
<span style="font-family: Courier New, Courier, monospace;">180 days, whichever comes first. Use tune2fs -c or -i to override.</span><br>
<br>
<b>Do I really have to mention at this point that this will erase all your files?</b> Alternatively one could try "resizefs" to resize the filesystem, but that program isn't included in my recovery. Anyhow, it seems to be prudent to try encryption on an otherwise virgin install, as one risks data loss anyhow when performing the encryption process and there are reports of phones not booting up correctly after encyption had been enabled.<br>
<br>
Then reboot the phone, do a half-hearted initial setup of the device, configure a simple PIN for testing, and encrypt your phone. (I also enabled debugging so that I can run logcat again to catch errors).<br>
<br>
<span style="font-family: Courier New, Courier, monospace;">$ grep Cryptfs logcat_encryption_newfs.txt</span><br>
<span style="font-family: Courier New, Courier, monospace;">(...)</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Check if PFE is activated on Boot</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 196): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 196): Error getting crypt footer and key</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 196): not running with encryption, aborting</span><br>
<span style="font-family: Courier New, Courier, monospace;">E/Cryptfs ( 196): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata</span><br>
<span style="font-family: Courier New, Courier, monospace;">D/Cryptfs ( 196): Just asked init to shut down class main</span><br>
<span style="font-family: Courier New, Courier, monospace;">D/Cryptfs ( 196): unmounting /mnt/shell/emulated succeeded</span><br>
<span style="font-family: Courier New, Courier, monospace;">D/Cryptfs ( 196): unmounting /data succeeded</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): keymaster version is 2</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Using scrypt for cryptfs KDF</span><br>
<span style="font-family: Courier New, Courier, monospace;">D/Cryptfs ( 196): Just triggered post_fs_data</span><br>
<span style="font-family: Courier New, Courier, monospace;">D/Cryptfs ( 196): post_fs_data done</span><br>
<span style="font-family: Courier New, Courier, monospace;">D/Cryptfs ( 196): Just triggered restart_min_framework</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Using scrypt for cryptfs KDF</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Enabling support for allow_discards in dmcrypt.</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): load_crypto_mapping_table: target_type = crypt</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): load_crypto_mapping_table: real_blk_name = /dev/block/platform/msm_sdcc.1/by-name/userdata, extra_params = 1 allow_discards</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypting ext4 filesystem in place...</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypting group 0</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypting from sector 0</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypting group 1</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypted to sector 1356288</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypting from sector 16777216</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypted to sector 16867328</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypting from sector 16874496</span><br>
<span style="font-family: Courier New, Courier, monospace;">I/Cryptfs ( 196): Encrypted to sector 17014784</span><br>
<br>
The phone will now reboot and ask for the PIN you entered. Unfortunately this takes *ages*! But if everything is fine, you can now setup your phone to your heart's content and set up a real password to have a securely encrypted phone. We'll have to see how stable this encrypted phone will be in daily use.<br>
<br>
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/eu5V-UB1tz1dQieTGiFbudMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh3.googleusercontent.com/-nVr2JeknpAs/VcYcr3QbmVI/AAAAAAAAFOU/d9k9i6sCQqg/s144-Ic42/IMG_20150808_170842.jpg" width="108"></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br>
<div>
<span style="background-color: yellow;"><b>Update:</b></span> I made a mistake and chopped off the "5" at the end, so my filesystem only occupies 1/10 of the available space and has a completely unusable size of 500 MB :-(. So, to not have to start all over again, I'll try to resize the file system in place.<br>
<br>
<div>
Login to your android device, and check the filesystem size. Indeed /data is completely ridiculous at 500MB.</div>
<div>
<br></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">➜ e2fs adb shell</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">shell@serranoltexx:/ $ su</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">root@serranoltexx:/ # df</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Filesystem Size Used Free Blksize</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">(...)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">/data 553.0M 490.2M 62.8M 40</span>96</div>
<div>
<br></div>
</div>
<div>
Check the sizes of the underlaying block device, and the dmcrypt mapper:</div>
<div>
<br></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">root@serranoltexx:/ # cat /proc/partitions</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">major minor #blocks name</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">(...)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 179 24 5685231 mmcblk0p24</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">(...)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> 254 0 5685215 dm-0</span></div>
<div>
<br></div>
<div>
Indeed, the crypted partition is exactly 16kB smaller (the crypt footer) than the raw block device. So we can hopefully let resize2fs autodiscover the target size. Unfortunately, we cannot access the block device hosting /data, and we can't umount /data because the android framework is still running. So we use the same method as the volume daemon to shutdown most of android. (your device will not no longer react to user input on the buttons or touch secreen):</div>
<div>
<br></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">root@serranoltexx:/ # setprop vold.decrypt trigger_shutdown_framework</span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;">root@serranoltexx:/ # umount /data</span></div>
</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">root@serranoltexx:/ # e2fsck -f /dev/block/dm-0 </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">e2fsck 1.42.9 (28-Dec-2013)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Pass 1: Checking inodes, blocks, and sizes</span></div>
</div>
<div>
<span style="font-family: inherit;">(...)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">(fix problems as they appear here)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">root@serranoltexx:/ # resize2fs /dev/block/dm-0</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">resize2fs 1.42.9 (28-Dec-2013)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Resizing the filesystem on /dev/block/dm-0 to 1421303 (4k) blocks.</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">The filesystem on /dev/block/dm-0 is now 1421303 blocks long.</span></div>
</div>
<div>
<br></div>
<div>
I rebooted the phone the hard way via <span style="font-family: Courier New, Courier, monospace;">sync; echo b >/proc/sysrq-trigger</span>.</div>
<div>
<br>
Now /data is at the expected size of 5.5 GB.<br>
<br></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">➜ ~ adb shell df</span><br>
<span style="font-family: Courier New, Courier, monospace;">Filesystem Size Used Free Blksize</span><br>
<span style="font-family: Courier New, Courier, monospace;">(...)</span><br>
<span style="font-family: Courier New, Courier, monospace;">/data 5.4G 734.3M 4.7G 4096</span></div>
<div>
<br></div><div>Of course, now that we have found out how to resize an ext4 filesystem in place from within android, we realize that we could have made it that way from the beginning 😉. Without data loss. Just run the last 4 commands but using the physical emmc device and append the right number of blocks we need to resize2fs while the device is still unencrypted...</div><div><br></div><div>e2fsck /dev/block/mmcblk0p24</div><div>resize2fs /dev/block/mmcblk0p24 14221303</div><div><br></div><div>That should do the trick. Reboot and run the normal encryption process.</div><div><br></div>
</div>Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com9tag:blogger.com,1999:blog-7098474.post-10949552621040834762015-07-07T06:31:00.002+00:002015-07-07T06:31:24.092+00:00Public Service Announcement: Putty A recent upgrade of sshd apparently broke my saved putty connections, which have a deprecated key-exchange protocol on the top of the "Algorithm selection policy."<br />
<br />
It manifests itself as a long pause, showing a black putty terminal window, followed by the message: <b>PuTTY Fatal Error: Server unexpectedly closed network connection</b>.<br />
<div>
<br /></div>
<br />
The putty event window will show it being stuck in the "<span style="font-family: Courier New, Courier, monospace;">Doing Diffie-Hellman group exchange</span>" phase.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/fqGO574gfupWfU2jdw2bsdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="71" src="http://lh3.googleusercontent.com/-4KAiSUny9FM/VZtwdVg0S1I/AAAAAAAAFEU/dnzvXNzi3o8/s144/dh-group-exchange-putty-log.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
If you run your sshd in debug mode, you'll see that sshd isn't happy with the selection of the key exchange protocol.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">➜ ~ sudo /usr/sbin/sshd -p 2222 -d</span><br />
<span style="font-family: Courier New, Courier, monospace;">debug1: sshd version OpenSSH_6.9, OpenSSL 1.0.2c 12 Jun 2015</span><br />
<div>
(...)</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">debug1: kex: server->client aes256-ctr hmac-sha2-256 none [preauth]</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">debug1: expecting SSH2_MSG_KEX_DH_GEX_REQUEST [preauth]</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Hm, kex protocol error: type 30 seq 1 [preauth]</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Connection closed by 10.120.102.56 [preauth]</span></div>
</div>
<div>
(...)</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/NTNWrw0HXc-NamRevGdCR9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="60" src="http://lh3.googleusercontent.com/-LvQePf8OIu8/VZtwcPG-dwI/AAAAAAAAFEU/-srAst3BceI/s144/dh-group-exchange-sshd-debug.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
It seems that OpenSSH recently had removed an ancient method of key exchange, as is to be read on <a href="https://www.mail-archive.com/misc@openbsd.org/msg137973.html">this thread on the misc@OpenBSD mailing list</a>.<br />
<br />
If you open putty 's session configuration and move the "Diffie-Hellmann group exchange" right to the bottom of the "Algorithm selection policy" (Configuration / Connection / SSH / Kex), everything works again.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/3MBnoTPYnaa-uY6YlyiK-9MTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="138" src="http://lh3.googleusercontent.com/-VNkLsqosj9Y/VZtwZctuDQI/AAAAAAAAFEU/mA72h_bTJd4/s144/dh-group-exchange.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com4tag:blogger.com,1999:blog-7098474.post-58332535841605332312015-03-29T17:00:00.000+00:002015-03-29T17:00:29.127+00:00SDM220 Power Meter, MODBUS, Python, RS485The <a href="http://www.eastron.com.cn/">Eastron</a> <a href="http://www.eastron.com.cn/product/60079689090-218697749/SDM220_Standard_MID_Single_Phase_DIN_Rail_Energy_Meter_2P_kWh_meter_DIN_Rail_Modbus_Energy_Meters_MID_Pending.html">SDM220</a> is a very inexpensive one-phase power/energy meter, which can be readout via RS485. I got myself one to play with, and there are a few observations I wanted to write down.<br />
<br />
<table style="width: auto;">
<tr><td><a href="https://picasaweb.google.com/lh/photo/y5aZEEZrBN3nCerUDsEqhtMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="98" src="https://lh4.googleusercontent.com/-whbz35juvr4/VRgr9XsWVAI/AAAAAAAAE1A/uZPTL7CYXcU/s144/eastron_sdm220_labels.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</table>
<br />
<br />
<table style="width: auto;">
<tr><td><a href="https://picasaweb.google.com/lh/photo/iSGLwDRg3aVDDvzC_OdL1NMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh4.googleusercontent.com/-B5nVBoK7M-o/VRgr9eL65GI/AAAAAAAAE1A/zPxlsJnaffY/s144/eastron_sdm220_device.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</table>
<br />
<br />
<table style="width: auto;">
<tr><td><a href="https://picasaweb.google.com/lh/photo/GUNs_4c5XBgBdhlp4Uam2NMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="144" src="https://lh5.googleusercontent.com/-FAgkU4C4l-8/VRgr9cpLwiI/AAAAAAAAE1A/GiDMyxerC5A/s144/eastron_sdm220_connected.jpg" width="108" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</table>
<br />
<br />
It's actually a pretty nifty meter, measuring power and energy in both directions, voltage and line frequency. Furthermore it outputs power-factor (cosϕ) and reactive or apparent power (which is basically the same thing, just represented differently).<br />
<br />
One thing that cost me some time to resolve, especially as I used a selfmade RS485 adapter in the first place about the correctnes of which I was unsure are: The RS485 terminals are wired incorrectly, B and A are swapped, this has been verified with an industrial/commercial interface. Connectors 7, 8 and 9 are GND, A and B. In that order. If the link is idle, B will be positive with respect to A.<br />
<br />
There's an existing <a href="https://github.com/bashwork/pymodbus">modbus library for Python (pymodbus)</a> which works perfect, so far. The serial modbus link is instantiated like this (if the modbus runs with parity = None).<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"> cl = pymodbus.client.sync.ModbusSerialClient('rtu',</span><br />
<span style="font-family: Courier New, Courier, monospace;"> port='/dev/ttyUSB1', baudrate=9600,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> parity='N',stopbits=2,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> timeout=0.125)</span><br />
<div>
<br /></div>
The values stored in the device are actually IEEE754 floating point values, which can be converted to python floats very conveniently, they are fetched as two consecutive 16bit register, concatenated to a 32bit field, and then reinterpreted as the 32bit float:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"> resp = client.read_input_registers(basereg,2, unit=1)</span><br />
<div>
<span style="font-family: Courier New, Courier, monospace;"> return struct.unpack('>f',struct.pack('>HH',*resp.registers))</span></div>
<div>
<br /></div>
The documentation for the SDM220 is actually quite comprehensive, but it took me quite a while until I really figured out what they meant... So here are the register numbers I sucessfully used to get date off the device:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"> # Symbol Reg# Format</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'V', 0x00, '%6.2f' ), # Voltage [V]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'Curr', 0x06, '%6.2f' ), # Current [A]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'P[act]', 0x0c, '%6.0f' ), # Active Power ("Wirkleistung") [W]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'P[app]', 0x12, '%6.0f' ), # Apparent Power ("Scheinl.") [W]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'P[rea]', 0x18, '%6.0f' ), # Reactive Power ("Blindl.") [W]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'PF', 0x1e, '%6.3f' ), # Power Factor [1]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'Phi', 0x24, '%6.1f' ), # cos(Phi)? [1]</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ( 'Freq', 0x46, '%6.2f' ) # Line Frequency [Hz]</span><br />
<div>
<br /></div>
<br />Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com13tag:blogger.com,1999:blog-7098474.post-30411798150754426802014-12-02T20:04:00.002+00:002014-12-02T20:42:08.460+00:00esp8266 firmware upgrade, odd baudrate in bootloader?So, I also got one of those ESP8266 wifi/serial modules, which are pretty neat. Unfortunately mine seemed to come with an ancient firmware on it, and pretty unconveniently those didn't want to be re-flashed with newer software.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/gbnjW4dKN7BIm8MBJgMcJtMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT_1z0hYaC4OWK92ccczx5CUDLiKXFyNuGrUSk26u3fN5yXP9g0gW7v0e_Qjc3ZWid5uJrJEEmRPYY1HM4HLqF9k1ouM8YDJ_p8o5NK0hh6IfCDZhqVrohNFFfVYBJkFjl-8N7Ow/s144/IC800011.JPG" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
The bootloader seems to initialize the modules' serial port to the pretty insane value of 76923 bps, so that in "programming" mode, the stupid windows-utility (or, for that matter, any program expecting standard-baudrates) will fail to communicate with the module.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/3nhiZ1mOsnPQyIPOpxluNtMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="72" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEBfzZcZYEOUckK3SJUY_bmxPSP2dyzbdsGbKqpYPNfsR2tCCKalxCGZt7npvZ78p-iApMgdngpcAk6E-g9AyJghuFECvzGqfWDM7iVSrfaVH6fVipL_belOSxKv3nIPwPk5FY-g/s144/scrn-logic.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
If you have a suitable serial cable (a FTDIchip FT2232 is what I used), you can calculate "custom dividers" for most uncommon baudrates, and use those instead of 38,4kBps (the "magic" baudrate indicating that the custom one should be used).<br />
<br />
Base-frequency for the ft2232 is 60 Mhz, so we'll use a custom divisor of 780 (60Mhz/76923).<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ <a href="http://linux.die.net/man/8/setserial">setserial</a> /dev/ttyUSB0 spd_cust divisor 780 </span><br />
<span style="font-family: Courier New, Courier, monospace;">$ cu -l ttyUSB0 -s 38400</span><br />
<span style="font-family: Courier New, Courier, monospace;">Connected.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;"> ets Jan 8 2013,rst cause:1, boot mode:(7,7)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;">waiting for host</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;"> ets Jan 8 2013,rst cause:1, boot mode:(7,7)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;">waiting for host</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;"> ets Jan 8 2013,rst cause:1, boot mode:(3,7)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;">load 0x40100000, len 24444, room 16 </span><br />
<span style="font-family: Courier New, Courier, monospace;">tail 12</span><br />
<span style="font-family: Courier New, Courier, monospace;">chksum 0xe0</span><br />
<span style="font-family: Courier New, Courier, monospace;">ho 0 tail 12 room 4</span><br />
<span style="font-family: Courier New, Courier, monospace;">load 0x3ffe8000, len 3168, room 12 </span><br />
<span style="font-family: Courier New, Courier, monospace;">tail 4</span><br />
<span style="font-family: Courier New, Courier, monospace;">chksum 0x93</span><br />
<span style="font-family: Courier New, Courier, monospace;">load 0x3ffe8c60, len 4956, room 4 </span><br />
<span style="font-family: Courier New, Courier, monospace;">tail 8</span><br />
<span style="font-family: Courier New, Courier, monospace;">chksum 0xbd</span><br />
<span style="font-family: Courier New, Courier, monospace;">csum 0xbd</span><br />
<div>
<br /></div>
<div>
Interestingly, that seems to be only the bootloader of the module, after this, the device switches to the more common 115200kbps and responds to AT-commands, given that GPIO15=GND, GPIO2=Vcc, GPIO0=Vcc and CH_PD=Vcc. (pullups to Vcc via ~5kΩ resistor)</div>
<div>
<br /></div>
<div>
So, to get the windows-only updater to run successfully, we...</div>
<div>
<ul>
<li><b>connect GPIOs and CH_PD as listed above</b> (AT-Mode)</li>
<li><b>power up module</b></li>
<li><i>module will start bootloader with 77kbps, then change into AT-command mode, at 115200 bps</i></li>
<li><b>connect GPIO0 to GND</b> (firmware download mode)</li>
<li><b>pulse CH_PD to LOW</b> to restart module</li>
<li>firmware will restart, but bootloader does NOT go back to 77kbps</li>
<li><b>run firmware-upgrade in windows</b></li>
</ul>
</div>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/E2RDN-5Le7_gAON73HHZxdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="79" src="https://lh5.googleusercontent.com/-zTg28BXII9E/VH4WV2a7cpI/AAAAAAAAEoA/n8uj6zrflSE/s144/esp8266_flasher.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
Now I'm upgraded to version 170901 (whatever that means).<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">AT+GMR</span><br />
<span style="font-family: Courier New, Courier, monospace;">00170901</span><br />
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com1tag:blogger.com,1999:blog-7098474.post-45591598952645129412014-08-26T19:56:00.004+00:002014-08-26T19:56:41.735+00:00Building pyqwt 5.2.0 by manually installing the pyqtconfig.py module.For playing with <a href="http://gnuradio/" target="_blank">GNU radio</a> I had to install quite a lot of dependencies to get all the modules to build, unfortunately there's currently a build issue with <a href="http://pyqwt.sourceforge.net/">PyQwt</a>, which are the Python bindings for <a href="http://qwt.sourceforge.net/" target="_blank">Qwt, the Qt Widgets for Technical Applications</a>.<br />
<br />
Installation of <a href="http://pyqwt.sourceforge.net/">PyQwt-5.2.0</a> fails with an error message of...<br />
<blockquote class="tr_bq">
Requires at least <a href="http://www.riverbankcomputing.co.uk/software/pyqt/intro">PyQt-4.2</a> and its development tools.<br />==> ERROR: A failure occurred in build().<br /> Aborting...</blockquote>
<div>
...and this is because of the configuration script of PyQwt that tries to import PyQT's pqtconfig.py, that no longer is installed by PyQt 4.11.1!</div>
<div>
<br /></div>
<div>
There are a few bugreports to be found on the web, e.g.</div>
<div>
<ul>
<li><a href="https://github.com/Homebrew/homebrew/issues/21984">https://github.com/Homebrew/homebrew/issues/21984</a></li>
<li><a href="http://sourceforge.net/p/pyqwt/bugs/12/">http://sourceforge.net/p/pyqwt/bugs/12/</a></li>
</ul>
</div>
<br />
To fix this, get yourself the <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download">pyqt-x11 source</a>, then run the configure script as appropriate for your particular Linux installation...<br />
<blockquote class="tr_bq">
[optiplex …/chris/AUR/python2-pyqt4/src/Py2Qt-x11-gpl-4.11.1]<br />$ <b>python2 configure.py -v /usr/share/sip --qsci-api -q /usr/bin/qmake-qt4 </b>Determining the layout of your Qt installation...<br />This is the GPL version of PyQt 4.11.1 (licensed under the GNU General Public<br />License) for Python 2.7.8 on linux2.<br />Type '2' to view the GPL v2 license.<br />Type '3' to view the GPL v3 license.<br />Type 'yes' to accept the terms of the license.<br />Type 'no' to decline the terms of the license.<br />Do you accept the terms of the license? yes<br />Found the license file pyqt-gpl.sip.<br />Checking to see if the QtGui module should be built...<br />Checking to see if the QtHelp module should be built...<br />Checking to see if the QtMultimedia module should be built...<br />Checking to see if the QtNetwork module should be built...</blockquote>
<br />
(...)<br />
<div>
<blockquote class="tr_bq">
Creating pyrcc4 Makefile...<br />Creating Qt Designer plugin Makefile...<br />Creating pyqtconfig.py...</blockquote>
At this point, the proper pyqtconfig.py script has been created, install to the python site-package directory.<br />
<blockquote class="tr_bq">
[optiplex …/chris/AUR/python2-pyqt4/src/Py2Qt-x11-gpl-4.11.1]<br />$ <b>sudo install -m644 pyqtconfig.py /usr/lib/python2.7/site-packages/PyQt4/pyqtconfig.py</b> </blockquote>
</div>
<div>
Now, the pyqwt bindings can be built, e.g. by using <a href="https://www.archlinux.org/">ArchLinux's</a> <a href="https://wiki.archlinux.org/index.php/makepkg">makepkg</a> utility, using the <a href="https://aur.archlinux.org/packages/pyqwt/">AUR package</a>.</div>
<div>
<blockquote class="tr_bq">
[optiplex /home/chris/AUR/pyqwt]<br />$ makepkg<br />==> Making package: pyqwt 5.2.0-10 (Tue Aug 26 21:37:07 CEST 2014)<br />==> Checking runtime dependencies...<br />==> Checking buildtime dependencies...</blockquote>
</div>
<div>
(...)</div>
<div>
<blockquote class="tr_bq">
==> Starting build()...<br />patching file qt4lib/PyQt4/Qwt5/qplt.py<br />patching file configure/configure.py<br />patching file configure/configure.py<br />Command line options:<br />{'debug': False,<br /> 'disable_numarray': False,</blockquote>
</div>
<div>
(...)</div>
<div>
<blockquote class="tr_bq">
cp -f ../../qt4lib/PyQt4/uic/widget-plugins/qwt.py /home/chris/AUR/pyqwt/pkg/pyqwt/usr/lib/python2.7/site-packages/PyQt4/uic/widget-plugins/qwt.py<br />make[1]: Leaving directory '/home/chris/AUR/pyqwt/src/PyQwt-5.2.0/configure/qwt5qt4'<br />==> Tidying install...<br /> -> Purging unwanted files...<br /> -> Removing libtool files...<br /> -> Removing static library files...<br /> -> Compressing man and info pages...<br /> -> Stripping unneeded symbols from binaries and libraries...<br />==> Creating package "pyqwt"...<br /> -> Generating .PKGINFO file...<br /> -> Generating .MTREE file...<br /> -> Compressing package...<br />==> Leaving fakeroot environment.<br />==> Finished making: pyqwt 5.2.0-10 (Tue Aug 26 21:40:25 CEST 2014)</blockquote>
</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Wdyc2HfPKMYs0G0aG5-MMGGbl00BsmQRmXxnXF3Lpok9FvihImxHm6a5Ff2gDEcyNnNSjJYX55epKY3PJdjZ7DF-8Hw5IdA7AihXiDzM6G_G5z4NiIRS_l8ADUNEfuK0EyBgtQ/s1600/Screenshot+-+08262014+-+09:50:45+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Wdyc2HfPKMYs0G0aG5-MMGGbl00BsmQRmXxnXF3Lpok9FvihImxHm6a5Ff2gDEcyNnNSjJYX55epKY3PJdjZ7DF-8Hw5IdA7AihXiDzM6G_G5z4NiIRS_l8ADUNEfuK0EyBgtQ/s1600/Screenshot+-+08262014+-+09:50:45+PM.png" height="316" width="320" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7rwf_ZN8BZhGuHpRrd4zcgXtOkrCl1CsLP3HSrY2XZxVl1hOv-9OuFEqaRujw1x6XwHyW8ytCZ4EntBMcAGNAI4Xj7qzCKIGUHGmmAnVgjrQH5OUFsFHxtCdsIDOeLut5utUogQ/s1600/Screenshot+-+08262014+-+09:54:05+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7rwf_ZN8BZhGuHpRrd4zcgXtOkrCl1CsLP3HSrY2XZxVl1hOv-9OuFEqaRujw1x6XwHyW8ytCZ4EntBMcAGNAI4Xj7qzCKIGUHGmmAnVgjrQH5OUFsFHxtCdsIDOeLut5utUogQ/s1600/Screenshot+-+08262014+-+09:54:05+PM.png" height="198" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-69976059015781499142014-08-12T13:26:00.000+00:002014-08-13T09:58:04.372+00:00Controlling USB device access on Linux (e.g. BADusb defense)So, there was a lot of fuzz about a recent talk by <a href="https://srlabs.de/blog/wp-content/uploads/2014/07/SRLabs-BadUSB-BlackHat-v1.pdf" target="_blank">Karsten Nohl et al. at BlackHat</a> about the the unsecurity of current USB implementations (on the computer side) which happily load drivers for all kinds of devices as soon as a (potentially malicious) USB stick is connected.<br />
<br />
I <i>completely agree</i> that, as shipped, most computer systems will be susceptible to this attack, and assume that all of their attacks will work as advertised. What I <i>don't agree with at all</i> is their conclusion, which boils down that no effective defenses exist.<br />
<br />
While I haven't made my homework to develop a defense, I want to at least show the mechanism in current Linux kernels to limit binding of potentially dangerous <i>drivers</i> to specific devices, so that e.g. a inserted USB-stick would only be mounted as a block device, and its malicious keyboard interface be ignored.<br />
<br />
<u><span style="font-size: large;">Binding of Drivers</span></u><br />
<br />
A linux-module can claim ownership of certain usb vendor/device ids or device classes. Those are visible when looking at the <i>modinfo</i> of a kernel module, to facilitate autoloading of modules, but are also registered in internal kernel structures, so that drivers compiled in statically directly can be mated with the proper devices:<br />
<br />
<blockquote class="tr_bq">
$ modinfo snd-usb-audio<br />
filename: /lib/modules/3.15.8-1-ARCH/kernel/sound/usb/snd-usb-audio.ko.gz<br />
license: GPL<br />
description: USB Audio<br />
author: Takashi Iwai <tiwai suse.de=""><br />alias: <b>usb:v*p*d*dc*dsc*dp*ic01isc01ip*in*</b><br />alias: usb:v0D8Cp0103d*dc*dsc*dp*ic*isc*ip*in*<br />alias: usb:v*p*d*dc*dsc*dp*ic01isc03ip*in*<br />alias: usb:v200Cp100Bd*dc*dsc*dp*ic*isc*ip*in*<br /><i>(...)</i></tiwai></blockquote>
<div>
This information currently comes from the MODULE_DEVICE_TABLE of sound/usb/card.c, stored in an array called <a href="http://lxr.free-electrons.com/ident?i=usb_audio_ids" target="_blank">usb_audio_ids</a>. The bold one is the "default class", the others all are included in the "quirks table", which includes all exceptions from the default class.</div>
<div>
<blockquote class="tr_bq">
static struct usb_device_id usb_audio_ids [] = {<br />
#include "quirks-table.h"<br />
{ .match_flags = (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS),<br />
.bInterfaceClass = <b>USB_CLASS_AUDIO</b>,<br />
.bInterfaceSubClass = <b>USB_SUBCLASS_AUDIOCONTROL</b> },<br />
{ } /* Terminating entry */<br />
};<br />
MODULE_DEVICE_TABLE(usb, usb_audio_ids);</blockquote>
</div>
<div>
On connection of a USB device, the kernel will look through all its currently registered modules that claim to support USB devices (by registering those tables with the kernel) and bind devices to drivers (and if it doesn't succeed, it will call udev/hotplug to load a module that does). </div>
<div>
<br /></div>
<div>
<span style="font-size: large;"><u>The Vulnerability</u></span></div>
<div>
<br /></div>
<div>
So, if you connect a particular USB headset, the electronics of which I have laying around... you get a new sound device in ALSA...</div>
<div>
<blockquote class="tr_bq">
[root@optiplex devices]# aplay -l</blockquote>
</div>
<div>
<blockquote class="tr_bq">
**** List of PLAYBACK Hardware Devices ****<br />
(...)<br />
card 1: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0</blockquote>
</div>
<div>
<b>But also a new keyboard!</b> (the mute/volume buttons on the headset, but those could be arbitrary buttons entering text, too).</div>
<div>
<div>
<blockquote class="tr_bq">
[root@optiplex devices]# xinput<br />
⎡ Virtual core pointer <span class="Apple-tab-span" style="white-space: pre;"> </span>id=2<span class="Apple-tab-span" style="white-space: pre;"> </span>[master pointer (3)]<br />
⎜ ↳ Virtual core XTEST pointer <span class="Apple-tab-span" style="white-space: pre;"> </span>id=4<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave pointer (2)]<br />
⎜ ↳ Logitech USB-PS/2 Optical Mouse <span class="Apple-tab-span" style="white-space: pre;"> </span>id=8<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave pointer (2)]<br />
⎣ Virtual core keyboard <span class="Apple-tab-span" style="white-space: pre;"> </span>id=3<span class="Apple-tab-span" style="white-space: pre;"> </span>[master keyboard (2)]<br />
↳ Virtual core XTEST keyboard <span class="Apple-tab-span" style="white-space: pre;"> </span>id=5<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave keyboard (3)]<br />
↳ Power Button <span class="Apple-tab-span" style="white-space: pre;"> </span>id=6<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave keyboard (3)]<br />
↳ Power Button <span class="Apple-tab-span" style="white-space: pre;"> </span>id=7<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave keyboard (3)]<br />
↳ Das Keyboard <span class="Apple-tab-span" style="white-space: pre;"> </span>id=9<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave keyboard (3)]<br />
↳ <b>Logitech Logitech USB Headset <span class="Apple-tab-span" style="white-space: pre;"> </span>id=10<span class="Apple-tab-span" style="white-space: pre;"> </span>[slave keyboard (3)]</b></blockquote>
</div>
</div>
<div>
If you look in the sysfs filesystem, you can see, that the USB headset (usb device <b>5-1</b>) has 4 distinct functions (<b>.0</b> -- <b>.3</b>) on configuration <b>:1</b>.<br />
<blockquote class="tr_bq">
[root@optiplex /sys/bus/usb/devices/5-1]# ls<br />
<b>5-1:1.0</b><span class="Apple-tab-span" style="white-space: pre;"> </span> bcdDevice<span class="Apple-tab-span" style="white-space: pre;"> </span> maxchild<br />
<b>5-1:1.1</b><span class="Apple-tab-span" style="white-space: pre;"> </span> bmAttributes port<br />
<b>5-1:1.2</b><span class="Apple-tab-span" style="white-space: pre;"> </span> busnum<span class="Apple-tab-span" style="white-space: pre;"> </span> power<br />
<b>5-1:1.3</b><span class="Apple-tab-span" style="white-space: pre;"> </span> configuration product<br />
authorized<span class="Apple-tab-span" style="white-space: pre;"> </span> descriptors quirks<br />
avoid_reset_quirk dev<span class="Apple-tab-span" style="white-space: pre;"> </span> removable<br />
bConfigurationValue devnum<span class="Apple-tab-span" style="white-space: pre;"> </span> remove<br />
bDeviceClass<span class="Apple-tab-span" style="white-space: pre;"> </span> devpath<span class="Apple-tab-span" style="white-space: pre;"> </span> speed<br />
bDeviceProtocol driver<span class="Apple-tab-span" style="white-space: pre;"> </span> subsystem<br />
bDeviceSubClass ep_00<span class="Apple-tab-span" style="white-space: pre;"> </span> uevent<br />
bMaxPacketSize0 idProduct<span class="Apple-tab-span" style="white-space: pre;"> </span> urbnum<br />
bMaxPower<span class="Apple-tab-span" style="white-space: pre;"> </span> idVendor<span class="Apple-tab-span" style="white-space: pre;"> </span> version<br />
bNumConfigurations ltm_capable<br />
bNumInterfaces<span class="Apple-tab-span" style="white-space: pre;"> </span> manufacturer</blockquote>
<div>
And those are described by the (very lengthy) lsusb -v output, which I'll not reproduce completely here, just try it for yourself on any USB device.<br />
<br />
<div>
Bus 005 Device 006: ID 046d:0a0b Logitech, Inc. ClearChat Pro USB</div>
<div>
Device Descriptor:</div>
<div>
(...)</div>
<div>
bNumConfigurations 1</div>
<div>
<b> Configuration Descriptor: (configuration #1 starts here)</b></div>
<div>
bLength 9</div>
<div>
(...)</div>
<div>
<b> Interface Descriptor: (interface 1:0)</b></div>
<div>
(...)</div>
<div>
<div>
bDescriptorType 4</div>
<div>
bInterfaceNumber <b>0</b></div>
</div>
<div>
(...)</div>
<div>
<b></b><br />
<div>
<b> bInterfaceClass 1 Audio</b></div>
<b>
<div>
bInterfaceSubClass 1 Control Device</div>
</b></div>
<div>
(...)</div>
<div>
<b> AudioControl Interface Descriptor: (detailed info about audio capabilities)</b></div>
<div>
bLength 10</div>
</div>
<div>
(...)</div>
<div>
<div>
<b> Interface Descriptor: (interface 1:3)</b></div>
<div>
<b> bInterfaceNumber 3</b></div>
<div>
(...)</div>
<div>
<b> bInterfaceClass 3 Human Interface Device</b></div>
<div>
bInterfaceSubClass 0 No Subclass</div>
<div>
bInterfaceProtocol 0 None</div>
<div>
iInterface 0 </div>
</div>
<div>
<br /></div>
<div>
So, here you have it, one device that (legitimately) is both a soundcard and a keyboard/mouse (e.g. an human interface device). Given enough motiuvation, code could be written for the controller inside the soundcard that enters arbitary text to my computer. And that's basically the vulnerability presented in the Black Hat Presentation by Nohl et al.</div>
</div>
<div>
<br />
<u><span style="font-size: large;">Defense</span></u><br />
<br /></div>
<div>
But, you can easily turn off this automatic binding, at least on Linux, with one single command:</div>
<div>
<blockquote class="tr_bq">
[root@optiplex ~]# echo 0 >/sys/bus/usb/drivers_autoprobe </blockquote>
</div>
<div>
Now, whenever you connect a USB device to your computer, it will not automatically connect the usb-soundcard to the ALSA subsystem and the volume buttons to the hidraw/keyboard driver. If I now connect the aforementioned soundcard, I'll not get a new keyboard in xinput, nor a soundcard in ALSA (and also not a network- or block-device for a network card or USB disk).<br />
<br />
The only thing I'll get in my dmesg is the message, that an USB device has been connected:<br />
<blockquote class="tr_bq">
[13399.092113] usb 5-1: USB disconnect, device number 6<br />
[13405.245389] usb 5-1: new full-speed USB device number 7 using uhci_hcd</blockquote>
<div>
And to manually bind this device, you first have to choose the appropriate USB configuration...</div>
<div>
<blockquote class="tr_bq">
# echo 1 >/sys/bus/usb/devices/5-1/bConfigurationValue </blockquote>
</div>
<div>
...and tell the usb audio driver to bind to that device.</div>
<div>
<blockquote class="tr_bq">
# echo 5-1:1.0 >/sys/bus/usb/drivers/snd-usb-audio/bind</blockquote>
</div>
<div>
Now you have the USB audio interface, but not the keyboard, yet... If you wanted, you'd just bind usb-hid to interface 3.</div>
<blockquote class="tr_bq">
# echo 5-1:1.3 >/sys/bus/usb/drivers/usbhid/bind </blockquote>
</div>
<div>
To verify that your keyboard presses aren't registed from the connected device before, and are registered after binding, you can run "xev" and press the volume buttons (note: those, in principle, could enter arbitrary text to your computer, depending on the programming of the controller in the device).</div>
<div>
<blockquote class="tr_bq">
KeyRelease event, serial 38, synthetic NO, window 0x3800001,<br />
root 0x1dc, subw 0x3800002, time 13880057, (41,58), root:(2384,618),<br />
state 0x10, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,<br />
XLookupString gives 0 bytes:<br />
XFilterEvent returns: False</blockquote>
The most often quoted use-case if obviously connection of a usb-storage device, e.g. an external harddrive or flash-stick.<br />
<br />
<blockquote class="tr_bq">
[14567.888596] usb 6-1: new high-speed USB device number 4 using ehci-pci</blockquote>
<blockquote class="tr_bq">
# echo 1 >/sys/bus/usb/devices/6-1/bConfigurationValue<br />
# echo 6-1:1.0 >/sys/bus/usb/drivers/usb-storage/bind</blockquote>
<div>
<blockquote class="tr_bq">
[14667.692717] usb-storage 6-1:1.0: USB Mass Storage device detected<br />
[14667.692936] scsi7 : usb-storage 6-1:1.0<br />
[14668.696482] scsi 7:0:0:0: Direct-Access TOSHIBA MK4309MAT G5.0 PQ: 0 ANSI: 0 CCS<br />
[14668.698461] sd 7:0:0:0: [sdd] 8452080 512-byte logical blocks: (4.32 GB/4.02 GiB)</blockquote>
</div>
<div>
(yes, it's a very, very crappy and old USB harddisk)</div>
<br />
<u><span style="font-size: large;">Proper user-interface, current lack thereof.</span></u><br />
<br />
To convert all this sysfs poking into a proper user-friendly software, one will have to...<br />
<br />
<ul>
<li>On computer startup, disable autoprobe (probably there's a kernel command line for that).</li>
<li>Statically configure the minimal interfaces used (e.g. the main usb keyboard, trackpad/mouse, ...).</li>
<li>During normal operation, watch hotplug-events or poll the sysfs filesystem for newly inserted usb devices.</li>
<li>Verify presented configurations of USB devices and their interfaces with a policy (e.g. enable only usb-storage devices, e.g. "thumbdrivers"</li>
<li>Ask the user, if he's happy with this device.</li>
<li>On successful verification, only bind the single necessary driver (e.g. usb-storage) to the proper interface of the device.</li>
</ul>
<br />
Of course, for certain devices more sophisticated verification schemes could be envisioned, checking certificates, downloading firmware for verification (which, again, might be forged, ...).<br />
<br /></div>
<div>
<u><span style="font-size: large;">The "Authorized" Mechanism</span></u></div>
<div>
<br /></div>
<div>
There's a second mechanism to disable/enable communication with USB device using the "authorized" property of USB controllers. It's described in the <a href="https://www.kernel.org/doc/Documentation/usb/authorization.txt" target="_blank">kernel documentation</a>.<br />
<br />
<u><span style="font-size: large;">Windows...</span></u><br />
<br />
There seems to be a <a href="http://technet.microsoft.com/de-de/library/cc731225(v=ws.10).aspx" target="_blank">group policy for that</a>... <strong style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">Local Computer Policy</strong><span style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">, </span><strong style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">Computer Configuration</strong><span style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">,</span><strong style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">Administrative Templates</strong><span style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">, </span><strong style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">System</strong><span style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">, </span><strong style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">Device Installation</strong><span style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">, and </span><strong style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;">Device Installation Restrictions</strong><br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com7tag:blogger.com,1999:blog-7098474.post-5306029161992752762014-03-24T10:39:00.000+00:002014-03-24T10:39:03.007+00:00Stairville DJ-X 16, voided my warrantyThe <a href="http://www.thomann.de/de/stairville_djx_16_dmx_controller.htm" target="_blank">DJ-X 16</a> is a very basic DMX controller, which I used to test out DMX controlled (d'uh...) LED lights. I cannot recommend it, it lacks a lot of features, and the buttons/faders have a very flimsy feeling. Nevertheless: Because I was pondering if it was worthwhile to modify its firmware, I decided to void the warranty (yeah!) and here are few pictures documenting the insides of this device.<br />
<br />
What I found pretty interesting is the fact that, even though I bought it new only a few months ago, and it's still being manufactured exactly like that, it uses pretty antique components, and is an all-through-hole PCB, not a single SMD to be found.<br />
<br />
The main controller is a Atmel <a href="http://www.atmel.com/devices/at89c55wd.aspx" target="_blank">AT89C55WD</a>, a <a href="http://en.wikipedia.org/wiki/Intel_MCS-51" target="_blank">8051</a> compatible 8-bit microcontroller. It's meagre 256 bytes of internal RAM is extended by <a href="http://www.google.com/search?q=Goldstar+GM76C88" target="_blank">8k of High-Speed (120ns...)</a> SRAM. A 29EE010 EEPROM takes care of the 8051's lack of long-term memory. Everything else is 80s-style design, with a lot of 47hc's.<br />
<br />
There's a second, smaller, PCB which is home of the SN57176 RS485 driver/receiver, an optocoupler (MIDI out/through), connectors and a 7805 voltage regulator. The flat-ribbon cable connecting this connection-PCB to the main board is nicely labeled on the silkscreen, very convenient.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">K1 1 2 COM</span><br />
<span style="font-family: Courier New, Courier, monospace;">K2 3 4 Audio2</span><br />
<span style="font-family: Courier New, Courier, monospace;">K3 5 6 Audio1</span><br />
<span style="font-family: Courier New, Courier, monospace;">k5 7 8 MIDI in</span><br />
<span style="font-family: Courier New, Courier, monospace;">+5V 9 10 +5V</span><br />
<span style="font-family: Courier New, Courier, monospace;">NC 11 12 MIDI through</span><br />
<span style="font-family: Courier New, Courier, monospace;">GND 13 14 GND</span><br />
<span style="font-family: Courier New, Courier, monospace;">+5V 15 16 +5V</span><br />
<span style="font-family: Courier New, Courier, monospace;">NC 17 18 DMX out</span><br />
<span style="font-family: Courier New, Courier, monospace;">+12V 19 20 +12V</span><br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/RjpZXhsw8yEoiLO7azB2BdMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="83" src="https://lh5.googleusercontent.com/-D9EnHbW9vqs/UzAE6mP6nwI/AAAAAAAAEEg/eL80wLScjaQ/s144/2014-03-24-stairville-dj-x-16-frontpanel.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/gRDnxs3831dTbwNGBkNYXNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="62" src="https://lh3.googleusercontent.com/-VGiUNakT4dk/UzAE7oKYdgI/AAAAAAAAEEo/R0qfMtwcmOM/s144/2014-03-24-stairville-dj-x-16-pcb-component-side-with-labels.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/y6jX1OGvMCTqvDarpDLOtNMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="67" src="https://lh5.googleusercontent.com/-DDg8-WcD49w/UzAE7_UNjtI/AAAAAAAAEEw/ptmREeXFh_c/s144/2014-03-24-stairville-dj-x-16-pcb-solder-side.jpg" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-2642776507422517822014-03-09T19:34:00.000+00:002014-03-09T19:34:25.051+00:00Playing with a AM2302 Temperature/Humidity Sensor & LUFAI played around with a <a href="https://www.google.de/search?q=Adsong+AM2302" target="_blank">Adsong AM2302</a> Temperature/Humidity sensor today which has a pretty neat serial interface.<br />
<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://picasaweb.google.com/lh/photo/Pdz8XV93-rj2oJFjBCbxqtMTjNZETYmyPJy0liipFm0?feat=embedwebsite"><img height="34" src="https://lh5.googleusercontent.com/-rkrd5RHiWS4/UxzAUXszFdI/AAAAAAAAECI/R__VsMYFnEQ/s144/am2302_reading_saleae_logic.png" width="144" /></a></td></tr>
<tr><td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;">From <a href="https://picasaweb.google.com/102970072923818524447/ChrisMiscellanea?authuser=0&feat=embedwebsite">Chris’ Miscellanea</a></td></tr>
</tbody></table>
<br />
I <a href="https://github.com/vogelchr/vserial-am2302" target="_blank">wrote some code</a> to read in the data using the input-capture mode of the Timer/Counter1 in a AVR ATmega32u4 (way overpowered, but it's handy on a <a href="https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-32U4/open-source-hardware" target="_blank">Olimexino 32U4</a> board) to learn about using the LUFA USB library a little, maybe someone can put it to actual use?<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ cu -l ttyACM0</span><br />
<span style="font-family: Courier New, Courier, monospace;">Connected.</span><br />
<span style="font-family: Courier New, Courier, monospace;">Triggering conversion.<br />AS2302 raw bytes: recv cnt=0 01 76 00 fa 71</span><br />
<span style="font-family: Courier New, Courier, monospace;">status: 0, temp=250 (*0.1 dC), rh=374 (*0.1%)</span><br />
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com0tag:blogger.com,1999:blog-7098474.post-79665175950466402082014-03-06T16:54:00.000+00:002014-03-06T17:08:41.939+00:00Get /dev/spidev on an Raspberrypi running under Archlinux ARM working again.Currently, when running a raspberry-pi with the l<a href="https://github.com/archlinuxarm/PKGBUILDs/tree/master/core/linux-raspberrypi-latest" target="_blank">atest kernel available for Archlinux</a>, access to the SPI bus via <a href="https://www.kernel.org/doc/Documentation/spi/spidev" target="_blank">/dev/spidev</a> no longer works. <a href="http://www.google.com/search?q=raspberrypi+archlinux+spidev" target="_blank">Bugs have been filed</a>, but apparently the late-binding logic available via <a href="https://github.com/raspberrypi/linux/blob/rpi-3.10.y/arch/arm/mach-bcm2708/bcm2708.c#L842" target="_blank">spi_register_board_info</a> just seems to be broken right now.<br />
<br />
I've written a small kernel module that doesn't fix the initial bug, but just does the binding of spidev to the first two chipselects of the first spi master. It's <a href="https://github.com/vogelchr/rpi_add_spidev_module" target="_blank">available on github.</a><br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><b>$ ls -la /dev/spidev*</b></span><br />
<span style="font-family: Courier New, Courier, monospace;">zsh: no matches found: /dev/spidev*</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>$ sudo insmod rpi_add_spidev_module/rpi_add_spidev_module.ko </b></span><br />
<div>
<b style="font-family: 'Courier New', Courier, monospace;"><br /></b></div>
<div>
<b style="font-family: 'Courier New', Courier, monospace;">$ dmesg</b></div>
<span style="font-family: inherit;"><i>(...)</i></span><br />
<span style="font-family: Courier New, Courier, monospace;">[ 245.299487] spi_master spi0: ...is the master for device #0.</span><br />
<span style="font-family: Courier New, Courier, monospace;">[ 245.299709] spi spi0.0: ...is the device #0.</span><br />
<span style="font-family: Courier New, Courier, monospace;">[ 245.299734] spi_master spi0: ...is the master for device #1.</span><br />
<span style="font-family: Courier New, Courier, monospace;">[ 245.304763] spi spi0.1: ...is the device #1.</span><br />
<div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b>$ ls -la /dev/spidev0.*</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">crw------- 1 root root 153, 0 Mar 6 16:47 /dev/spidev0.0</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">crw------- 1 root root 153, 1 Mar 6 16:47 /dev/spidev0.1</span></div>
</div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b># cd /sys/bus/spi/drivers/spidev</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b># ls -l</b></span><br />
<span style="font-family: Courier New, Courier, monospace;">total 0</span><br />
<span style="font-family: Courier New, Courier, monospace;">--w------- 1 root root 4096 Jan 1 00:03 bind</span><br />
<span style="font-family: Courier New, Courier, monospace;">lrwxrwxrwx 1 root root 0 Jan 1 00:02 module -> ../../../../module/spidev</span><br />
<span style="font-family: Courier New, Courier, monospace;">lrwxrwxrwx 1 root root 0 Jan 1 00:03 spi0.0 -> ../../../../devices/platform/bcm2708_spi.0/spi_master/spi0/spi0.0</span><br />
<span style="font-family: Courier New, Courier, monospace;">lrwxrwxrwx 1 root root 0 Jan 1 00:02 spi0.1 -> ../../../../devices/platform/bcm2708_spi.0/spi_master/spi0/spi0.1</span><br />
<span style="font-family: Courier New, Courier, monospace;">--w------- 1 root root 4096 Jan 1 00:00 uevent</span><br />
<span style="font-family: Courier New, Courier, monospace;">--w------- 1 root root 4096 Jan 1 00:02 unbind</span><br />
<div>
<br /></div>
Using software to talk to a proprietary SPI gyro/accelerometer module works again.</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b>$ sudo ./rpi_gyro /dev/null</b> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Opened gpio25 direction as fd 5.</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Opened gpio25 value as fd 6.</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Opened /dev/spidev0.0 as fd 7 (0x03, 8, 0).</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Opened /dev/spidev0.1 as fd 8 (0x03, 8, 0).</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">lsm330dlc_dump_regs: dumping accelerometer registers.</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$00: $00 $00 $00 $00 $00 $00 $00 $ff</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$08: $00 $00 $00 $00 $00 $00 $00 $33</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$10: $86 $16 $a6 $26 $48 $25 $21 $1e</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$18: $1b $a3 $50 $65 $c0 $00 $50 $00</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$20: $27 $00 $00 $80 $40 $00 $00 $ff</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$28: $00 $2d $c0 $01 $40 $27 $80 $9e</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$30: $00 $00 $00 $00 $00 $00 $00 $00</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$38: $00 $00 $00 $00 $00 $00 $00 $00</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">lsm330dlc_dump_regs: dumping gyro registers.</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$00: $d3 $66 $a8 $cc $4d $d0 $11 $f1</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$08: $20 $06 $ff $18 $02 $83 $00 $d3</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$10: $90 $2b $19 $44 $0c $e0 $61 $60</span></div>
</div>
<div>
<i>(...)</i></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/12629131958615141514noreply@blogger.com4