Skip to main content

Posts

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 t...

Compile The Latest ffplay From Source

Compile latest version of ffplay from source Note that this script doesn't overwrite the existing ffmpeg installation: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos 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://github.com/yasm/yasm.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://git.videolan.org/x264 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 https://bitbucket.org/multicoreware/x265 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. https://answers.microsoft.com/en-us/windows/forum/windows8_1-update/what-is-diagnostics-tracking-service-which-was/253fe2ec-fba6-4240-bfb8-2a3bdc801ed1?auth=1 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 "s...

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 ha...

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 Al...