6

I'd like to copy a firmware update file to my Canon 7D camera, connected via USB.

After it was auto-mounted by thunar + thunar-volman + gvfs-gphoto2 I tried the following:

$ cp eos7d-v205-win/7D000205.FIR /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/
$ echo $?
0
$ ls /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/
DCIM  MISC

So that went into a black hole.


The first time I try to copy it with Ctrl-c and Ctrl-v prints the following error message when pasting the file:

Error writing file.

-108: No such file or directory.

Do you want to skip it?

If I try again after that it simply crashes:

$ thunar
Segmentation fault (core dumped)
$ echo $?
139

The Gphoto 2 shell has an undocumented put function which I also tried:

$ sudo umount /run/user/1000/gvfs
$ gphoto2 --shell
gphoto2: {.../eos7d-v205-win} /> help put
Help on "put":

Usage: put [directory/]filename
Description:
        Upload a file

* Arguments in brackets [] are optional

So this function takes a single argument with an optional directory. Weird, but should be doable. Some attempts at making it work:

$ gphoto2 --shell
gphoto2: {.../eos7d-v205-win} /> ls
store_00010001/     
gphoto2: {.../eos7d-v205-win} /> put 7D000205.FIR                       

*** Error ***              
You need to specify a folder starting with /store_xxxxxxxxx/
*** Error (-1: 'Unspecified error') ***
gphoto2: {.../eos7d-v205-win} /> put /store_00010001/7D000205.FIR

*** Error ***              
PTP Access Denied
*** Error (-1: 'Unspecified error') ***
gphoto2: {.../eos7d-v205-win} /> put /store_00010001/MISC/7D000205.FIR

*** Error ***              
PTP Access Denied
*** Error (-1: 'Unspecified error') ***

Maybe it's not supported?


Digikam has an upload feature, but that just reported 'Failed to upload file "7D000205.FIR".' Running it from the shell produced no more information.


man gvfs-copy doesn't explicitly say it can't copy to a camera, but I can't figure out how:

$ gvfs-copy "file://${HOME}/7D000203.FIR" /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A004%2C006%5D/
Error copying file file:///[...]/7D000203.FIR: Error writing file: -1: Unspecified error
$ gvfs-copy "file://${HOME}/7D000203.FIR" file:///run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A004%2C006%5D/
Error copying file file:///[...]/7D000203.FIR: Error opening file '/run/user/1000/gvfs/gphoto2:host=[usb:004,006]': No such file or directory
$ gvfs-copy "file://${HOME}/7D000203.FIR" gphoto2://host\=%5Busb%3A004%2C006%5D/
Error copying file file:///[...]/7D000203.FIR: The specified location is not mounted

gphoto2 says it should be possible to upload files to the camera:

$ gphoto2 --port usb: --abilities
Abilities for camera             : Canon EOS 7D                                
Serial port support              : no
USB support                      : yes
Capture choices                  :
                                 : Image
                                 : Preview
Configuration support            : yes
Delete selected files on camera  : yes
Delete all files on camera       : no
File preview (thumbnail) support : yes
File upload support              : yes

The gphoto2 manual says it supports "uploading" files. It doesn't work. Trying a command reported as working elsewhere:

$ gphoto2 --upload-file 7D000203.FIR --folder /store_00010001
*** Error ***              
PTP Access Denied
*** Error (-1: 'Unspecified error') ***       

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 <[email protected]>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --upload-file 7D000203.FIR --folder /store_00010001

Please make sure there is sufficient quoting around the arguments.

After trying the debug command I get the following relevant log lines:

ptp_usb_getresp [usb.c:434] (0): PTP_OC 0x100c receiving resp failed: PTP Access Denied (0x200f)
put_file_func [library.c:5940](0): 'ptp_sendobjectinfo (params, &storage, &parent, &handle, &oi)' failed: 'PTP Access Denied' (0x200f)
gp_context_error            (0): PTP Access Denied
gp_camera_folder_put_file [gphoto2-camera.c:1248](0): 'gp_filesystem_put_file (camera->fs, folder, filename, type, file, context)' failed: -1
gp_camera_free              (2): Freeing camera...
gp_camera_exit              (2): Exiting camera ('Canon EOS 7D')...
ptp_usb_sendreq             (2): Sending PTP_OC 0x1003 / Close session request...
gp_port_write               (3): Writing 12 = 0xc bytes to port...
gp_port_write               (3): Wrote   12 = 0xc bytes to port: (hexdump of 12 bytes)
 0c 00 00 00 01 00 03 10-0c 00 00 00              ............    

