如何将文件*复制到*相机?

l0b*_*0b0 7 arch-linux file-copy files gvfs camera

我想将固件更新文件复制到通过 USB 连接的佳能 7D 相机。

这是后自动安装由thunar+ thunar-volman+gvfs-gphoto2我试过如下:

$ 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
Run Code Online (Sandbox Code Playgroud)

于是就进入了黑洞。


我第一次尝试使用Ctrl-c和Ctrl-复制它v时,在粘贴文件时会打印以下错误消息:

写入文件时出错。

-108: 没有这样的文件或目录。

你想跳过它吗?

如果我在那之后再试一次,它只会崩溃:

$ thunar
Segmentation fault (core dumped)
$ echo $?
139
Run Code Online (Sandbox Code Playgroud)

Gphoto 2 shell 有一个未 公开的put功能,我也尝试过:

$ 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
Run Code Online (Sandbox Code Playgroud)

所以这个功能需要一个单一的与参数可选目录。奇怪,但应该是可行的。使其工作的一些尝试:

$ 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') ***
Run Code Online (Sandbox Code Playgroud)

也许它不受支持?


Digikam 具有上传功能,但刚刚报告“无法上传文件“7D000205.FIR”。' 从 shell 运行它不会产生更多信息。


man gvfs-copy没有明确说它不能复制到相机,但我不知道如何:

$ 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
Run Code Online (Sandbox Code Playgroud)

gphoto2 说应该可以将文件上传到相机:

$ 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
Run Code Online (Sandbox Code Playgroud)

该gphoto2手动表示支持“上传”文件。它不起作用。尝试报告在其他地方工作的命令:

$ 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 <gphoto-devel@lists.sourceforge.net>, 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.
Run Code Online (Sandbox Code Playgroud)

尝试调试命令后,我得到以下相关日志行:

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              ............    
Run Code Online (Sandbox Code Playgroud)

每分钟太多的WTF。我需要做什么才能在 Arch Linux 中将文件复制到我的相机?

如果相关:我尝试在 Windows 7 上复制文件,但它也失败了:

您无权创建此项目。

dha*_*hag 4

我不确定您会喜欢这个答案,但是,根据我的经验,使用 PTP 总是会导致 WTF/min 很高。据推测,相机本身限制在根文件夹中写入,或者同样有意义的东西。

我建议您使用 CompactFlash 读卡器,直接安装文件系统,并使用这种类型的访问将固件文件复制到卡的根文件夹(例如,mount /dev/sdc1 /mnt/camera然后cp eos7d-v205-win/7D000205.FIR /mnt/camera/)。

我发现读卡器感觉比 PTP 快得多,大概是因为前者可以从计算机的文件系统预读功能中受益,而 PTP 则不然,所以我认为它们是值得的(而且很小)的支出。