USB problems when gphoto2 runs as cron job

View: New views
3 Messages — Rating Filter:   Alert me  

USB problems when gphoto2 runs as cron job

by dormanttt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to run gphoto2 on an embedded Linux PC as a cron job,
controlling a Canon camera over USB.

It works very well, but I have one problem which I think may be related
to USB permissions. Unfortunately, I'm not very good at systemmy stuff
like this and don't know how to fix it, or even where to look.

I have a script which calls gphoto2 to take a photo and transfer it back
to the computer. This script runs every 5 or 10 minutes, as a user
crontab. The photos are retrieved from the computer using ftp.

This all works.

The problem comes when I ssh to the computer as the same user.
Everything is OK until I log out. This appears to cause the  computer to
freeze completely. I can't ssh and I can't ftp to it. I have to reboot
the computer.

Hardware:
OpenRISC-Alekto ARM9 166MHz 64MB SDRAM, 4MB Flash, USB2.0, 8GB CF

Software:
Debian 5.0, 2.6.26.5-1.0.0-vs, armv4tl, GNU/Linux
gphoto2         2.4.0          gcc, popt(m), exif, cdk, no aa, jpeg,
readline
libgphoto2      2.4.1          gcc, ltdl, EXIF
libgphoto2_port 0.8.0          gcc, ltdl, USB, serial without locking

I would welcome any suggestions on how to investigate or fix this.
--
Roderick Stewart
The Dormant Group
rod@...
www.dormant.org

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gphoto-user mailing list
Gphoto-user@...
https://lists.sourceforge.net/lists/listinfo/gphoto-user

Re: USB problems when gphoto2 runs as cron job

by Stefan Peter-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rod

I don't think that this is connected (directly) with gphoto. Could it be
that your logging-in triggers some memory intensive activity that drains
your host from the resources required to continue its normal routine?
Maybe some image acquisition job that works ok until you log out and
close the controlling terminal? Do you get any messages while being
logged in?
A "ps fax" command upon logging in may reveal any tasks started from the
shells startup command definition. Additional information may be
gathered from the logs on your system.

With kind regards

Stefan Peter

Rod Stewart wrote:

> I'm trying to run gphoto2 on an embedded Linux PC as a cron job,
> controlling a Canon camera over USB.
>
> It works very well, but I have one problem which I think may be related
> to USB permissions. Unfortunately, I'm not very good at systemmy stuff
> like this and don't know how to fix it, or even where to look.
>
> I have a script which calls gphoto2 to take a photo and transfer it back
> to the computer. This script runs every 5 or 10 minutes, as a user
> crontab. The photos are retrieved from the computer using ftp.
>
> This all works.
>
> The problem comes when I ssh to the computer as the same user.
> Everything is OK until I log out. This appears to cause the  computer to
> freeze completely. I can't ssh and I can't ftp to it. I have to reboot
> the computer.
>
> Hardware:
> OpenRISC-Alekto ARM9 166MHz 64MB SDRAM, 4MB Flash, USB2.0, 8GB CF
>
> Software:
> Debian 5.0, 2.6.26.5-1.0.0-vs, armv4tl, GNU/Linux
> gphoto2         2.4.0          gcc, popt(m), exif, cdk, no aa, jpeg,
> readline
> libgphoto2      2.4.1          gcc, ltdl, EXIF
> libgphoto2_port 0.8.0          gcc, ltdl, USB, serial without locking
>
> I would welcome any suggestions on how to investigate or fix this.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gphoto-user mailing list
Gphoto-user@...
https://lists.sourceforge.net/lists/listinfo/gphoto-user

Re: USB problems when gphoto2 runs as cron job

by dormanttt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the info. I have been struggling with this for quite a while and am totally stuck.

Ignore my previous diagnosis - it was made on incomplete data. It has nothing to do with logging off the machine. Here is a full description of the current problem.

1) I want to take regular photos, at intervals of 3 to 10 minutes, on a remote camera.

2) I am using an ARM Linux PC running Linux, attached to the camera by USB. (Hardware details in first message). The camera has two ethernet ports - I have one with a fixed ip and the other with DHCP, and select between them using the ethernet cable.

