Skip to main content


Showing posts from 2015

Ethernet Funnies

Sometimes it is very hard to connect to an embedded system, because the designers cut some corners to simplify the system and keep memory use down, or simply because the system is prehistoric and full of bugs. One such device worked fine provided that there was a little ethernet switch between the laptop machine and the target, but a direct connection between the laptop machine and target device only worked about half the time.  Even the little switch sometimes could not connect. MAC, PHY, MAG An ethernet interface device consists of three main parts: The Media Access Controller (MAC), the Physical Interface (PHY) and a set of transformers - the Magnetics.  When you plug a cable in, the PHY sends out little pulses to figure out what is going on and then swaps the wires around internally and changes the speed and duplex settings to make the interface work. The trouble was that the target only supports 100 Mbps, while the laptop machine wanted to run at 1 Gbps and the two just c

Compile The Latest ffplay From Source

Compile latest version of ffplay from source Note that this script doesn't overwrite the existing ffmpeg installation: The gotcha in the above guide is the SDL-devel package without which ffplay will not build. #! /bin/bash yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel SDL-devel mkdir ~/ffmpeg_sources cd ~/ffmpeg_sources git clone --depth 1 git:// cd yasm autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install make distclean cd ~/ffmpeg_sources git clone --depth 1 git:// cd x264 PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static make make install make distclean cd ~/ffmpeg_sources hg clone cd ~/ff

Windows Insanity

