Achievement unlocked – OpenWRT device porting – and a quick and dirty level conversion

Apr 26 2013

Porting a Linux Router

So I just posted what I hope this time are properly formatted patches to the OpenWRT developers mailing list, a set of patches that add support to OpenWRT for the D-link DIR-632-A1 router.

You can see some of my progression on the OpenWRT forum.

This was quite a bit of a journey, as I had a few false starts and along the way crossed a number of different areas in the Linux kernel. The best thing was debugging bit-banging of device registers, which reminds me of hacking on my Commodore 64 many years ago. I have of course had occasion to do such at times professionally, but I have rediscovered my desire to do more low level hacking, and having recently received a Raspberry Pi as a gift and finding use for my leostick from the 2012 linux conf I expect to have plenty of opportunity when I manage to find some more spare time.

Along the way I extended significantly my knowledge of how to work with OpenWRT and build customised images, etc. I added a build guide for this router to the wiki pending acceptance of patches into the main stream; I think this cuts through the useful but verbose documentation elsewhere in the wiki.

When you need a USB-TTL RS232…

and you live 45m from Jaycar, and its 9pm Friday night anyway and you certainly don’t want to wit 3days for Internet delivery from your friendly Aussie electronics suppliers (hello Core electronics!) or a month for some Chinese no-brand on ebay… and you want to hack now!

A crucial part of hacking a router is access to the serial port.  These are always at logic level, and in the case of the DIR-632 at 3v3 not 5V, further complicating things.  However all I had handy was a USB-RS232 dongle running at proper RS-232 levels, of +/- 12V – so connecting this would be sure to let the smoke out of something…

Now it turns out I have a shedful of what most people would term junk.  But usefully this included a tube of MAX232 chips I acquired some years ago.  So first, find a handful of resistors and capacitors, and a birdnest later, one logic level to RS232 converter:

nest

There is a leostick there, but it is being used to provide 5V :-) Originally I attempted to use it as a serial relay, but apparently there is a bug in the firmware in the model I have that causes problems with the d0/d1 serial port and thus all I could ever see was junk… (thanks to MarkJ for letting me know)

The circuit is basically as described here (1), but I used 2x 2u2 capactitors in parallel, not having enough 1uF (* I really get into going the whole bush-mechanic-electronics thing!)

However, this doesnt fix the whole problem – the MAX232 is powered by 5V, although I also later found out it may have worked at 3v3 anyway.

I suspect many of the younger maker crowd might not be aware of some trick that can be employed when necessary: you can of course buy a 2cm sized 3v3 to 5v level converter form Jaycar, or from China on ebay, but again I didnt want to wait, and I had a pile of BC547 transistors handy and basic knoweldge of how logic circuits are actually built.

Thus, two transistors and a few resistors later, a logic level converter:

              -+-----------------+- 5V
               |                 |
               |                 Z
               |                 Z
               |                 Z
               |                 Z        __
               |                 |     __|  |__
               Z                 |
               Z                 +--------->
     __        Z   __    __      |
  __|  |__     Z     |__|      | /
               |               |/
               +----/\/\/\-----|
               |               |\
             | /               | \
     4k7     |/                  V
---/\/\/\----|                   |
             |\                  |
             | \                 |
               v                 |
               |                 |
               +-----------------+
               |
               |
             --+--
              ---
               -

(ASCII art FTW!)

Going he other way, I just ran three signal 1N4148 diodes in series, this dropped the line to about 3v5 which managed to not blow anything up with!

 

And several rather late nights^H^H^H early mornings later:

Links:

(1) http://www.scienceprog.com/alternatives-of-max232-in-low-budget-projects

No responses yet

Yellowstone YSE300 7″ 4GB EReader (aka AudioSonic ASEET001K)

Apr 01 2013

(This is a late night blog entry ‘get it down before it gets forgotten’, mainly in case it is of use to someone, so please excuse the untidyness!)

I had noticed these for some time at JB HiFi for $59 but ignored them, being not touch screen and
not wanting to waste the money for what seemed to be an underwhelming device I didnt need.
However I was browsing the other day and they were 20% off that, so in a ‘what the hell’ moment
I purchased one to experiment with.

First Impressions

The feature list on paper seems reasonable, for some definition of reasonable. At least, compared to what the average Joe would be paying at least $100 for to a walk out the shop with an android device or a Kobo, etc.

The device is TFT LCD 800×480 resolution in 15:9 widescreen with headphone socket, micro USB for charging / connectivity, and is not touch screen, but button driven.

It runs a custom firmware, with MP3 player, video player, calendar, calculator, voice recorder,
and e-reader.  I have only tested the e-reader using PDF, and the photo viewer and MP# player.
The device is recommended to work with the Adobe e-reader Windows software and support DRM’d
ebooks but I didnt test with that.  It has a TF (mini-sdcard) slot.

In Use

