Posts Tagged Linux

WP8060U!

It was relatively very trivial to get the Genius MousePen 8″x6″ tablet working with Linux. Google gave me a result from the Ubuntu Wiki. The driver built with no trouble and it worked.

Well, that’s because I checked up on google before buying the hardware and favoured a Genius MousePen over some iBall foo because it had a (“sureshot”) Linux driver. :D

The tablet works pretty well, but there are some problems. It’s hard to use it as a general purpose mouse, but it works correctly when it comes to dragging, which means it works well for drawing and writing.

I found a software called xournal [Grr... it is a GTK app] in my APT cache. So I just did apt-get install xournal and I could comfortably write down stuff and export to PDF!

Today, I saw if I could actually draw with it. Being the terrible artist (I used to hate drawing at school), I ended up “tracing” this from a photograph of mine. So this is v1.0:

Cartoonized!

Cartoonized!

5 comments October 23, 2008

Dell Inspiron 1525!

Yay!

Finally got a Dell Inspiron 1525, Ruby Red Color, No Windows. It came with a nice CD of FreeDOS that said “with sources” and said that the stuff inside was licensed under GPL. But bleh, a whole lot of Windows drivers along with it. Anyway, Linux 2.6.25 supported both the network card and the sound card (Linux 2.6.22 did not).

Well, I had an old image of Debian testing with a 2.6.22 kernel that Varun had given me. The installer did not detect my network card and I had to declare that I had no network card. I brought Linux 2.6.25 from my desktop in a thumb drive and installed it.

I had trouble figuring out how to start the network because I thought the problem was with the driver, while the problem was actually with the cable. I replaced the cable, did:

ifconfig eth0 inet up {IP Addr.} netmask {Subnet Mask} broadcast {Broadcast Addr.}
route add gw default {Default Gateway}

And added my DNS servers to /etc/resolv.conf and things started working beautifully. This helped me, because I didn’t know the correct usage of ifconfig.

Yet to test the webcam, WLAN and so on. But what I need for my basic usage is working.

I plan this to be my portable music player, KDE Development Device and communication device. So far, I’ve barely set up the minimum requirements on it (I started at about 11:00 PM and it’s been 6 hours so far) but I think I’ve done a fairly good job in setting up the KDE development environment this time. I added a small bit of code that changes my coloured prompt to indicate whether I’m in a build directory or source directory, and also the branch I’m working on into David Faure’s cd function.

Right now, I’m compiling kdebase and hope to have KStars ready for tomorrow’s Kavalur trip :) [What perfect timing!]

6 comments July 22, 2008

Switching on a lightbulb from 360km away!

Yes, my friend Prasanna just did the same. He SSHed into my system from Chennai and switched on the CFL in my room :D
Feels like the Big Bang Theory, except that it isn’t from all over the world :D

I opened SSH access on my ADSL router. A lot of articles on the net helped me, but let me write this out, so that it is clear and in one place. And before any brilliant bruteforcers decide to track me down, yes, I have the openSSH fix and run Debian, which means all vulnerable keys have been eliminated.

Most routers support telnet:


[13:akarsh@PENGUIN$ www]$ telnet
telnet> o
(to) 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
BCM96338 ADSL Router
Login: admin
Password:

Once I login, I get this main menu on my router. Most routers have a very similar main menu if I amn’t mistaken.


Note: If you have problem with Backspace key, please make sure you configure your terminal emulator settings. For instance, from HyperTerminal you would need to use File->Properties->Setting->Back Space key sends.

Main Menu

1. ADSL Link State
2. LAN
3. WAN
4. DNS Server
5. Route Setup
6. NAT
7. Firewall
8. Quality Of Service
9. Management
10. Passwords
11. Reset to Default
12. Save and Reboot
13. Exit
->

If you want to setup a virtual server (which is like a proxy server running on the router that hands over all requests for a particular port on the router to a particular port on a particular system on the local subnet), choose option 6, Followed by 1.


Note: If you have problem with Backspace key, please make sure you configure your terminal emulator settings. For instance, from HyperTerminal you would need to use File->Properties->Setting->Back Space key sends.

Virtual Server Menu

1. Add
2. Remove
3. Show
4. Exit
/ NAT/Virtual Server ->