Unsolicited Advertisements To add insult to injury, Microsoft Windows 10 now displays advertisements right in the File Explorer.  I'll leave it to you to figure out why that is a very bad security problem.   Rusted Sieve Windows 10 is about as secure as a rusted sieve, with a few deliberate holes poked in it for good measure.  Microsoft essentially tries to convert your Personal Computer into a cell phone, which is a purpose built blabbing and tracking device.  They don't seem to understand the word 'personal' in 'PC' though. Examples of data we collect include your name, email address, preferences and interests; browsing, search and file history; phone call and SMS data ; device configuration and sensor data; and application usage. Recently, the Diagnostics Tracking Service (DiagTrac

Dropbear - Embedded SSH Daemonology

A Bear of Very Little Brain The name Dropbear is intriguing since it makes me think of grizzlies and gummy bears. Real Aussies know that a Drop Bear is a carnivorous marsupial with a particular taste for foreign hikers .  I love sugar - who doesn't - but I should not eat it anymore.  I found that cinnamon makes a good substitute in most things, but I digress, this is not supposed to be a treatise on sugary treats or scary marsupials. The Dropbear SSH daemon can be compiled with various options, but when one is faced with an existing system that cannot easily be changed, then one has to make do with what one got. I was trying to download log files and video off an ARM based system and it took forever.  So I experimented with the SSH encryption and compression options to speed it up.  Since a typical embedded system has a dinky little processor, selecting a simpler encryption algorithm can make a huge difference. AES vs Blowfish The standard copy command "scp user@ta

Nothing to Fear

Armand Jean du Plessis, Cardinal-Duke of Richelieu and Fronsac, 17th century Prime Minister of France, reputedly said something to the effect of: "Give me six lines written by an honest man and I will find something in it to hang him with". There are probably many things he said, that he didn't say, but it is a nice quote. Beware of a Man in a Dress The French encrypted communications up to the early 19th century, using simple ciphers known as petits chiffres . These were short notes, based on 50 numbers. Later, they began to write letters using a combination of 150 numbers, known as the Army of Portugal Code.  By 1812, new cipher tables were sent from Paris based on 1400 numbers and derived from a mid-18th century diplomatic code.  18th Century Paris Cipher Many people think that 'If you have nothing to hide, then you have nothing to fear' , or simply state 'I have nothing

Reading and Parsing Data from Serial Ports

Read, Echo, Octal Dump, Head, Cat, Chat and Serial Ports Anyone who tried to parse data from a serial port in a Bash script will have run into trouble really quickly.  This post explores a few different methods. Some people prefer using minicom and expect , others just want to read a prompt from an embedded target such as an Arduino and send it a file without spending too much time on learning new tricks.  The best way to do it is the way that works for you! Rather than fighting with an actual serial port ( /dev/ttyUSB0 ), most of these examples use echo and pipes to send binary and ASCII data to a parsing utility to show what it does and how to use it. In a nut shell, if you need to parse human readable ASCII data, use read .  If you have to parse unreadable binary data, use od or head .  If it has to be very fast, use cat .  Read has a built-in timeout that you can use to keep it from getting stuck waiting forever.  The others, you have to kill with a timer when

Zenity Progress Dialogue

Zenity is a nice and simple way to prettify Bash scripts, similar to kdialog, xdialog and a few others, but on the whole I think the best of the lot.  Though there is nothing preventing you from mixing them up if one has a feature that would be more useful for something. I started using Zenity years ago, when there wasn't much documentation and consequently didn't use the progress dialogue the right way.  The result being that some scripts eventually broke.  For example, there was no information on how to make the progress bar progress - so I only used the whirr-whirr pulsate effect. No Progress In the past, I simply started a pulsater, pushed it into the background, saved the PID and later killed it when necessary, like this: zenity --progress & PID=$! echo "Do something" kill $PID That used to worked fine, but recently on Fedora 22, it just sits there and does nothing.  It won't even blink.  Dead as a doornail.  Bah, humbug... When All Else

Version Control For Scripts

Running a full blown version control system such as subversion or CVS for Bash scripts is a bit of overkill.  Most people don't use any version control at all on scripts and revert back to the ancient way of saving multiple copies of the files. The inevitable result is a mess of files called script1, script2, script.ok, script.bad ... and then after a few days, you cannot remember which is which. Fortunately, there is an ancient, light weight versioning system that is very easy to set up and which is perfect for the single user case: RCS . Setup RCS It is probably already installed (try whereis rcs ), otherwise do: # yum install rcs In your script directory, make a directory to keep the archives: $ mkdir RCS Edit each script and add the $Id$ keyword to the top, right underneath the familiar #! /bin/bash command: #! /bin/bash #$Id$ That will substitute your name, date, time and version number of the file upon checkout, so you always know which version of the scr

If It Is Free, Take Two... Aspirin

Updates - Untracking Tools I was wondering when privacy enhancing utilities would be come available. Here is the first one: the second one: and the third one: I still think that the only secure way to use Windows 7, 8 and 10 is in a virtual machine with networking disabled.  The trouble is that you cannot stop encrypted tunnels with deep packet inspection in a router, so you have to unplug the network cable so to speak. The only real solution is UNIX - buy a Mac, install Linux Fedora or PC-BSD.  Anything else is futile. Free Candy There are many an old proverb about free stuff, but the latest action by Microsoft takes the cake. Even people who declined the free Windows 10 upgrade, will now also have this bloated piggy forced down their throats: It is one thing sending out free

UAE Visa Renewal and Car Selling Red Tape

Latest Visa Renewal Process in Al Ain - 2020 Go to SEHA Immigrant Screening Centre opposite Al Ain Hospital. Hours: 7 am till 3 pm, Sun - Thu You have three choices: Go with the enormous crowd gathered under the palm trees... Take the Fast Track - limited numbers - be there early VIP service Hmm... VIP Medical Service Go in the main front entrance and go upstairs.  Walk through the Fast Track men's waiting room to the VIP waiting section.   There is a tiny little VIP sign above the door. There will be almost nobody, so the service is immediate. You'll be done in about 20 minutes. You need: Passport and passport copies (first 4 pages plus visa) Cost: Dh500 (that is why there is almost nobody, but it is worth it) In before 10h00, get results by 2 pm the same day (someone else may pick up with the receipt) You need to get a blood test (no fasting) and a chest X-ray They will send you a SMS when they are done around 1 pm - be there at 2 pm. More info h

Audio Networking with Sox and Netcat

Sox + Netcat = VoIP The idea is to hook the sound devices on two machines together so that there is a bidirectional intercom between them.  This way, you can have an amateur SSB radio hooked to a distant computer in your radio shack and a headset on a local computer in your living room and do VoIP with the remote radio transceiver over your LAN. I noticed that there is a steady stream of people reading this post.  Please note that Sox with CVSD and netcat will work fine and consume very little processing time on a tiny ARM embedded system, but gstreamer with raw audio over UDP may be a better choice if you have a half decent system on both ends of the link and want the best quality audio.  Therefore, do look into gstreamer also. For a remote ham radio, the main thing missing, is the PTT switch, which one can do with another netcat proxy to the serial control port of the transceiver and radio control software running locally to set the channel and key the radio. For streaming,

Mac Backups With Rsync to Encrypted Flash Media

Backup Woes The main advantage of using a Mac is that it defaults to idiot mode and the main annoyance with a Mac is that it defaults to idiot mode, but underneath it all there is BSD... The Mac Time Machine backup utility is one such idiot application which is probably fine for a large number of people,  but which doesn't fit my usage scenario.  Coupled with the Disk Utility which makes it hard to format a Flash Memory Device properly, it is even worse. I want to make backups to USB and SD memory devices, since they are small, solid state and convenient.  However, to make a proper backup, the device should be formatted with HFS+ and it must be Encrypted.  The Disk Utility defaults to the prehistoric FAT in order to support file exchange with legacy Windows machines and FAT doesn't support proper file ownership and permissions . Also, it is rather self defeating if your HDD is encrypted, while your backups are in plain text on a FAT disk. Format a Removable Disk wi

An Angel Dancing On a Pin Head

Magic Eye Indicators As a little child, I found the green angel wings indicator on my parent's Philips radiogram fascinating.  I sat and watched and wondered how it worked each time we played a record. So, let's add a little dancing angel to my 20 Watt audio guitar amplifier: Why the blazes does it take three obscure keys ( Cmd, Shift, 4 ) to do a screen grab on a Mac?   Whoever thought that up needs to get three lashes with a wet noodle. You can get your own dancing angel from Tubes Store in Chelyabinsk : Basically, it is a miniature cathode ray tube with a curved zinc sulphide fluorescent screen.  The electron beam is deflected by an electrostatic target in front of the screen, powered by a built-in triode amplifier, so everything you need (minus the PSU) comes in one convenient glass package.  Some indicators are viewed end on makin