3) The camera is a Canon S3iS - not a good choice, but forced on me. But I seem to have the same problem with a Nikon D200 (not fully tested).

4) I have a perl script which calls gphoto2 with various setup parameters.

4a) It runs in two modes. When run as a cron job, it takes one frame. From the command line, it takes an infinite number or frames.

4b) It uses the perl system call to run gphoto2. It actually uses it twice, once to set up the camera and the second time to take the photo(s).

4c) It uses a hook file to rename the photo.

5) The computer hangs after the script has run for a time, between half an hour and four hours.

5a) If I am logged on, the shell doesn't recognise any command I type in.

5b) if I am not logged on, the computer does not appear on the network.

6) The hang happens at the same time as a crash of gphoto2. This is usually, but not always, reported in the log file as a problem with the USB port.

7) As far as I can see, there is no software running that could conflict with gphoto2. I'm not a Linux expert, but I have tried to remove anything in the daemons that I don't want. The only other software that I have installed and running at startup is ntpd and vsftpd.

8) The USB permissions seem to be properly set up - my user is in the plugdev group.

9) I can see nothing unusual in any of the user or system log files, but maybe I'm not looking properly.

10) I have set USB_DEBUG = 1, and get the following for each image.

usb_set_debug: Setting debugging level to 1 (on)
usb_os_init: Found USB VFS at /dev/bus/usb
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_set_debug: Setting debugging level to 1 (on)
usb_os_init: Found USB VFS at /dev/bus/usb
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
 value on, t 1
usb_set_debug: Setting debugging level to 1 (on)
usb_os_init: Found USB VFS at /dev/bus/usb
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_set_debug: Setting debugging level to 1 (on)
usb_os_init: Found USB VFS at /dev/bus/usb
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
usb_os_find_devices: couldn't get connect info
Time-lapse mode enabled (interval: 60s).
Capturing frame #1/1...
New file is in location /store_80000001/capt0000.jpg on the camera
Saving file as capt0000.jpg
Deleting file /store_80000001/capt0000.jpg on the camera
Deleting 'capt0000.jpg' from folder '/store_80000001'...

11) I am running gphoto2 with --debug, and get a huge output, some of which is given below.

Any suggestions where to look or what info to post here would be very welcome.

