Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question on cgi access to server apps

    I have a cgi script to control my dslr camera
    On my server the app that sends commands to the camera is gphoto2
    Running under Debian on a Linksys NSLU2.
    I'm using tthtp and pearl.

    My problem is that I'm not able to get the cgi to send the command to the server.

    I'm no expert on cgi.

    What I need to know is what cgi command can pass the server command.

    Thank you
    Jim

  • #2
    Senior Coder
    Join Date
    Mar 2006
    Posts
    1,274
    Thanks
    2
    Thanked 39 Times in 38 Posts
    system(commands)
    qx{commands}

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do I need to somehow login to server as a user or can I do straight from the script?

  • #4
    Senior Coder
    Join Date
    Mar 2006
    Posts
    1,274
    Thanks
    2
    Thanked 39 Times in 38 Posts
    Quote Originally Posted by DrStrangeLv View Post
    Do I need to somehow login to server as a user or can I do straight from the script?
    Those are perl functions or commands, so you use them in a perl script. Look them up online or in your local install of perl.

    http://perldoc.perl.org/

  • #5
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK all well and good to provide the link thank you, however I still can not get it to work.
    Please see details below I'm truly in need of getting this to work and any help would be great thank you.

    Jim

    Here is a more detail explanation:
    When login using putty under ssh to server as root
    This command works fine

    gphoto2 --set-config capture=on --set-config capturetarget=1 --set-config capture=on --set-config eos-shutterspeed=35 --set-config eos-iso=0 --set-config capture=off --capture-image

    But when I attempt it from within a cgi script using this command
    system("gphoto2 --set-config capture=on --set-config capturetarget=1 --set-config capture=on --set-config eos-shutterspeed=35 --set-config eos-iso=0 --set-config capture=off --capture-image");

    I get this error back

    *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error *** An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. ERROR: Could not capture. *** Error (-53: 'Could not claim the USB device') *** For debugging messages, please use the --debug option. Debugging messages may help finding a solution to your problem. If you intend to send any error or debug messages to the gphoto developer mailing list , please run gphoto2 as follows: env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --set-config capture=on --set-config capturetarget=1 --set-config capture=on --set-config eos-shutterspeed=35 --set-config eos-iso=0 --set-config capture=off --capture-image Please make sure there is sufficient quoting around the arguments.

  • #6
    Senior Coder
    Join Date
    Mar 2006
    Posts
    1,274
    Thanks
    2
    Thanked 39 Times in 38 Posts
    Sorry, I have no idea what those errors are about.

  • #7
    New Coder
    Join Date
    Mar 2009
    Location
    Fabric Covered Box
    Posts
    69
    Thanks
    1
    Thanked 16 Times in 14 Posts
    It sounds like the account the cgi is running under doesn't have permission to access the camera.

    Use lsusb to find out the bus-id and device-id of the camera, then check permissions (both as yourself and through the cgi) with ls. Something like

    ls -l /dev/bus/usb/{bus-id}/{device-id}

    or

    ls -l proc/usb/{bus-id}/{device-id}

    You and the cgi want read-write permission.

  • #8
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Shannon I'll check that.

  • #9
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I need no security on this as it is a stand alone box
    Can I use sudo and if so how do I apply it and run from cgi?

  • #10
    New Coder
    Join Date
    Mar 2009
    Location
    Fabric Covered Box
    Posts
    69
    Thanks
    1
    Thanked 16 Times in 14 Posts
    Try chmod 0666 on the camera to make it world read/write.

    If that doesn't work, try editing the sudoers file with

    sudo sudoedit /etc/sudoers

    and add the line

    cgi-username-here ALL = NOPASSWD: /full/path/to/gphoto2

    then in your cgi try

    system("sudo gphoto2 ...

  • #11
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Issued solved thankyou kindly


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •