Hack

Converting your Raspberry Pi into a light weight torrent box

Raspberry Pi is one of the most common SBC (Single Board Computer) available in the market. It’s cost and performance makes the product very popular among tech enthusiasts. Even though the hardware details of the Raspberry Pi remains a mystery, the software support for the board is quite impressive. Almost all the required packages are ported and stable for RPi which makes it one of the best choices for prototyping.

I have a Raspberry Pi 2 Model B and I would like to transform my RPi to a light weight torrent box. I would like to be able to push torrents to the torrent box from any location and download the content. That way I will be able to utilize the available bandwidth of the inernet connection in the best possible way. I would also like to schedule torrent downloading time to get the maximum out of off peak internet usage.

In order to design a reliable torrent box we need several things.

  1. A torrent client
  2. An external storage
  3. A method to remotely push torrents
  4. A method to schedule torrents

(more…)

Cheap logic analyzer review. Do they work?

Logic analyzer is a handy tool for hobbyists. There are numerous occasions we come across scenarios where we doubt whether the module that we connected is not working or our SPI/I2C signals are wrong. Then all we tell to ourselves is “eeeerrr I wish I had a logic analyzer”. I came across the same scenario several times, finally decided to buy a logic analyzer.

There are many EXPENSIVE logic analyzers available by many suppliers. I’m sure that they work flawlessly and they are really accurate. But I cannot afford them. So I went to E-Bay and typed “Logic Analyzer” and filtered “Lowest Price First”. I selected the product below. It is just 11$. There are few logic analyzers for 9$ also (Damn I didn’t see!!!) I did not think twice, I bought it and waited a few weeks. I was not sure whether it will work.

http://www.ebay.com/itm/Compatible-With-Saleae-USB-Logic-24MHz-8Ch-Logic-Analyzer-for-ARM-FPGA-/231281920312?pt=LH_DefaultDomain_0&hash=item35d97a0938

IMG_20140831_164113

The Package

(more…)

Hacking a generic USB joystick using HIDAPI.

It has been a while since I posted something here. Lately I have been working on USB firmware and software applications. There are loads of things to post but have very less free time. I’ll post them when I got a free time.

What this article primarily talks about is on a method to communicate with the joystick using your own application. It may be to control a robot, who knows. I will be using a simple MFC application to communicate with the joystick.

In order to understand the article properly you should have at least a slight understanding about,

  1. MFC applications
  2. USB specifications
  3. HID class specifications
  4. C++

A helicopter view of how this communication works,

You have the device. A driver is needed to communicate with the device. The driver has something called IOCTLs which are used by the applications/libraries to communicate with the device. Ya, that’s enough.

HIDAPI is some sort of a library which is cross platform (i will be using it in windows though) and it will take care of all the IOCTL calls and provide us with an API to easily communicate with the device. In other words, we do not need to worry about specific IOCTL details, rather we just need to know how to use the API functions. HIDAPI uses the windows generic driver to communicate with the joystick or any other HID class USB devices. You can find HIDAPI home page here.

First thing I did was connecting the joystick to the pc and sniffing the USB packets using USBlyzer. After that I understood that there is an Interrupt Transfer which has 8 bytes of data. And it simply floods the USBlyzer window. I tried a bit to find the protocol but I haven’t had any luck. So I decided I will figure it out myself.

(more…)