Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, December 22, 2008

Force-erasing a DVD+RW

Actually, rather than calling it "force-erase" it's better off being called as trickery.

From the Wikipedia article about DVD+RW,
DVD+RW supports random write access, which means that data can be added and removed without erasing the whole disc and starting over (up to about 1000 times).
While that 'add and remove without erasing the whole disc' thing sounds great, what if you want to erase the disc securely?

Try erasing it with say, K3B, and it'll bail out saying erasing will be done in the background; meaning that if you have 4.4GB of stuff on the disc and you overwrite it with a smaller amount, the old data is still there - Old data which you want to get rid of for some reason (security is a good excuse).


The simplest way of totally erasing a DVD+RW is by writing a 4.4GB ISO which has nothing but 0's in it.

So, from a terminal create the above mentioned disc image using dd.
dd if=/dev/zero of=/tmp/BlankISO.iso bs=1000000 count=4700
Now you just have to burn this ISO file onto your DVD+RW and you have a completely empty disc.

P.S : Blanking a DVD+RW actually defeats the purpose of using a DVD+RW but sometimes you just can't help it.

Cheers!

Saturday, August 16, 2008

ACPI Suspend/Resume

Suspend to RAM or Suspend to disk on GNU/Linux with an ACPI enabled kernel:

First, we find out what sleep state the system supports by running
echo /sys/power/state
And we finally put the system to sleep by doing (as root) :
echo -n "X" > /sys/power/state
Where X is one of the sleep states obtained from the before mentioned command.
mem / standby - Suspend to RAM (standby)
disk - Suspend to Disk (hibernate)

Example : ( '#' prompt denotes that i'm root already)
# cat /sys/power/state
# mem standby disk
# echo -n disk > /sys/power/state # for suspend to disk (a.k.a 'hibernate')

NOTE : For suspend to disk to work correctly, pass the resume kernel parameter at boot.
kernel /vmlinuz-2.6.25-custom root=/dev/hda1 ro resume=/dev/hda4
Keep in mind that this resume partition must be a valid swap partition.

Sunday, June 1, 2008

Installing a Pixart Imaging, CIF Single Chip Webcam

Summer, 2008
Blissfully unaware about Hardware Compatibility Lists in driver pages, i finally got myself a USB web cam. It was this little thing i thought would work without hassle. >>

Looks like i was wrong. A `lsusb` output on my Debian GNU/Linux box and this was what i got :


$lsusb
093a:2460 Pixart Imaging, CIF Single Chip

Looking all good, i headed down to Google to search for the vendor ID. I ended up with this (http://mxhaard.free.fr/download.html) page and found out that my cam was supported by the spca5xx drivers. Downloaded the tarball from the same site, wasted a couple of hours downloading hell lot of dependencies for the compilation and finally it compiled. ;)

It just didn't work no matter what. The cam was sitting there literally for months together until i found another blog deeply hidden in Google in which the guy had the same problem as mine and thank heavens he had a workaround too.

So this is what i had to do :


$ cd /path/to/the/tarball/
$ tar xvf gspcav1-20071224.tar.gz
$ cd gspca/modules/gspca/Pixart/


Once there, you need to edit a file called pac207.h
In Line 137, replace
if(id[0]!=0x27) with if(id[0]!=0x27 || id[1]!=0x08)
So you'll end up with this :
....
PDEBUG(2, " Pixart Sensor ID 0x%02X Chips ID 0x%02X !!\n", id[0],
id[1]);
if(id[0]!=0x27 || id[1]!=0x08)
return -ENODEV;

return 0;
....

Well, that's pretty much it. Just save the file, close and rebuild it with "make" and "make install" as root.
Plug in the cam and you'll see some messages appear in
`dmesg | tail` if your webcam was successfully detected and gspca driver was loaded right and yes the cam was working!

P.S : If your kernel doesn't auto-load modules, just do a modprobe gspca