welcome to my corner
Tavish Naruka

Some USB talk

I saw Travis Goodspeed's talk on writing a USB pen drive from scratch. It was interesting how I did not see USB protocol as a network protocol earlier, with endpoints as ports as on a IP network, to communicate with an application on it. At the same time i realized that what he said about developers using a lot of code from manufacturer supplied example code or code examples from books is also true.

USB Host code on operating systems (or not operating systems) is also developed with this kind of example code in mind, which can result in interesting bugs; some of which he demonstrated in his talk. The thing is that developers on both sides (device and host) are not expecting much deviation from ideal or expected behavior. One more reason for this is that the communication protocols are layers upon layers of protocols. USB disk is USB, USB mass storage class, SCSI, block device; there might also be layers of buffering and caching on the host side.

All sorts of unexpected behavior can result if the device (or host?) misbehaves, because software is just not handling cases where the device does not follow expected behavior. This leads to possibilities like intercepting firmwares, bypassing DRM or digital signatures (as he demoed) and other such exploits. Check his blog post about writing USB devices in python on his hardware called facedancer(goodFet earlier versions).

Comments »

Kiosk with linux

Step 1:

Create your kiosk application. Example would be say web app running on the kiosk itself in php/python/nodejs etc.

Step 2:

Use some small distro, preferably with sysVinit(easy to edit /etc/inittab than writing upstart entries)

Example changes in /etc/inittab, comment out one of the tty logins:-

#1:2345:respawn:/sbin/getty 115200 tty1 


1:2345:respawn:/bin/login -f user_name tty1 </dev/tty1 >/dev/tty1 2>&1

Edit your /etc/rc.local to startx:-

su -l user_name -c 'startx -e /usr/bin/browser http://localhost:9001 2>&1' 

[or you may use ~/.xinitrc]

Or, install nodm, edit /etc/nodm to enable it and set user, and edit user's ~/.xinitrc to launch your app.

This way you are not launching any window manager, so no login and your application is started automatically

Step 3:


This can be used with low powered linux running computers like imx233-olinuxino with TV-out, or raspPi to make a really cheap kiosk.

Or this can be setup with an old desktop which will still be cheap. Other possibilities are using a touchscreen interface, or giving only mouse as user interface etc.

[Note: All this assumes you have drivers, configurations working for your display device, input devices and working Xorg.conf for display/input etc]

Comments »