Open mochihisa opened 3 years ago
Hi,
The shutter won't open if "the camera is not ready" error happens except you change the F value. I'd like to ask you to confirm that it opened after you changed it manually.
On the other hand, I pushed the experimental fix of this problem. Can you build this branch and run it with debug output enabled? mtplvcap -debug mtp,server
ping @mochihisa
I'm sorry for the late reply. I don't have time right now, so I'll reply later.
I'm getting different output than before. Is there any possibility?
[0000] INFO usb: found: 04b0:041a
[0000] ERROR mtp: fatal error LIBUSB_ERROR_IO; closing connection.
[0000] FATAL mtp: failed to detect MTP devices: could not open 04b0:041a: mtp: no MTP extensions in ''
@mochihisa Sorry for inactivity,
It looks like the camera is not responding in an earlier stage than the original error message (failed to decode header). no MTP extensions in ''
indicates many types of fundamental problems like interfered USB communication, broken USB cables, etc. Please checkout the master branch and see if the problem persists or not.
I'm sorry, I'll be late in replying due to periodic exams.
Sorry for the late reply. The same result was obtained using the master branch. It seems that the cable is not damaged because it can be used for photo transfer.
I found 4 problems with D300.
Nikon D300 firmware A: 1.01, B: 1.00 libusb 1.0.25-3 go 1.18 linux/amd64 Arch Linux 5.17.1-arch1-1
Log (Release 1.5.0 and 3bc52d45 are showed same logs):
$ ./mtplvcap -debug mtp,server
[0000] INFO usb: found: 05ac:821f
[0000] INFO usb: found: 04b0:041a
[0000] WARN mtp: detected more than 1 device
[0000] INFO mtp: opening the detected Nikon DSLR: 04b0:041a
[0000] INFO main: started
[0000] DEBUG lv: manufacturer = NIKON, product = NIKON DSC D300, serialnumber = 000002014808
[0000] DEBUG lv: model matched: D300
[0001] DEBUG lv: current recording media: SDRAM
[0002] WARN lv: workerLV: failed to start live view: the camera is not ready
[0003] WARN lv: frameCaptor: failed to decode header
[0004] WARN lv: frameCaptor: failed to decode header
[0005] WARN lv: frameCaptor: failed to decode header
When I change the header size 64 to 96, 128, 192, 256, 384 (mtp/nikon.go), the resolution and frame rate were displayed correctly on localhost:42389 and "failed to decode header" is not show up. But the image remained broken.
I dumped the raw byte array to binary file for debugging.
I found SOI marker (ffd8) at 0x40 (64). And I tried get JPEG file with this script.
dd bs=1 skip=64 if=debug of=debug.jpg
This image is correct.
I put some bytes (more than or equal 5) to binary.Read and I got works well, But it is dirty hack.
I think liveViewRaw has ommitable element(s).
I need accurate liveViewRaw struct for 64-byte style header.
diff --git a/mtp/server.go b/mtp/server.go
index 1bb11ba..0760695 100644
--- a/mtp/server.go
+++ b/mtp/server.go
@@ -780,7 +780,7 @@ func (s *LVServer) getLiveViewImgInner() (LiveView, error) {
raw := buf.Bytes()
lvr := liveViewRaw{}
- err = binary.Read(bytes.NewReader(raw[8:hs]), binary.BigEndian, &lvr)
+ err = binary.Read(bytes.NewReader(raw[8:hs+5]), binary.BigEndian, &lvr)
if err != nil {
return LiveView{}, fmt.Errorf("failed to decode header")
}
I tried to change f-number but I got ERROR (1.5.0 and 3bc52d45).
$ ./mtplvcap -debug mtp,server
...
[0010] DEBUG lv: HandleControl: set ISO: 2500
[0011] WARN lv: frameCaptor: failed to decode header
[0015] WARN lv: frameCaptor: failed to decode header
[0016] DEBUG lv: HandleControl: set f-number: 10
[0016] ERROR lv: HandleControl: failed to set f-number: failed to set f-number: RetCode a005
[0016] DEBUG lv: current recording media: SDRAM
[0017] WARN lv: workerLV: failed to start live view: the camera is not ready
[0018] WARN lv: frameCaptor: failed to decode header
ISO value does not affect the image w/o error message. (check on 3bc52d45 + dirtyhack)
D300 reports original camera resolution (4288x2848) but image resolution is 640x426. (check on 3bc52d45 + dirtyhack)
This model's ISO and F-value control does not affect to internal LiveView function's image. F-number and ISO may be out-of-control in LiveView mode.
I tried to use it on my D300, but it did not work.
The environment in which it was run is as follows.
OS : Ubuntu 20.10 Version : v1.2.0