Wednesday 24 April 2013

Hacking the Xenta IP-11IR-H264-PT IP camera from Ebuyer part one - Foscam firmware

A while ago I bought an IP camera from Ebuyer.com here in the UK because it was on offer and seemed too cheap to be true.  The camera is branded Xenta and the part code is IP-11IR-H264-PT.  It's still for sale quite cheaply here:

http://goo.gl/e7u6q

Although a bit more than I paid now.

It turns out this camera is a re-badged Foscam FI8608W, the main circuit board inside the camera even has this part code on it:

http://foscam.us/products/foscam-fi8608w-wireless-ip-camera.html

You can upgrade the firmware on the Xenta branded camera to the latest Foscam firmware.  I've put the firmware I found here:

http://goo.gl/sDV0E

That was the newest version I could find and given that the FI8608W is a discontinued product, I doubt there'll ever be another update. 

The bad news is that the web interface in this firmware still requires an Active-X plugin to view the video.

So despite the EBuyer page specifically listing Linux as a "supported OS" it absolutely is not.  I would also assume it wont work on a Mac either.  I have even spoken to EBuyer tech support about this but they haven't edited the page.

In the next post, I will describe how I built my own very simple web interface to drive the camera from any web browser with no need for any stupid plug-ins or platform dependencies.

Arduino Leonardo in Linux with Arduino 1.0.1 (Ubuntu 12.04)

I recently bought an Arduino Leonardo clone.  Previously I always used Duemilanove and clones which have been around for years and always just worked.
 
I use arduino-core, avrdude and a Makefile in Ubuntu 12.04, the version of Arduino here was 1.0.1 which claims to support the Leonardo.  I found that the definition for the Leonardo in boards.txt was commented out and when uncommented, still didn't work.

At the command line I was seeing the following error:

ioctl("TIOCMSET"): Broken pipe
ioctl("TIOCMSET"): Broken pipe
avrdude: stk500_getsync(): not in sync: resp=0x3f
ioctl("TIOCMSET"): Broken pipe
 After much Googling, I found others with the same issue but no solution.

The solution was surprisingly simple in the end, just copy the boards.txt definition for the Leonardo from the latest version of the Arduino source (1.0.4 at the time of writing)!  You could use the whole code from the arduino.cc site but I always prefer to stick to the versions I get from my OS's repositories.  The working definition is:

leonardo.name=Arduino Leonardo
leonardo.upload.protocol=avr109
leonardo.upload.maximum_size=28672
leonardo.upload.speed=57600
leonardo.upload.disable_flushing=true
leonardo.bootloader.low_fuses=0xff
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb
leonardo.bootloader.path=caterina
leonardo.bootloader.file=Caterina-Leonardo.hex
leonardo.bootloader.unlock_bits=0x3F
leonardo.bootloader.lock_bits=0x2F
leonardo.build.mcu=atmega32u4
leonardo.build.f_cpu=16000000L
leonardo.build.vid=0x2341
leonardo.build.pid=0x8036
leonardo.build.core=arduino
leonardo.build.variant=leonardo
The file is /usr/share/arduino/hardware/arduino/boards.txt

Then uploading worked fine.  Although I've not tested it, I suspect the same fix will get the Leonardo working in the Arduino IDE too.

 One last note is that uploading code to the Leonardo is a bit different to older boards because of the way the device presents itself as a HID keyboard and mouse once it has fully booted up.  So to upload code you have to put it into bootloader mode first.  There are two ways of doing this:

  1. Press and release the "reset" button the board itself.
  2. Connect to the serial port at 1200baud and then disconnect again.  You can write a simple script to do this for you, the following python script works OK:
#!/usr/bin/python
import serial, sys
serialPort = '/dev/ttyACM0'
try:
    serialPort = sys.argv[1]
except:
    pass
ser = serial.Serial(port=serialPort, baudrate=1200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
ser.isOpen()
ser.close()
Either way, you can tell the board is in bootloader mode because the pin 13 LED will be pulsating.  It will stay like this for about 7 seconds and you can upload your code.