In practice when reading a PDF I found it to be significantly sluggish at
rendering the pages.  The rendering quality of the fonts found me struggling to read late
at night as well.  The test book I used was the free download edition
of “Hacking the X/Box” (http://boingboing.net/2013/03/11/hacking-the-xbox-free-in-hono.html) by Bunnie Huang,  who was a keynote speaker at LCA2013.
He released for free as a tribute to Aaron Swartz, and I found it quite the suitable choice to
read whilst attempting to work out if this device was itself hackable in any way.

Pages with pictures could take several seconds to render, which is something I havent
noticed when using the no-brand $65 Android tablet I purchased from ebay for my kids to use.

On the upside, it competently does photo-frame, and the MP3 playback with a choice of equalisers.
It also supports voice record, video play, FM radio calculator and calendar, I didnt bother trying these.
So the list of upsides is quite short.

The UI however is average, and the physical interface downright woeful.  There is a lot of lag responding to button presses.  The poor quality is most noticeable with MP3, all the buttons seemed to just seek tracks and I couldn’t work out how to control the volume!  According to the manual, ‘up’ and ‘down’ (as one might expect)
should control the volume, but it is difficult to do just this without pressing the central
(ok)  button at the same time unless you are very careful.
And the usual response to the wrong button is to restart the current song…

The player played music without headphones but at a very low volume.

Can it be hacked?

The intent of my experiment was to try an alternative firmware, such as found at sites like rockbox.org.

Inside, there are three chips, an RK2738 SOC (ARM), and a FLASH and a RAM.  However, it seems the RK2738 is a somewhat underwhelming device from a hackability perspective: initial google searching returned a dearth of information.

The Yellowstone / Audiosonic has no firmware tool on an website relatad to either JB or Kmart or either search term.
I did find a RK27 SDK I could download, and multitude  of firmware loaders.  But none worked!
In theory the device can be switched into a service mode mode where system partitions become accessible, this would allow the ROM to be dumped, etc.
But none of the suggested  methods worked.
First method – write a zero length ‘tag’ file in the root directory, and reboot.  I tried a variety of
combinations seen on various forums for similar devices, to no avail. (Example: http://forums.rockbox.org/index.php?topic=34081.0 )
Second method – try the firmware tools of various other devices based on the RK2738, but the tools that actually detected the device as a RockChip require it to be in the system mode.

Going by the SDK and some forum posts, it should be possible to switch to system mode by sending
a specially crafted SCSI command (being a mass storage device, SCSI protocol is used over USB.)
But this approach also failed.

Further research on the RK2738 hinted as to whether rockbox (or even some Linux) might work, but
I can’t experiment until I can get it into system mode. It seems the RK2808 or upwards is needed for Android, so I might be left with RockBox:  http://www.rockbox.org/wiki/Rockchip27xxPort

The only thing I have left to try, as ‘reboot’ has some ambiguity, is to disconnect the battery and
do a true cold reboot, to see if any of the tag files might have an effect.
Failing this, you can short pins on the ROM.  Life however leaves me no time to waste on the above, so this has now turned into yet another rainy day project.

Of note, the device looks identical to the Audiosonic Ereader marketed by Kmart. (http://www.e3style.com/general/eReaders/Audiosonic/ASEET001K-UM_V4_24Aug2012.pdf)

Otherwise, it will have to do duty as a e-reader (until I get sick of the rendering)
media player ( for which I already have my phone for mp3) and higher resolution photo viewer.

A starting point to a lot of information about similar RK devices can be found at http://dtbnguyen.blogspot.com.au/2012/07/if-only-reading-were-easier.html

No responses yet

Quick Tip – Legacy Skype on Debian Squeeze

Feb 28 2013

The trick to making the webcam work:

 LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so /usr/bin/skype

This assumes of course you have the various ia32- and lib32- packages installed.

This is with a skype 2.2.0.35 deb I made a couple of computer builds ago, so YMMV.

With thanks to: http://community.linuxmint.com/tutorial/view/219

 

No responses yet

LCA2013 Wrap(-ish) – slides for my talk

Feb 04 2013

Well I am home again.  I spent about 15 hours on the road including breaks, and actually somewhat enjoyed the trip.  I actually would have liked to have taken a couple of days and spend a bit more time enjoying the scenery and stops but I had the feeling our children were driving my poor wife crazy after 8 days away so I  had to keep on moving.

I could have done it in about 12-13 hours, but the breaks are necessary.  There is ample evidence along the side of the Sturt Highway between Hay and Balranald as to why this is so (see picture.)  I am also glad I did this stretch late morning, it would have been a struggle late evening especially after such an intense week.

Shows burned out car on side of road on Sturt Highway

At Wagga Wagga there is a RAAF base, which had a museum out the front.

Antique RAAF jet fighter

Some things were a bit funnier:

t1

Anyway, it was a long trip.

I have uploaded the slides for my Open Programming Miniconf talk, Reducing Bugs with Boost/Test, here.

I am rather tired, and I still have unfinished homework from the conference I really should do this week, so I may or may not blog more about the conference a bit later.  For those who attended my talk, I thank you and hope you found it of some use.

No responses yet

Linux.conf.au days 2-4 (well, sort of)

Jan 31 2013

So as it of course turned out I was way too busy enjoying the conference and in the small remaining time too much in need of the sleep I am not getting enough of to blog…

 

suffice to say this has yet again been just another awesome experience

 

must go to bed, early start tomorrow morning…

No responses yet

Older posts »