You can now setup virtual servers. This is my configuration (I hit option 3 to get this). The internal IP of my system on our local subnet is 192.168.1.5. The config basically tells the router to forward all requests on port 80 (http) and port 22 (ssh) to 192.168.1.5:80 and 192.168.1.5:22 respectively on the local subnet.


Virtual Server Show

Server Name Proto. External Start External End Internal Start Internal End Server
Port Port Port Port IP Address
http TCP 80 80 80 80 192.168.1.5
ssh TCP 22 22 22 22 192.168.1.5

You will also have to set up the firewall to allow incoming packets on these ports. That’s option 7 (Firewall) on my router’s main menu, followed by option 1 (IP Filtering), followed by option 2 (Incoming).

Prasanna and I also played ‘alsamixer’ on his system. It’s real fun to be able to do what we were once doing within the local intranet of the institute with a 360km gap in between!!

4 comments June 16, 2008

IRAF on Debian from the ESO Scisoft DVD

Ok… here’s a short summary of what I did to get IRAF working. I’m using the SciSoft DVD tarball from ESO for IRAF. Yes, this might be a bad idea because you’ll be installing a LOT of other stuff too.

1. Extract the tarball

sudo cp scisoft-7.0.0.tar.gz /
cd /
sudo tar -xzf scisoft*
sudo rm scisoft-7.0.0.tar.gz

2. Run the SciSoft Setup.bash file

cd /scisoft/bin
chmod a+x ./Setup.bash
su -
. ./Setup.bash
exit

3. Install ds9

sudo apt-get install saods9

3. Prepare to run IRAF
I do my IRAF work in ~/IRAF and not under a new user account as some manuals specify.

mkdir ~/IRAF
cd ~/IRAF
/scisoft/bin/mkiraf
PATH=$PATH":/scisoft/bin" # Required for SGI EPS export etc
ulimit -s unlimited # Sets unlimited stack size. Required in Debian too.

4. Run IRAF :-D

ds9 &
iraf

This might not work for you, because I might’ve installed some library dependency, or tried some other source of IRAF and might be using that in part. If it doesn’t, please let me know of the corrections through comments.

HTH. :-)

2 comments June 12, 2008

What does my Desktop look like?

I ran Xnest to test KDE 4 (devel), after a fresh update and rebuild yesternight. Here’s what I got:
My Desktop!

Add comment April 18, 2008

Spam Filtering for Jabber?

I am frequently pained when Isomeone asks me a technical question on Jabber. I’d want to redirect them to the IRC channel #iitm-linux but I feel “obliged” to respond, and I hate to hide. So, I wanted some filtering, just like I have procmail for mail filtering, for Jabber chats as well – that way, I’ll be blissfully ignorant of unwanted messages.

So I hacked the MCabber source to introduce a programmable filter that any messages are passed through, before they flash my bulb. The modified files in the src directory of the mcabber tarball on the MCabber site are available here temporarily.

Just create an executable ~/.mcabber/filter and chmod it to atleast u+rx to get the filter working.

The filter can accept four command line args – The JID of the sender, The resource of the sender, The Message, and The Type of Message (as defined by MCabber) and must output the processed message to stdout. If the filter outputs nothing, then no message is displayed.

