Tagged: Linux Toggle Comment Threads | Keyboard Shortcuts

  • Akarsh Simha 1:38 am on January 2, 2014 Permalink
    Tags: , , , , , Linux, , scripting, shell scripting   

    Astro-scripting using KStars' D-Bus interface 

    I was telling Henry about
    an interesting use case of KStars a few days ago, and he
    suggested that I blog about it.

    I encountered this problem while preparing for a Practical Amateur Astronomy workshop that we were organizing. We had made lists of
    various celestial objects for people to observe, along with some
    hand-written descriptions. We edited the lists collaboratively on
    Google Spreadsheets, and at some point I declared the lists final and
    made a CSV export. I wanted the lists to be organized by constellation
    and also have some more vital information about the objects filled in.

    Enter KStars and D-Bus. KStars has D-Bus interface functions that let
    you access many of its features. I use qdbus to access
    them over the shell. (Note that the following is known to work on
    GNU/Linux. I am entirely unsure about Windows and Mac
    platforms). Here’s a brief example of making KStars point towards M

    qdbus org.kde.kstars /KStars org.kde.kstars.lookTowards "M 33"

    (Note: Due to some bug in KStars at the moment, you need to invoke the
    above multiple times to get the object in the center)

    Then, let’s say we want to query information on NGC 2903. We can do so
    by using:

    $ qdbus org.kde.kstars /KStars org.kde.kstars.getObjectDataXML "NGC 2903"

    and KStars outputs an XML blurb describing the object.

    One can now use tools like xmlstarlet to work with the
    XML on the command line.

    There. That has all the information I need to complete the
    checklists. So I went ahead and wrote a small shell script to order
    the objects by constellation and typeset a table using LaTeX. The
    results look like this:


    Many more wonderful things are possible because of the D-Bus
    interface. In fact, my Logbook project
    relies heavily on KStars’ D-Bus interface. The Logbook project uses
    KStars to produce amateur astronomers’ logbooks complete with fine and
    coarse finder charts, relevant data and DSS imagery.

    One can use qdbusviewer and qdbus to further
    explore the available D-Bus methods in KStars and profit from
    scripting using KStars.

  • Akarsh Simha 3:35 pm on December 9, 2010 Permalink
    Tags: , , , Linux,   

    Context I feared that my 2.5-year old De… 


    I feared that my 2.5-year old Dell Insprion 1525n (yes, it came with no Windows!) was growing weak with "age" (effective age = age * roughness of handling), and therefore, I decided to make use of Thanksgiving deals to get a Lenovo ThinkPad Edge 14".

    My Hell Perspiron (as I nickname it) gets as hot as hell and shuts off with the slightest processor load. Plus, the SATA hard-disk is showing signs of impending gradual failure. So I think it was a good decision anyway.

    First Looks

    From what I hear, this laptop is not really a *ThinkPad* (as in a T-series ThinkPad), but is a ThinkPad nevertheless ๐Ÿ˜‰ — that’s enough.

    So let’s see. I paid $640 + $50 tax + $0 shipping for it instead of the projected price of $1100+ and the "usual" total price of $860. It came via UPS, free shipping.

    Unlike stuff I read online, my laptop doesn’t have a glossy back — no fingerprints etc. I’m not very bothered about the TrackPoint. It kind-of does get into the way, but not much. The keyboard design and feel is extremely good. It feels very nice typing on it.

    However, by default, one needs to hold down the ‘Fn’ key to input F1 thru F12! Without Fn depressed, these correspond by default to mute, change volume, brightness etc. I was really frustrated by this, but a little Googling found me a solution (mentioned later). There’s another thing I do not like: which is that Ctrl and Fn are flipped across from their positions in Dell (and I think most other laptops). But this is a feature of all ThinkPads, it seems. Thankfully, Lenovo has some very nice BIOS options that let you configure these behaviors.

    Installing Debian

    Booting the installer
    During first boot, after randomly answer the Windows configuration questions, it detected my WiFi network and connected. I learned from my friend Kumar Appaiah about UNetBootIn. I had originally planned to follow an article that a couple of us compiled this wiki page. But I gave UNetBootIn a try, and it failed. However, it installed WinGRUB successfully. The kernel refused to load, saying "Invalid file format" or something to that effect. So I got back to Windows and obtained the kernel and initrd.gz for the Debian installer from IITM’s FTP server and booted into the installer as outlined on the wiki page.

    Kumar recommended that I try LVM. So I created a non-LVM physical /boot partition (required), and an LVM physical volume, that I split into several logical volumes. I also left 5 GB in a non-LVM physical partition, just in case. I deleted ThinkPad’s boot drive, which might have been a bad idea :-S.

    Installing Packages
    I used the default mirror in the US: http://ftp.us.debian.org. It turns out that the U of Texas mirror (ftp.utexas.edu) is much faster even when I’m at home.

    Post Install
    Post install, Debian booted into a command-line. It took me a little work to get basic stuff setup (bash completion etc.) and then I installed KDE (aptitude install kde-standard) and booted into it. It turns out that testing now has KDE 4.4.5.

    Here’s the output of lspci on my Thinkpad:

    00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
    00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
    00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
    00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
    00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
    00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)
    00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06)
    00:1c.2 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 (rev 06)
    00:1c.3 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 06)
    00:1c.4 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 (rev 06)
    00:1c.5 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 (rev 06)
    00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
    00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
    00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 06)
    00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 06)
    00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)
    00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06)
    03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller (rev 10)
    09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)
    ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
    ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
    ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
    ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)
    ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
    ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)

    The lines that really matter to me are:

    00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
    03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller (rev 10)

    The graphics card is not a fancy NVidia, and is at least not an immediate concern. It should work out of the box though. At least I see a graphical display ๐Ÿ™‚

    WiFi did not work out-of-the-box. I have an RTL8191SEvB controller, as indicated above (AFAIK, not all ThinkPad Edge 14s have the same). A little Googling pointed me to a blogpost, which pointed me to the RTL8191 drivers on RealTek’s page. I like to use wpa_supplicant, because I’m comfortable with that. So I used wpa_passphrase to generate the configuration for wpa_supplicant, and put that into /etc/wpa_supplicant.conf (created the file). Then, got rid of the network-manager service and ran wpa_supplicant:

    wpa_passphrase essid passphrase

    1. copy-paste output into /etc/wpa_supplicant.conf

    /etc/init.d/network-manager stop
    wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant.conf &
    dhclient wlan0

    and my WiFi worked. Of course, this is temporary.

    Changing the behavior of Fn key
    A little more Google told me that I could set the behavior of ‘Fn’ keys and swap the ‘Ctrl’ and ‘Fn’ key positions with the BIOS configuration utility. I rebooted, hit ‘Enter’ to get to the BIOS, (Fn +) F1 to edit the BIOS configuration, and went to ‘Keyboard’ to find these relieving options. Changed the behavior of F1…F12 to ‘Legacy’, and swapped the Ctrl and Fn keys. I’m now comfortable!


    The touchpad, on Linux, works just the way I want it to by default — no tap to click; vertical scroll by sliding your finger on the right edge of the touchpad (in Windows, you had to use multitouch by default to do this, which I don’t like).

    First Impressions, Summarized

    So far, I think the Lenovo ThinkPad Edge 14" is a very nice laptop. No complaints at all — it looks a lot sturdier than a Dell Inspiron (like the rest of the ThinkPads), has a matte finish, I could work around my complaints with the keyboard, getting WiFi working wasn’t as bothersome as it usually is etc. The only thing I didn’t like, is that it came with Windows 7 installed and an ugly sticker that proclaims the same.

    • dickfeynman 4:53 pm on December 9, 2010 Permalink | Log in to Reply

      When you wanted to buy a new laptop, why exactly did you go for a thinkpad ? And btw, why not a netbook ?

      • Akarsh Simha 7:05 am on December 18, 2010 Permalink | Log in to Reply

        I generally don’t like Netbooks. They are too small for my fingers. And ThinkPad, because I here it’s the most durable and reliable line of laptops.

    • Kumar Appaiah 2:32 am on December 10, 2010 Permalink | Log in to Reply

      WiFi: Try wicd.
      Swapping function key behaviour etc.: You’re also getting old! ๐Ÿ™‚

      • Kumar Appaiah 2:57 am on December 10, 2010 Permalink | Log in to Reply

        To clarify, I meant “old” in the context of “need to use the legacy operations, old style”. ๐Ÿ™‚

  • Akarsh Simha 3:45 pm on October 23, 2008 Permalink
    Tags: Genius MousePen, Linux, , WizardPen, Xournal   


    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. ๐Ÿ˜€

    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!

  • Akarsh Simha 4:58 am on July 22, 2008 Permalink
    Tags: dell, laptop, Linux   

    Dell Inspiron 1525! 


    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!]

    • Subhodip Biswas 10:40 am on July 22, 2008 Permalink | Log in to Reply

      hey !
      This machine got a dell wireless card ..right ??
      well , if it has got one ..please do provide feedback of this working with linux distros ..

    • Kumar Appaiah 5:20 pm on July 22, 2008 Permalink | Log in to Reply

      I also have hopes of purchasing such a machine. Please do give me your comments on this.


    • Prasanna 2:23 pm on July 24, 2008 Permalink | Log in to Reply

      Congrats! Happy Laptoping!

    • Kartik Mistry 6:20 pm on September 6, 2008 Permalink | Log in to Reply

      Nice report, Kmap got similar machine.. ๐Ÿ™‚

    • bashers 3:09 am on September 7, 2008 Permalink | Log in to Reply

      i love the dell inspirons i got a pink from pc world 2 day but it came without battery but they said i could by one for not very much:D
      untill i found out the batterys were ยฃ124
      so i took it back got a refund and am now waiting for a red one from currys so if any one has a red one and i would rather appreciate it if u txt me telling me about the colour:D

    • Akarsh Simha 12:57 pm on September 20, 2008 Permalink | Log in to Reply

      @Subhodip: I haven’t been able to get the Wireless working. It’s supposed to be a Broadcom 43xx, but the driver in the 2.6.26 kernel is not binding to the device. Please let me know if you find a solution.

      @KMap: Congrats on your purchase. Sorry for such a late response.

  • Akarsh Simha 9:19 pm on June 16, 2008 Permalink
    Tags: ADSL Router, Linux, , SSH   

    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 ๐Ÿ˜€
    Feels like the Big Bang Theory, except that it isn’t from all over the world ๐Ÿ˜€

    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
    Connected to
    Escape character is '^]'.
    BCM96338 ADSL Router
    Login: admin

    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 The config basically tells the router to forward all requests on port 80 (http) and port 22 (ssh) to and 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
    ssh TCP 22 22 22 22

    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!!

    • Prasanna 10:11 pm on June 16, 2008 Permalink | Log in to Reply

      Yay us! ๐Ÿ˜€

    • Kumar Appaiah 12:25 pm on June 17, 2008 Permalink | Log in to Reply

      Great work, guys! This is fun, and definitely useful to test out things. It’d be nice for one of you to run a stress test and find out how many HTTP requests or FTP requests your machine can handle per second. Also, it would be interesting to see if the performance improves with a scripted page with caching, ala Drupal. Game for this?

    • Akarsh Simha 1:52 am on July 1, 2008 Permalink | Log in to Reply

      I suppose we could do that Kumar. We’ll work out a time when we’re all free to do that. Why aren’t you seen on #iitm-linux nowadays?

    • wan acceleration 2:52 pm on November 12, 2008 Permalink | Log in to Reply

      I’ve found that in our network WAN accelerators have made a big difference

  • Akarsh Simha 7:39 am on June 12, 2008 Permalink
    Tags: , IRAF, Linux   

    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

    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
    PATH=$PATH":/scisoft/bin" # Required for SGI EPS export etc
    ulimit -s unlimited # Sets unlimited stack size. Required in Debian too.

    4. Run IRAF ๐Ÿ˜€

    ds9 &

    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. ๐Ÿ™‚

    • Daves 2:47 am on April 28, 2009 Permalink | Log in to Reply

      Dear Akarsh Simha,

      Im an astronomy student from Copenhagen, who find your instructions very usefull, and thumbs up for that – is there a possibility you could help me install other programs from the Scisoft.tar? even tho Im stuck at the last part of your guide to IRAF. (point 4)

  • Akarsh Simha 1:06 pm on April 18, 2008 Permalink
    Tags: , Linux   

    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!

  • Akarsh Simha 12:13 am on April 12, 2008 Permalink
    Tags: Linux,   

    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!

  • Akarsh Simha 11:52 pm on April 11, 2008 Permalink
    Tags: Linux, segfault   

    Poetry in Segfaults 

    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!

  • Akarsh Simha 4:11 am on March 30, 2008 Permalink
    Tags: camera, EOS 400D, gphoto2, Linux   

    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


    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 ๐Ÿ˜€ย  (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 ๐Ÿ˜›ย  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

    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

    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:

    • Akarsh Simha 4:17 am on March 30, 2008 Permalink | Log in to Reply

      Expt 1.0.1
      I tried:

      ~/bin/gphoto2 –set-config capture=on -F 1 -I 1 –capture-image –new

      The command still doesn’t terminate.
      –new is supposed to get all pictures flagged as new.

    • Akarsh Simha 2:06 pm on March 31, 2008 Permalink | Log in to Reply

      The problem of not terminating correctly is apparently because of some change with the proprietary (and consequently undocumented) Canon PTP (Picture Transfer Protocol or something like that) in the new firmware.
      Marcus Meissner has already started working on it and has produced (and commited?) a patch today (an hour ago or so).
      Will check if it works later today evening.

    • akarshsimha 11:11 am on April 6, 2008 Permalink | Log in to Reply

      Ok… Marcus Meissner has fixed it and it works for other people. It’s been merged with the trunk. I now need to figure out how to compile gphoto2 from the trunk.

    • Nick Quinn 1:40 am on April 30, 2008 Permalink | Log in to Reply

      After messing around with gPhoto and my 40D for several months, your blog provided me with the ‘hint’ I needed to finally understand how to set the shutter speed! However, if I fire the shutter either from gPhoto or by the camera’s shutter button, no image is stored on the CF card. Did you manage to get any further with your 400D and actually capture an image?

    • Akarsh Simha 1:43 am on May 13, 2008 Permalink | Log in to Reply

      Glad that my blog proved useful. I haven’t got beyond this, because I haven’t found time to recompile gphoto2 from the trunk ever since ๐Ÿ˜€

      Regarding storing on CF card, you’ll have to set capturetarget to CF card. I don’t know what the exact value is, but you can look up the documentation for that.

      There’s also a neat ncurses based configuration screen, which you can use to set these parameteres.

    • Andrew Wyllie 4:36 pm on June 27, 2008 Permalink | Log in to Reply

      Thanks for all the information on this. I got the latest version from SVN and it compiled with no problem and works really well.

      If you want to capture an image an download it right away, you need to use a command like:
      gphoto2 –set-config capture=on -F1 -I 1 –capture-image-and-download

      Even cooler is to use a hook-script which allows you to manipulate and or display the image as soon as it’s downloaded.

      Here’s my hook-script script which uses ‘display’ from ImageMagick to display the image one it has been downloaded (you could put any command you want there).

      #! /bin/bash

      self=`basename $0`

      case “$ACTION” in
      echo “$self: INIT”
      # exit 1 # non-null exit to make gphoto2 call fail
      echo “$self: START”
      echo “$self: DOWNLOAD to $ARGUMENT”
      display ${ARGUMENT} &
      echo “$self: STOP”
      echo “$self: Unknown action: $ACTION”

      exit 0

    • fred 1:00 pm on August 2, 2008 Permalink | Log in to Reply

      Thanks for this useful info… you have put me on the right track. Maybe i can help you with a problem you have…

      Perhaps some of your commands haven’t been working because you weren’t typing the “–” correctly at the start?
      I cut and pasted some of the commands from this web page and they didn’t work for me. I changed the characters at the start of the arguments to “–” and then they worked.

      Eg gphoto2 โ€“set-config capture=on -F 1 -I 1 โ€“capture-image (from this page)
      didn’t work for me until i changed the -set to –set and -capture to –capture

      This may be of no use to you, perhaps the web page displays the double minus (–) as a single character for some reason

    • fred 1:03 pm on August 2, 2008 Permalink | Log in to Reply

      After publishing my last comment, i now see that it is just the web software that runs together the double minus if it is typed with no space. Be aware if you cut and paste commands from here that look like this
      you need to manually edit them to look like this
      – -config (but with no space between the minus)
      Sorry this info is no use to the owner of this page but any others might be caught by this trap

    • Akarsh Simha 9:18 pm on September 6, 2008 Permalink | Log in to Reply

      Yes, the – seems to be a problem with WordPress.

      I’ve still not been able to get gphoto2 from trunk to build and the latest release doesn’t seem to work for me.

    • jan 7:13 am on November 16, 2008 Permalink | Log in to Reply

      Thanks to your article and helpful comments I have managed to get gphoto control my Canon 400D. Everything works with gphoto 2.4.3 and libgphoto 2.4.3 (even capture-tethered).

    • Akarsh Simha 6:53 pm on February 1, 2009 Permalink | Log in to Reply

      I’m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop, thanks to Marcus Meissner and gphoto2.

      I’m using version 2.4.3 of both gphoto2 and libgphoto. This is what I do to get it working:

      gphoto2 –set-config capture=true -F -I –capture-image-and-download

      It still doesn’t seem to work with the mirror lock up / self timer. That’s something I need to figure out, because astrophotography really needs that!

    • Noah 12:37 pm on July 18, 2009 Permalink | Log in to Reply

      Maybe there are better methods to [transfer photos] โ€“ maybe the konqueror camera:/ kioslave (or whatever itโ€™s called) works better โ€“ please let me know in that case.

      I like the following;
      $ mkdir ./photo && cd ./photo
      $ gphoto2 -P

      That will suck all the photos off the camera into dir photo. Thanks for the remote control info.


    • Damien Keffyn 7:56 pm on August 1, 2009 Permalink | Log in to Reply

      I have tried with no real success to get my 400D to capture download and preview an image.

      is there a change that has relpaced the commands used above?

      Here is what I am trying
      gphoto2 –set-config capture=true -F -I –capture-image

      This returns –>

      value true, t 1
      New file is in location /capt0000.jpg on the camera

      this command fails –>
      gphoto2 –set-config capture=true -F -I –capture-image-and-download

      this command works –>

      gphoto2 –set-config capture=true -F -I –capture-image –get-all-files

      It returns the –>

      value true, t 1
      New file is in location /capt0000.jpg on the camera
      Saving file as capt0000.jpg

      The issue I have is I would like to be able to use the camera to take the image rather than instigate the capture from the command line.

      is this possible?

      Damien K

    • Javier Pais 12:14 pm on December 20, 2009 Permalink | Log in to Reply

      gphoto2 –set-config capture=true –set-config eos-time=120 –capture-image-and-download

    • Javier Pais 12:29 pm on December 20, 2009 Permalink | Log in to Reply

      Sorry for my previous post…

      There is… if we do a:

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

      this is the result:


      then we can do a…

      $ gphoto2 –set-config capture=on –get-config=/main/capturesettings/eos-shutterspeed

      obtaining this:

      Current: 1/4000
      Choice: 0 30″
      Choice: 1 25″
      Choice: 2 20″
      Choice: 3 15″
      Choice: 4 13″
      Choice: 5 10″ (1/3)
      Choice: 6 8″
      Choice: 7 6″ (1/3)
      Choice: 8 5″
      Choice: 9 4″
      Choice: 10 3″2
      Choice: 11 2″5
      Choice: 12 2″
      Choice: 13 1″6
      Choice: 14 1″3
      Choice: 15 1″
      Choice: 16 0″8
      Choice: 17 0″6
      Choice: 18 0″5
      Choice: 19 0″4
      Choice: 20 0″3 (1/3)
      Choice: 21 1/4
      Choice: 22 1/5
      Choice: 23 1/6 (1/3)
      Choice: 24 1/8
      Choice: 25 1/10 (1/3)
      Choice: 26 1/13
      Choice: 27 1/15
      Choice: 28 1/20 (1/3)
      Choice: 29 1/25
      Choice: 30 1/30
      Choice: 31 1/40
      Choice: 32 1/50
      Choice: 33 1/60
      Choice: 34 1/80
      Choice: 35 1/100
      Choice: 36 1/125
      Choice: 37 1/160
      Choice: 38 1/200
      Choice: 39 1/250
      Choice: 40 1/320
      Choice: 41 1/400
      Choice: 42 1/500
      Choice: 43 1/640
      Choice: 44 1/800
      Choice: 45 1/1000
      Choice: 46 1/1250
      Choice: 47 1/1600
      Choice: 48 1/2000
      Choice: 49 1/2500
      Choice: 50 1/3200
      Choice: 51 1/4000

      and the pick the desired value…

      gphoto2 โ€“set-config capture=true โ€“set-config eos-time=26 โ€“capture-image-and-download

      (remember that ‘–‘ are two ‘-‘)

    • Javier Pais 1:10 pm on December 20, 2009 Permalink | Log in to Reply

      Sorry another time…

      is not ‘eos-time’… it must be… ‘eos-shutterspeed’

      gphoto2 โ€“set-config capture=true โ€“set-config eos-suttherspeed=26 โ€“capture-image-and-download

    • Luke 4:59 am on April 5, 2010 Permalink | Log in to Reply

      Akarsh you wrote:
      “Iโ€™m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop”
      I`m going to use my eos 400d with a small baloon to take photos from about 50m on archaeological site.
      Do you have any idea how to connect the camera with laptop? usb cabel is to short… via radio? How to fix it up with gphoto etc..?

    • Javier Pais 2:33 pm on April 5, 2010 Permalink | Log in to Reply

    • Luke 6:48 pm on April 5, 2010 Permalink | Log in to Reply

      Looks really good and may solve my problem, 150 fits may to be too short, but I may find sth. simillar if I know what am I looking for…
      Thanx a lot

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc