Hacking devices can/will void your warranty and can turn your expensive consumer electronics into worthless trash if you don't know what you're doing. This blog is for information purposes only, and if you try to hack into your own consumer electronics, you do so at your own risk. The device I'm currently hacking is the Canon SX10 IS camera.

Saturday, October 24, 2009

Organization, and yet another toolchain (conceptronic / media giant)

Organization. I have two external 1 TB drives with ISOs and I've moved all of my stuff off of the screenplay so I can experiment with it. In the process, I decided to switch back to EXT3 for the screenplay. The screenplayprohd.wikia.com wiki details how to do that in filesystem. Anyway, after reformatting the drive, I then organized all of the videos on the other two drives under one directory called Alphabetical, and then subdirectories from there ABC, DEF, GHI, JKL, and so on with VWXYZ all in the same. So both external drives had that. Underneath each of those directories, I put another directory for each movie / group of movies. For instance, all of the Star Wars ISOs are under Alphabetical/STU/Star Wars.
On the Screenplay, I setup a small, hidden script in the root directory that removes the contents of the Alphabetical directory and recreates the same directory structure as on the USB drives. So it's a mirror image, but empty. Then I use symbolic links to link the contents of each of the USB drives. I do it this way because if you do a symbolic link of an ISO file, the screenplay can't mount and play it.
So here's the script:

cd Alphabetical
rm -r *
mkdir ABC
mkdir DEF
mkdir GHI
mkdir JKL
mkdir MNO
mkdir PQR
mkdir STU
mkdir VWXYZ
ln -s /tmp/usbmounts/sda1/Alphabetical/ABC/* ABC &
ln -s /tmp/usbmounts/sda1/Alphabetical/DEF/* DEF &
ln -s /tmp/usbmounts/sda1/Alphabetical/GHI/* GHI &
ln -s /tmp/usbmounts/sda1/Alphabetical/JKL/* JKL &
ln -s /tmp/usbmounts/sda1/Alphabetical/MNO/* MNO &
ln -s /tmp/usbmounts/sda1/Alphabetical/PQR/* PQR &
ln -s /tmp/usbmounts/sda1/Alphabetical/STU/* STU &
ln -s /tmp/usbmounts/sda1/Alphabetical/VWXYZ/* VWXYZ &

ln -s /tmp/usbmounts/sdb1/Alphabetical/ABC/* ABC &
ln -s /tmp/usbmounts/sdb1/Alphabetical/DEF/* DEF &
ln -s /tmp/usbmounts/sdb1/Alphabetical/GHI/* GHI &
ln -s /tmp/usbmounts/sdb1/Alphabetical/JKL/* JKL &
ln -s /tmp/usbmounts/sdb1/Alphabetical/MNO/* MNO &
ln -s /tmp/usbmounts/sdb1/Alphabetical/PQR/* PQR &
ln -s /tmp/usbmounts/sdb1/Alphabetical/STU/* STU &
ln -s /tmp/usbmounts/sdb1/Alphabetical/VWXYZ/* VWXYZ &


I know that's ugly and I could have used a for statement on it. But this follows a script I am making that I'm not ready to divulge yet.

The result of that is that all of my movies appear on the main drive and I don't have to guess as to which USB drive has the movie. I just navigate to the screenplay (now automatically done during bootup, as explained in my last post). It has vastly simplied finding any of the more than 250 movies in my collection. Next, I'm going to try to add some dvd covers in some way so that the kids can browse all of the covers when just looking for a movie to view. I'll probably just put all of them in a single directory, maybe 8 to a JPG and add some background music to the folder...

Media Giant Now that I've finally gotten some time on my hands, I pulled down Fedora 11 virtual machine (from vmware appliances, I used the LinHost one
Then I pulled down the conceptronic GPL sources. 2.00.004 linux one is corrupt, so I used the 1.00.011 sources. Copied them onto the virtual machine (I put them in a windows shared directory and just accessed it from the VM).
Although the instructions are there in the readme for the doing the kernel and the app, the instructions did not work exactly as indicated. First, you need GCC. But not just any GCC. If you do a yum gcc command you'll end up with the latest stable gcc, and that won't compile the OS. Instead, I've found you have to pull down gcc 3.4.6. Do yum install compat-gcc34. Of course, you have to do this under su mode. sudo should work, but I just did su and I'm doing everything under that mode (I know, I know, bad idea).
Now at that point, you're going to have a gcc34 in the /usr/bin, but still no gcc, so you'll still get an error about compiling. I created a symlink to gcc ln -s /usr/bin/gcc34 /usr/bin/gcc and then followed the rest of the directions. When I was finished, I had a full image of everything, app included.

I haven't tried flashing the image in. Instead, I searched for DvdPlayer and then copied that onto my ScreenPlay, along with the Resources and the symlinks of the two font files in the Resources directory. I executed a kill -9 95 (my root app proces from ps was 95) and then stopall. Switched over to the /tmp/hddmedia/mediagiant directory where I had put the other DvdPlayer and executed it.
It came up.
Unfortunately, it is in PAL mode, so I can't see the screen very clearly right now and it is not responding to keystrokes, remote codes,or anything else to allow me to switch it to NTSC. When I get a chance, I'm going to hook it to my HD TV and see if I can see it better. Although, without any way to control it, it's basically worthless to me. But I can see the "Grab 'n Go" interface, so I'm pretty happy that I've gotten this far with it. I ended up having do terminate the process, which left info on the screen even though the process was no longer running. When I ran a stopall, then the info cleared from the screen and I was able to restart the Iomega DvdPlayer version.

The ellion open source code posted at MHDWorld has the source necessary to rebuild and change the DvdPlayer app, so next step will be to get that one compiled with this environment and see if it comes up. If it does, this will probably be the start of a new interface.

Wednesday, October 21, 2009

Controlling the dvdplayer from an external program

Well, I figured out a couple of things today, my day off...

First, the RootApp. I figured out that it is required in order for the Power Off button to work. Otherwise, the unit does not shut down properly. This becomes critical with the second discovery...

In a prior post, Fun with the Player I detailed that you have telnet control over the screenplay if you launch the DvdPlayer program after executing a stopall. You can then send keypresses to remote control the screenplay. This trick was stopped in R1.8 firmware, although it still works if you kill -9 the RootApp process. The real trick is to get it to allow you to connect to some kind of key queue that you can fill up after the screenplay is booted.

For the ScreenPlay Pro, the /usr/local/etc has an rcS file that launches the DvdPlayer portion in conjunction with the RootApp. So, using a suggestion from jamoba posted to the emtec group back in february, I modified my rcS as follows:

if [ -f $DEFAULT_AP_DIR/DvdPlayer ] && [ -x $DEFAULT_AP_DIR/DvdPlayer ]; then
cd $DEFAULT_AP_DIR
if [ -f $DEFAULT_AP_DIR/RootApp ] && [ -x $DEFAULT_AP_DIR/RootApp ]; then
echo Running dvdplayer with RootApp
touch /tmp/command_sender.txt
tail -f /tmp/command_sender.txt | RootApp DvdPlayer -l on -o /var/log/dvdplayer/user_input&
else
echo Running dvdplayer
./DvdPlayer -l on -o /var/log/dvdplayer/user_input&
fi
else
/usr/local/etc/dvdplayer/script/run_tail
fi

sleep 10
cat /tmp_orig/startscript >> /tmp/command_sender.txt

So basically, I have a series of keypresses in the startscript file that it sends 10 seconds after launching the program, which is just about right. I can have the startscript read something like:

  XX 
(There's a single space before XX and a single space after)

To have it automatically go into the ScreenPlay drive and press down twice and select the folder or media at that location.

Now, if I wanted to send more keystrokes outside of the startscript, I can simply add to the /tmp/command_sender.txt by commands like "echo O >> command_sender.txt" to have it automatically shut down the screenplay. I can do this in a telnet prompt AFTER the screenplay has booted. Theoretically, I could write an http webpage that displays all of my movies, say in thumbnail mode, and if I select one, it could send the necessary prompts to the screenplay to automatically select and play the movie. It could even send the necessary prompts to launch the movie from a DVD menu. Or shut off the screenplay from a remote location.

There is a condition in which it won't run the script. This script will run each time the screenplay is powered on, but does not work if the screenplay is brought back from standby mode. If you shut off the screenplay with the remote, then any scheduled recordings you have will automatically boot up the screenplay. The screenplay is in Standby mode.

If you shut it down by holding down the power button on the front of the console, then it shuts off the power and you will miss any scheduled recordings. It is not in standby mode.

When you power up from standby mode, the "Iomega" logo does not appear during the boot process. That is one way you can identify that you are in standby mode. It also isn't going to run the rcS script, and thus won't run the startscript text file either.

Something else I discovered: If you telnet in, go into standby mode, then turn the screenplay back on, your telnet session will still be running. This is a symptom of it coming out of standby mode. All processes are still running. Thought it was interesting.

Thursday, September 24, 2009

Interface Update

I updated the wiki with new skins and a template for creating new skins.
http://screenplayprohd.wikia.com/wiki/Skins

The purpose of this blog is to explain how I did things, so here goes...
I created a grid.bmp file. It's actually in the template.zip if you want to see it. I used a special code to help identify the 100 / 200 / 300 / 400 / 500 / 600 point lines. The X in the grid boxes help to identify more specific points. By putting the grid into the background (giving it the name IMAGE_GUIDE_BG.bmp for instance) I was able to figure out the exact location of all of the other boxes on the screen. Then it was a matter of reconstructing that in layers through GIMP.

Playing around with the colors, I found that 0,0,0 was transparent on some of the images. I tried to take advantage of that fact, but quickly found out that most of the time you WANT the images to overwrite what was on the background before.

The Iomega Toys skin came from Superberny. It was similar to what I had been planning with a Disney theme. I decided to focus strictly on Mickey and found many resources on the web for getting Mickey pictures. I ended up having to modify most of them in one way or another. Mickey looks too fat on the TV. But I left it because, after all, TV does make you look too fat, right?

All kidding aside, I spent a lot of time trying to do the Mickey skin and toward the end got a little sloppy because I just wanted to get it done. There's a lot of graphics to replace if you want to match the whole theme.

I mentioned it many times on the interface page, but I'll say it again. You HAVE to save each and every bitmap out as R5G6B5 format or it will lock up the screenplay.

Kudos to SuperBerny for the initial work identifying the files to replace.

Sunday, August 23, 2009

Changing the theme

Credit where credit is due: the rtd1261.wikidot.com site contained the information about what format the graphics had to be saved in. And Superberny put together a package for IomTools that contained most of the graphic files necessary, which made it easier to identify.

So what I did was go through all of the BMP files on the drive and identify the purpose and where they appeared on the screenplay. This is to make it easier for other people to do custom themes by changing the graphics.

I documented it on the wiki:
http://screenplayprohd.wikia.com/wiki/Modifying_the_Interface

That will make it easier for people to change what has to be changed to match whatever theme. Now I need to figure out how I'm going to identify the locations that each of the overlays appear. But it's really late at night / really early in the morning, so I'm done for today.

Tuesday, August 11, 2009

Other hacks

I picked up a Canon SX10 IS camera to replace my outdated Canon PowerShot S30. I had hacked the Powershot S30, so I figured there might be something for the SX10. And there was: http://chdk.wikia.com contains a wealth of information for supplementing the existing firmware. I'm already using many of the features, including taking snapshots of lightning, displaying the battery power in %, the temperature of the lens, ccd, and battery compartments, the time displayed on the OSD, and the best thing: Removal of the hot/dead pixels. I had one set near the middle and it was very obvious in all of my pictures. I didn't want to return the camera for "possibly" getting a fix, and the firmware fixed it right up. If you have a canon camera, it's definitely worth checking into that hack. I'd love to say I had something to do with it, but all I've done is applied other people's work at this point.

Today, my laundry machine had some problems. I have a GE Harmony washer. Luckily, with a lot of research and a little bit of luck, I was able to determine a "test" mode for the washer. Push power on, then hold down on help and press start/stop. Then you can test out specific things like spin, fill cold, fill hot, drain, agitate, etc, overriding what the washer would normally do. There's another one that is similar, something like back and home at the same time. But it will actually make your washer reset. I had to use it once when my washer reported a problem while I was reassembling it. Oh, and common knowledge, but if you put a magnet near the front left side of the lid, there is a reed switch that triggers so that the laundry machine thinks that the lid is down. That way you can watch what is going on inside.

Trying to catch up with everything after my vacation, so hopefully I will be able to get back to the Screenplay soon.

Friday, June 12, 2009

New Buildroot / Toolchain

I have used the linux 2.6.12.6-VENUS code published by iomega https://iomega-eu-en.custhelp.com/cgi-bin/iomega_eu_en.cfg/php/enduser/std_adp.php?p_faqid=21578 and the uClibc from the raidsonic http://www.raidsonic.de/de/data/driver/firmware/IB-MP3010HW/Sources_RaidSonic.rar which is also an RTD player like the SPP.

Using these two sources has enabled me to make library files that are closer to what is on the Iomega device. Without Iomega's version of the uClibc, it'll take more work to get it to be exact.

These instructions are what is necessary to set up a complete cross compiling environment and using the buildroot to make your own toolchain. You can use the toolchain on the iomega device, or just use the buildroot to build whatever files you need.

All of the links to the new stuff will be at the bottom of this post. For those who want to try to recreate and maybe fix anything I did wrong, here's a set by step.

Prerequisites:
VMWare Player (I'm using version 2.5). It's free, but requires registration to download from http://vmware.com/products/player/
VMX Builder (free, google it. It is used to make the configuration files for vmware)
Ubuntu 8.04.1 (free, google it)

step 1, installing Ubuntu
Setup new virtual machine using VMX Builder.
Set at least a 20 GB hard drive, CD Player pointing to the Ubuntu 8.04.1 ISO, ethernet (amdlance, NAT)
and a reasonable amount of memory (1 Gig works well). Make sure target platform is Player 2.x, guest is Linux, and OS is Ubuntu.
Boot the virtual machine
Select to install Ubuntu.
Ubuntu will boot and if you don't see the Install screen within a few minutes, you probably didn't give it enough memory.
Login name: developer
Login password: root
Wait...twiddle thumbs...power nap
After reboot, click on the CD-ROM button to "take the CD out of the drive".
It will finally boot to the login screen. Login with your username and password you selected.
Select System>Preferences>Screen Resolution. You're going to need to increase it to at least 1024 x 768 to even make it useable.
This virtual Machine will take about 2 1/2 GB on your drive at this point.

step 2, Preparing the machine for development. Much of this comes from the gumstix wiki.
Select Applications>Accessories>Terminal
Confirm that you can connect to the network. ping your gateway, and ping www.google.com. Fix any network problems before continuing.
You should be able to run the update.

sudo apt-get update
(you will need to provide your password)

sudo apt-get install build-essential libncurses-dev bison flex texinfo zlib1g-dev gettext autoconf subversion wget samba git git-core

sudo dpkg-reconfigure dash
select no. This will uninstall dash.

now to get the buildroot source:

git clone git://opensphd.git.sourceforge.net/gitroot/opensphd/opensphd opensphd

(note: Edited 12/12/2009. On 8/25/2009, sourceforge modified the git repository capabilities which required an adjustment to the above git command. If it wasn't working for you before now, try again. It just needed an opensphd added to the end of it)

At this point, you will probably want to set up a share so you can easily transfer files from Windows to Ubuntu through a virtual network.
chmod 777 opensphd
sudo vi /etc/samba/smb.conf

You are now using vi. Search the web to find instructions on how to use vi, because you'll use it often.
Find the section called Share Definitions and add this
[opensphd]
comment = opensphd
path = /home/developer/opensphd
read only = no
guest ok = no


Now save that file.
sudo /etc/init.d/samba restart

sudo smbpasswd -a developer
and enter root for the password.

Now you can find out what your IP is using ifconfig and then browse that from the network. The netbios name will be something like developer-deskt if you used the user name as instructed above. Now you can start > run > \\192.168.6.133 (or whatever IP address was identified in ifconfig) and you should see the directory.

Now, back to Ubuntu. Switch to the buildroot directory.
cd ~/opensphd/buildroot

and make the config

make menuconfig

If this is your first time using the buildroot, then just select exit and save. Otherwise, feel free to select the additional packages you need.

now type:

make

and wait...a long time. It's going to take a few hours. It downloads each package needed and compiles it. The final result will be in the /opensphd/buildroot/binaries/uclibc/ and there will be a rootfs.mipsel.ext2 file, your toolchain.

Once you've built the toolchain, you can copy it to your screenplay drive and mount it and chroot to it. gcc works, but g++ stopped working on this version for some reason, so I didn't include it in the default menuconfig.

I would suggest doing development in the buildroot cross development environment. If it's one of the packages already included in the buildroot, then just go back into menuconfig and add it. Then make again and presto, it'll be in your toolchain file. It'll also be in one of the working directories on ubuntu, (project_build_mipsel/uclibc/root or something like that).

You should also be able to use the staging directory and do your own cross compiling. I'll detail that another day.

The uClibc had a few minor changes, which I added as a patch in the toolchain/uclibc directory. I also removed all of the .o and .a files from it, since it interferes with a good compile. Do not remove the .so files though. They are required for the build.

The Linux is also slightly modified. the mconf.c file had a reference to LC_ALL, which is normally defined in the locale.h (bits/locale.h) file. But that file isn't a part of the iomega published files, so I subsituted the actual value in. mconf.c is not a main part of the linux system anyway (I believe it's used for the menuconfig). I also removed all of the CVS/SVN and excess files to reduce the size from 150 MB down to 50 MB.

Oh yes, if you didn't notice, I have placed all of this on sourceforge as the opensphd (Open ScreenPlay Pro HD). Feel free to send me any patch files to improve the buildroot.

edit 4/26/2010: I have updated the files today. I figured out that the headers it was downloading were responsible from some of the problems. When I compared it with the conceptronic tools, I found that I could just use the unsanitized headers. This can easily be undone by deleting the linux-libc-headers-2.6.12.0.tar.bz2 file in the buildroot/dl directory. I also encountered the "mipsel-linux-objcopy missing" error discussed in the comments when I enabled initramfs. I was able to determine this was from the Makefile in the linux code that Iomega provided. it was not using the variables from Makefile so it would only find them if the staging_dir happened to be in your path. So I fixed that. The last thing I ran into was after g++ started compiling it then couldn't link on the device (worked fine from the PC staging directory but not on the ScreenPlay) because it was missing crt1.o and others. So I modified the scripts to copy those .o files as well when building the ext2 file.

Friday, May 29, 2009

Getting VSFTP working

In addition to getting SSH working that I just posted about, I also got VSFTP working.

The reason I chose VSFTP was because it was claimed that it was the fastest, or amongst the fastest of the FTP programs. I was not doing it for the ability to use SSL. The setup I describe here is NOT secure, as passwords are transmitted in clear text and susceptible to man-in-the-middle attacks. If you are interested in security, look at SSH. Also, look at the options for VSFTP. I didn't try SSL, so I don't know if it works. But you are welcome to try if security is more important than speed.

Speaking of speed, the fastest connection I was able to get out of it with a wifi was 1.3 MB/sec. Over wired it was 4.1 MB/sec down and 3.0 MB/sec up. So about the same speed as samba for transferring files over the same connection, maybe a little faster, but it was much faster than the BFTP found at RTD1261 wikidot, which clocked at around 500 MB/sec over wifi. Additionally, there is no 2 GB limit problem with VSFTP. I used FileZilla for my FTP transfer tests.

Setup is a little more complicated.

First, download the files: http://www.box.net/shared/68250x4psu

Again, I created the binaries from the new buildroot that I was able to create from the GPLed iomega source. I have a feeling this is what prevented my earlier efforts from working.

Once again, unzip the file into the root directory of the screenplay, preserving the directory structure. If you have previously run IomTools and had to do something like that before, then all you have to do is reboot the machine as the script will automatically run. If not, you will need to run the I10SetupVSFTP.sh script yourself.

When the script is finished, you will need to set up a new user.

The default user, ftp, is anonymous access and will provide read only access to the root of the ScreenPlay. This will automatically be set up for you. If you do not want to provide read only access to anonymous users, you will need to edit the /etc/vsftp/vsftp.conf file.

If you want write access to the drive, You will need to setup an account. You cannot use root unless you change root's home dir. I wouldn't suggest doing that. For this example, I'm going to use the user named ftpuser.

adduser -h /tmp/hddmedia -s /bin/nologon -H ftpuser

you will be prompted for a password. If you want the FTP account password protected (a good idea) then enter the password. If not, just press enter and have no password.

Now you will need to edit the /etc/passwd file to change the default group for the new user. vi /etc/passwd and you'll find a line that looks something like this:

ftpuser:$1$mUZ/dW81$bLAtC7pGOSvh3cnbdmHfm0:1003:1003:Linux user,,,:/tmp/hddmedia:/bin/nologon

That second number, right before "Linux user", is the group number. Change it to 0. yes, that will give that FTP user root privileges. The way I've set up the script, the HDD directory gets changed so that only the root group has access to write to it. The FTP login goes to the HDD directory and is chroot protected so that the screenplay media is the only set of directories the user has access to. I would set the group ownership, but the busybox that comes with the screenplay doesn't have that built in. So the paranoid will need to wait until I publish the new buildroot, or use the old buildroot, it might work. And then you can change the group ownership of the HDD directory.

Anyway, that's it. Enjoy.

Hopefully the way I've done SSH and VSFTP should make it easy to add into IomTools, if SuperBerny so desires. I've also given him the necessary code for manipulating the password, so he can add the feature to IomTools to set the root password and create users.

Edit: After playing around with it for a few days, what I'm experiencing on my local box is a lockup during file transfer. Not very consistent, sometimes it locks up after transferring several GB, but usually locks up after 1-2 GB has been transferred, at least downloading. I'm not sure if this is related to the 1.8 firmware, or the VSFTP program. I had lockups prior to VSFTP, so I'd appreciate feedback from others as to if they are seeing lockups on other firmware versions, or no lockups at all.

Edit 2: I have just updated the VSFTP program by compiling it with v4.2.4 of the GCC compiler. It seems to have solved the lockup problem. I was not only able to upload > 6 GB multiple times, and download > 6 GB, I was also able to upload multiple files simultaneously, which the prior compile was leaving dead processes after trying to do. VSFTP works really well now. I am using firmware R1.8. One note: The R1.0 firmware mounts the HDD with no executable permissions, and as a result, you cannot run the script off of the hard drive. So I would recommend either upgrading to R1.8, or running the script by typing sh < I10SetupVSFTP.sh to execute the script.