Too many WTFs per minute. What do I need to do to copy a file to my camera in Arch Linux?

In case it's relevant: I tried copying the file on Windows 7, and it also fails:

You do not have permission to create this item.

l0b0
  • 50,672
  • 41
  • 197
  • 360
  • I'm not familiar with the tools you used, but it seems to me like you're trying to send your firmware in the device's standard storage area, where it would normally store media files and other kinds of user data. Shouldn't the firmware be stored differently, like an OS' first sections of code should be stored at byte 0 on a drive? – John WH Smith Feb 25 '15 at 20:01
  • Does copying into the `DCIM` directory work? – remmy Feb 25 '15 at 22:05
  • Also, could you try running something like `gphoto2 --port usb: --abilities`? – remmy Feb 25 '15 at 22:07
  • @JohnWHSmith According to Canon the firmware files should be stored at the root of the camera filesystem. You can then instruct the camera to upgrade to that firmware file. – l0b0 Feb 26 '15 at 07:31
  • @kyrias No, and I have to copy it to the root of the camera filesystem to perform a firmware upgrade. – l0b0 Feb 26 '15 at 07:34
  • Have you tried [**`rsync`**](https://rsync.samba.org/)[?](https://en.wikipedia.org/wiki/Rsync) – Pandya Feb 26 '15 at 09:35
  • @Pandya No, but I don't have the time to try every copying tool ever created. If you can find any hint in the documentation that it might work I'd try it. – l0b0 Feb 26 '15 at 12:20
  • Can't your camera USB link be set to "storage" mode instead of peer-to-peer? –  Mar 03 '15 at 13:39
  • 1
    @Nasha I have gone through the menus, and couldn't find any settings at all for the USB link. – l0b0 Mar 04 '15 at 11:38
  • 1
    Than your best bet, as [dhag](http://unix.stackexchange.com/users/88983/dhag) said, is to use an external compactflash card reader. P-t-P really is a pain in the neck. –  Mar 04 '15 at 19:10

2 Answers2

4

I'm not sure you will like this answer, but, in my experience too, using PTP has always caused a high WTF/min. Presumably the camera itself restricts writing in the root folder, or something equally sensical.

I would suggest getting your hands on a CompactFlash reader, mounting the filesystem directly, and using that type of access to copy your firmware file to the card's root folder (e.g., mount /dev/sdc1 /mnt/camera and then cp eos7d-v205-win/7D000205.FIR /mnt/camera/).

I've found card readers to feel a whole lot faster than PTP, presumably because the former can benefit from your computer's filesystem read-ahead capabilities, while PTP doesn't, so I consider them a worthy (and small) expense.

dhag
  • 15,440
  • 4
  • 54
  • 65
0

You can use gvfs-copy command. The syntax is:

gvfs-copy source-URI destination-URI

So this should work:

gvfs-copy file:///home/user/eos7d-v205-win/7D000205.FIR file:///run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/
ek9
  • 2,875
  • 3
  • 18
  • 27
  • Doesn't seem to work: `Error copying file file:///[...]/7D000203.FIR: Error opening file '/run/user/1000/gvfs/gphoto2:host=[usb:004,005]': No such file or directory`. I don't understand what the target syntax is supposed to be. I haven't found a single working example. – l0b0 Feb 25 '15 at 19:36
  • The target uri for cameras should be something like `gphoto2://[usb:004,005]/store_00010001/MISC` (it's not a `file:///...` uri) ; no camera here atm but IIRC that's how I copied to the camera with `gvfs-copy`... – don_crissti Feb 28 '15 at 01:49
  • Then I just get this error message: `Error copying file file:///home/user/7D000205.FIR: Error writing file: -108: No such file or directory`. Which is *really* weird, because I've verified that the source path exists and is readable by me. – l0b0 Mar 06 '15 at 19:09