-------------
0.000291 main(2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
0.002163 main(2): gphoto2 2.4.0
0.002911 main(2): gphoto2 has been compiled with the following options:
0.003517 main(2):  + gcc (C compiler used)
0.004093 main(2):  + popt (mandatory, for handling command-line parameters)
0.004683 main(2):  + exif (for displaying EXIF information)
0.005262 main(2):  + cdk (for accessing configuration options)
0.005839 main(2):  + no aa (for displaying live previews)
0.006432 main(2):  + jpeg (for displaying live previews in JPEG format)
0.007009 main(2):  + readline (for easy navigation in the shell)
0.007734 main(2): libgphoto2 2.4.1
0.008395 main(2): libgphoto2 has been compiled with the following options:
0.009001 main(2):  + gcc (C compiler used)
0.009677 main(2):  + ltdl (for portable loading of camlibs)
0.010270 main(2):  + EXIF (for special handling of EXIF files)
0.010928 main(2): libgphoto2_port 0.8.0
0.011590 main(2): libgphoto2_port has been compiled with the following options:
0.012388 main(2):  + gcc (C compiler used)
0.013087 main(2):  + ltdl (for portable loading of camlibs)
0.013681 main(2):  + USB (libusb, for USB cameras)
0.014275 main(2):  + serial (for serial cameras)
0.014869 main(2):  + no resmgr (serial port access and locking)
0.015465 main(2):  + no baudboy (serial port locking)
0.016059 main(2):  + no ttylock (serial port locking)
0.016653 main(2):  + no lockdev (serial port locking)
0.017257 main(2): CAMLIBS env var not set, using compile-time default instead
0.017851 main(2): IOLIBS env var not set, using compile-time default instead
0.019591 main(2): Processing 'model' option ('Canon PowerShot S3 IS (PTP mode)')...
0.020765 gphoto2-abilities-list(2): Using ltdl to load camera libraries from '/usr/lib/libgphoto2/2.4.1'...
0.059813 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/adc65'.
0.060628 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/agfa_cl20'.
0.061267 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/aox'.
0.061884 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/barbie'.
0.062779 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/canon'.
0.063401 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/casio_qv'.
0.064011 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/clicksmart310'.
0.064621 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/digigr8'.
0.065229 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/digita'.
0.065839 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/dimagev'.
0.066450 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/dimera3500'.
0.067059 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/directory'.
0.067669 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/enigma13'.
0.068292 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/fuji'.
0.068901 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/gsmart300'.
0.069512 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/hp215'.
0.070314 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/iclick'.
0.070935 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/jamcam'.
0.071551 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/jd11'.
0.072171 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/kodak_dc120'.
0.072899 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/kodak_dc210'.
0.073531 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/kodak_dc240'.
0.074164 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/kodak_dc3200'.
0.074799 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/kodak_ez200'.
0.075434 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/konica'.
0.076068 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/konica_qm150'.
0.076704 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/largan'.
0.077339 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/lg_gsm'.
0.077970 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/mars'.
0.078930 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/mustek'.
0.079554 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/panasonic_coolshot'.
0.080176 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/panasonic_dc1000'.
0.080797 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/panasonic_dc1580'.
0.081420 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/panasonic_l859'.
0.082040 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/pccam300'.
0.082746 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/pccam600'.
0.083374 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/polaroid_pdc320'.
0.083982 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/polaroid_pdc640'.
0.084603 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/polaroid_pdc700'.
0.085225 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/ptp2'.
0.085847 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/ricoh'.
0.086654 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/ricoh_g3'.
0.087283 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/samsung'.
0.087903 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sierra'.
0.088527 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sipix_blink2'.
0.089147 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sipix_web2'.
0.089766 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/smal'.
0.090388 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sonix'.
0.091007 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sony_dscf1'.
0.091628 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sony_dscf55'.
0.092250 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/soundvision'.
0.092966 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/spca50x'.
0.093593 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sq905'.
0.094214 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/stv0674'.
0.095023 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/stv0680'.
0.095651 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/sx330z'.
0.096272 gphoto2-abilities-list(2): Found '/usr/lib/libgphoto2/2.4.1/toshiba_pdrm11'.
0.097179 gp-abilities-list(2): Found 57 camera drivers.
0.477914 gphoto2-camera(2): Setting abilities ('Canon PowerShot S3 IS (PTP mode)')...
0.478712 setting/gphoto2-setting.c(2): Creating $HOME/.gphoto
0.481190 setting/gphoto2-setting.c(2): Loading settings from file "/home/user/.gphoto/settings"
0.483197 gphoto2-setting(2): Setting key 'model' to value 'Canon PowerShot S3 IS (PTP mode)' (gphoto2)
0.484671 gphoto2-setting(2): Saving 3 setting(s) to file "/home/user/.gphoto/settings"
0.487420 main(2): Processing 'port' option ('usb:001,002')...
0.488682 gphoto2-port-info-list(2): Using ltdl to load io-drivers from '/usr/lib/libgphoto2_port/0.8.0'...
0.490238 gphoto2-port-info-list(2): Called for filename '/usr/lib/libgphoto2_port/0.8.0/disk'.
0.534920 gphoto2-port/disk(2): found 2 volumes
0.606524 gphoto2-port-info-list(2): Loaded 'Media 'Volume (ext3)'' ('disk:/') from '/usr/lib/libgphoto2_port/0.8.0/disk'.
0.607350 gphoto2-port-info-list(2): Loaded 'Media 'Volume (vfat)'' ('disk:/mnt/cf') from '/usr/lib/libgphoto2_port/0.8.0/disk'.
0.608034 gphoto2-port-info-list(2): Loaded '' ('^disk:') from '/usr/lib/libgphoto2_port/0.8.0/disk'.
0.608713 gphoto2-port-info-list(2): Called for filename '/usr/lib/libgphoto2_port/0.8.0/ptpip'.
0.612714 gphoto2-port-info-list(2): Loaded 'PTP/IP Connection' ('ptpip:') from '/usr/lib/libgphoto2_port/0.8.0/ptpip'.
0.613403 gphoto2-port-info-list(2): Loaded '' ('^ptpip') from '/usr/lib/libgphoto2_port/0.8.0/ptpip'.
0.614083 gphoto2-port-info-list(2): Called for filename '/usr/lib/libgphoto2_port/0.8.0/serial'.
0.617678 gphoto2-port-serial(2): Trying to lock '/dev/ttyS1'...
0.621278 gphoto2-port-serial(2): Trying to lock '/dev/ttyS2'...
0.627771 gphoto2-port-info-list(2): Loaded 'Serial Port 1' ('serial:/dev/ttyS1') from '/usr/lib/libgphoto2_port/0.8.0/serial'.
0.628835 gphoto2-port-info-list(2): Loaded 'Serial Port 2' ('serial:/dev/ttyS2') from '/usr/lib/libgphoto2_port/0.8.0/serial'.
0.629516 gphoto2-port-info-list(2): Loaded '' ('^serial') from '/usr/lib/libgphoto2_port/0.8.0/serial'.
0.630196 gphoto2-port-info-list(2): Called for filename '/usr/lib/libgphoto2_port/0.8.0/usb'.
0.645486 gphoto2-port-info-list(2): Loaded 'Universal Serial Bus' ('usb:') from '/usr/lib/libgphoto2_port/0.8.0/usb'.
0.646179 gphoto2-port-info-list(2): Loaded '' ('^usb:') from '/usr/lib/libgphoto2_port/0.8.0/usb'.
0.646853 gphoto2-port-info-list(2): Loaded 'Universal Serial Bus' ('usb:001,002') from '/usr/lib/libgphoto2_port/0.8.0/usb'.
0.647525 gphoto2-port-info-list(2): Loaded 'Universal Serial Bus' ('usb:001,003') from '/usr/lib/libgphoto2_port/0.8.0/usb'.
0.648394 gphoto2-port-info-list(2): Counting entries (12 available)...
0.649072 gphoto2-port-info-list(2): 8 regular entries available.
0.649825 gphoto2-port-info-list(2): Looking for path 'usb:001,002' (12 entries available)...
0.650900 gphoto2-port-info-list(2): Getting info of entry 6 (12 available)...
0.651644 gphoto2-camera(2): Setting port info for port 'Universal Serial Bus' at 'usb:001,002'...
0.663421 gphoto2-port(2): Setting timeout to 5000 millisecond(s)...
0.664185 gphoto2-port(2): Setting settings...
0.664886 libusb(2): gp_port_usb_update(old int=0, conf=-1, alt=-1), (new int=0, conf=-1, alt=-1)
0.665635 gphoto2-setting(2): Setting key 'port' to value 'usb:001,002' (gphoto2)
0.666301 gphoto2-setting(2): Saving 3 setting(s) to file "/home/user/.gphoto/settings"
0.792918 gphoto2-camera(2): Initializing camera...
0.794250 gphoto2-port-usb(1): Looking for USB device (vendor 0x4a9, product 0x311a)... found.
0.794943 gphoto2-port-usb(2): inep to look for is 81
0.795562 gphoto2-port-usb(1): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01
0.796218 gphoto2-camera(2): Loading '/usr/lib/libgphoto2/2.4.1/ptp2'...
0.800935 gphoto2-port(2): Opening USB port...
0.801787 libusb(2): gp_port_usb_open()
0.803414 libusb(2): claiming interface 0
0.804798 ptp2(2): maxpacketsize 512
0.807401 gphoto2-port(2): Setting timeout to 8000 millisecond(s)...
0.808271 ptp(2): PTP: Opening session
0.809089 gphoto2-port(2): Writing 16=0x10 byte(s) to port...
0.809962 gphoto2-port(3): Hexdump of 16 = 0x10 bytes follows:
0000  10 00 00 00 01 00 02 10-00 00 00 00 01 00 00 00  ................

0.811399 ptp2/ptp_usb_getresp(2): reading response
0.812127 ptp2/ptp_usb_getpacket(2): getting next ptp packet
0.813064 gphoto2-port(2): Reading 4096=0x1000 bytes from port...
0.817042 gphoto2-port(2): Could only read 12 out of 4096 byte(s)
0.817758 gphoto2-port(3): Hexdump of 12 = 0xc bytes follows:
0000  0c 00 00 00 03 00 01 20-00 00 00 00              ....... ....