I’ve done something extremely dumb: I could’ve piped the message into stdin, instead of putting it as a command line argument. Most of my time went into trying to escape the quotes in the message, encountering lot of dumb bugs – I could’ve saved on that. Late realisation. :-(

Anyway, will fix that in future. There are many more interesting things to left to do – like passing the current status into the filter, so that you can vary the action of the filter depending on whether you’re away, busy or available, and hacking MCabber to get DBus support and writing a MCabber Remote to create programmable autoresponders!

Add comment April 12, 2008

Poetry in Segfaults

[o]
DEBUG: nqoutes = 1sh: -c: line 0: unexpected EOF while looking for matching `”
sh: -c: line 1: syntax error: unexpected end of file
DEBUG: nqoutes = 0DEBUG: Escaped string = Viola! In view a humble vaudevillian veteran,
cast vicariously as both victim and villain
by the vicissitudes of fate.
This visage, no mere veneer of vanity,
is it vestige of the vox populi, now vacant, vanished.
However, this valorous visitation of a by-gone
vexation, stands vivified, and has vowed to
vanquish these venal and virulent vermin
vanguarding vice and vouchsafing the violently vicious
and voracious violation of volition.
The only verdict is vengeance; a vendetta,
held as a votive, not in vain, for the value
and veracity of such shall one day
vindicate the vigilant and the virtuous.
Verily, this vichyssoise of verbiage veers
most verbosei.tiASegmentation fault

That’s a segfault which I encountered while trying to hack mcabber to put a programmable filter. This thing happened to be my friend’s status message on Jabber, and I had some bug that was not terminating strings appropriately with a during some copy operation!

Add comment April 11, 2008

Canon EOS 400D and Linux – Expt1

I was all excited when my new Canon EOS 400D landed in my hands today. I think that it’s a great piece of equipment, although I haven’t yet played around with it enough.

I thought I needed to buy a separate cable to computer-control it, and the USB cable was only a data transfer cable. I casually asked about software for EOS 400D on Linux on ##astronomy on freenode, and I was excited when ‘peerce’ told me that I should’ve got the USB cable for computer-control along with the camera! I ran down and brought the cable and connected the camera to my brother’s system, running Debian (testing).

I didn’t find a good “HOWTO” for the Canon EOS 400D detailing the remote-controlled capture, although I expected that somebody would’ve written one. (I think I should write one when I fully explore it, if someone else hasn’t!)

File transfer was trivially easy:

sudo apt-get install gphoto2 gtkam

gtkam

Select the ‘Add Camera’ option from the ‘Camera’ menu and say ‘Detect’.  Then click ‘Ok’. If the camera doesn’t initialize, try restarting the camera :-D   (May not be the right way to do things). If gtkam doesn’t segfault or run into some trouble, you should see a list of thumbnails on the right half of the window, if you select the right thing (the only thing) in the tree on the left pane. Figure out, it’s quite intuitive, and it doesn’t work well :-P   Maybe there are better methods to do this – maybe the konqueror camera:/ kioslave (or whatever it’s called) works better – please let me know in that case.

Now, I want to control my camera. So I look around for documentation. I understand that it is just

gphoto –set-config capture=on

gphoto2 -F <# of frames> -I <interval> –capture-image

That didn’t seem to work. After much experimentation, I tend to think that the camera needs details of how you want to photograph – i.e. focusing, exposure settings etc. (or does it?). Besides, capture=on must be set in the same command as the –capture-image, or so it seems, probably because every gphoto2 command sends a whole bunch of other instructions to the camera as well (isn’t that inefficient???).

So, that means that if I put the camera on Auto Mode using the Mode dial, then I can get away with:

gphoto2 –set-config capture=on  -F 1 -I 1 –capture-image

For some reason, the command doesn’t terminate (and consequently, F > 1 doesn’t work) – probably because it wants us to accept the image and save it as well. I still need to figure this out.

One more thing that I see is that if I do a

gphoto2 –list-config

I get only three options:

 /main/settings/capturetarget
/main/settings/capture
/main/capturesettings/focuslock

This is expected (after reading the documentation), because the remaining settings that pertain to capture mode are exposed only after we enable capture mode. So do a

gphoto2 –set-config capture=on –list-config

and you get a whole bunch of configurable parameters:

 /main/settings/eos-time
/main/settings/capturetarget
/main/settings/capture
/main/imgsettings/eos-iso
/main/imgsettings/eos-whitebalance
/main/capturesettings/picturestyle
/main/capturesettings/eos-aperture
/main/capturesettings/eos-shutterspeed
/main/capturesettings/eos-meteringmode
/main/capturesettings/focuslock

Ahh… so there we go. So, if I wanted a (semi-)successful manual exposure, I should do:

gphoto2 –set-config capture=on –config -F <Nf> -I <Ti> –capture-image

I still need to figure out how to retrieve the file or somehow get the command to complete.

Earlier, my AF exposures would fail, because I was trying to shoot a blank wall, so AF would fail! It took me really really long to realize that!

The following documentation will prove to be sparingly helpful:

13 comments March 30, 2008

Computer controlled tubelights!

A few months back, I implemented an interface using the Parallel Port to control my room’s tubelight and bulb. Such circuits that interface electrical devices to the computer through parallel port are extremely popular on the internet. My version uses one optocoupler (MCT2E), one transistor, a pair of resistors and a relay for every device I wish to control. So I’ve got some two implementations of this as of now.

A simple C program can help control the bits on the parallel port (and thereby the devices). Again, there are examples all over the internet like this one, that help you do that. I wanted something more flexible and easy to use, so I wrote a rather long program (maybe it is an overkill). Forgive me for the unclean and dirty code. Here it is. You can kick me for writing dirty C++ – I hardly learnt any C++. (I learnt that it is dumb to use stdio.h, fprintf etc in C++ code, and that all C++ code must be encapsulated, but who cares! I wrote this for my own use, and am graciously releasing it, so take it if you must, and if you do write better and cleaner versions, please link them in the comments to this post! :-D ). What this code does is to implement something that can toggle the state of a specified device.

In this code, I read a configfile that defines the values of the bits that need to be switched on to control each of the devices. I implemented this so that it remains extensible – I’m planning to extend this to control my fan as well :-D . Once you’ve defined values in the configfile, you can then do things like:

sudo lpdevctl bulb

You can also specify a default device that’ll get toggled if you just say sudo lpdevctl (without an argument).

Once you have such a program, you can do lots of interesting things. The simplest of them would be to switch on your tubelight after 10 seconds delay, say:

sleep 10; sudo lpdevctl tubelight

Something slightly more interesting:

for i in `seq 1 5`; do sleep 0.5; sudo lpdevctl bulb; sleep 0.5; sudo lpdevctl bulb; done;

That flashes the lamp 5 times. Even more interesting – switching on your tubelight every day automatically at 1830 hours is like setting up a cronjob at 1830 hours to execute sudo lpdevctl tubelight.

I use a Jabber client called mcabber which has external action triggers, that can call an external action when something happens. So if somebody pings me on IM, I am notified of it through the flashing of my bulb (which I seldom use otherwise) instead of some ding sound that interrupts the beautiful music I’m playing. Besides, this alert is easy to switch off – because I can go and turn off the light bulb switch – and the relay is in series with that!

Once you get a command on your Linux system to do something, the ways in which you can extend it are infinite and are only (un)bounded by your creativity!

I like the idea of switching on my room light while sitting in my department computing facility using SSH :-D

5 comments March 22, 2008

Running an emulator!

I found it really amazing that you could so conveniently run a virtual machine on your system! When I tried installing VMWare, it was such a pain. Finally, at the end, I got it working, but I didn’t use it.

Today, I needed an emulator to test the Debian preseeded install that I’ve been working on. So I fired up the virtual machine that Varun showed me the other day:

sudo apt-get install qemu

qemu -cdrom bootable_cdrom.iso

And voila! I get a GRUB prompt (that’s what I’d put on the ISO image) that awaits a few commands in no time. That’s as far as CD-ROM boot goes.

Now, the virtual machine has no harddisk. Let’s say we wanted to give our virtual machine a harddisk – First we need to “create” the harddisk, that is if we’re not willing to dedicate a full partition to the virtual machine.  So, off we go:

dd if=/dev/zero of=new_virtual_hdd.img count=10000000

I think that produces a 5.12 GB file, if I amn’t wrong. So this time, we have a harddisk:

qemu -cdrom bootable_cdrom.iso new_virtual_hdd.img

So now you can go ahead and install any OS you want etc. But wait a minute, we want more than that – what about Network hardware?  QEMU automatically enables a kind of NAT between the virtual machines and the host macnine’s network. So internet access etc. should work as though we were behind a NAT router. As I write this, the Debian installer running on the VM tells me that my config file had a bug which I’ve to investigate, so I stop blogging here and do start working on fixing the flaw! :-D

For more information:

man qemu

Has a lot of details about the hardware that it emulates etc.

1 comment March 21, 2008

Previous Posts


Pages

a

Archives

Tags

aKademy asteroid magnitudes astronomy Astrophotography AWK BASH Bugfix camera camstream Carnatic Flute Carnatic Music Carnatic Vocal Commit D-Bus DBus Debian diffraction FOSS.IN GNOKII GNU grunt GSoC Hackathon IIT IITM IIT Madras KDE KDE.IN kstars Linux mail merge Mass SMS mcabber Parallel Port Philips ToUcam Photography PlanetKDE procmail Saarang segfault streamer SVN The GIMP Violin Webcam

Recent Comments

Aditya shanker raghu… on A summer at TIFR
Aditya shanker raghu… on About Me
Aditya shanker raghu… on A summer at TIFR
Wolf16 on About Me
Kelvin11 on About Me