gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
989 stars 316 forks source link

v2.5.31 Sony (at least A7C aka ILCE-7C) not working anymore - cause: "has_sony_mode_300" #937

Open Bluebrain2000 opened 7 months ago

Bluebrain2000 commented 7 months ago

I noticed that with v2.5.31 the lib does not work with my Sony Alpha 7C (ILCE-7C) anymore. The connection to the camera itself is okay (e.g. gets serial number), but that's it. After looking through the changes from the previous release, v2.5.30, I noticed there was a new sub added to ptp.h, "has_sony_mode_300" (line 4686), which returns 1 for the camera model ILCE-7C.

In ptp.c line 4512 the return value of has_sony_mode_300 decides, if PTP_CNT_INIT (in usb.c) is called with parameter value 0x12c or 0x0c8. Until v2.5.30 this was always 0x0c8 (commented in 2.5.31 with "older mode (200)")

So looks like some older camera models (at least ILCE-7C) were given a new init parameter that's invalid.

If I comment out line 4691, so that has_sony_mode_300 returns 0 and parameter value 0x0c8 is used with PTP_CNT_INIT like it did prior to v2.5.31, everything works again! if (!strcmp(params->deviceinfo.Model, "ILCE-7C")) return 1;

gphoto2 --summary compiled with NOT working libgphoto2 v2.5.31:

Camera summary:
Manufacturer: Sony Corporation
Model: ILCE-7C
  Version: 2.00
  Serial Number: 000000000000000032852331037*****
Vendor Extension ID: 0x11 (1.0)
Vendor Extension Description: Sony PTP Extensions

Capture Formats:
Display Formats: Association/Directory, JPEG, ARW, MPEG, Unknown(b982)

Device Capabilities:
        File Download, No File Deletion, File Upload
        No Image Capture, No Open Capture, Sony Capture

Storage Devices Summary:

Device Property Summary:
White Balance(0x5005):(readwrite) (type=0x4) Enumeration [2,4,32785,32784,6,32769,32770,32771,32772,7,32816,32786,32800,32801,32802] value: Daylight (4)
F-Number(0x5007): error 2002 on query.
Focus Mode(0x500a): error 2002 on query.
Exposure Metering Mode(0x500b): error 2002 on query.
Flash Mode(0x500c): error 2002 on query.
Exposure Program Mode(0x500e): error 2002 on query.
Exposure Bias Compensation(0x5010): error 2002 on query.
Still Capture Mode(0x5013): error 2002 on query.
DOC Compensation(0xd200): error 2002 on query.
DRangeOptimize(0xd201): error 2002 on query.
Image size(0xd203): error 2002 on query.
Shutter speed(0xd20d): error 2002 on query.
Property 0xd20e: error 2002 on query.
Color temperature(0xd20f): error 2002 on query.
CC Filter(0xd210): error 2002 on query.
Aspect Ratio(0xd211): error 2002 on query.
Focus status(0xd213): error 2002 on query.
Zoom(0xd214): error 2002 on query.
Objects in memory(0xd215): error 2002 on query.
Property 0xd217: error 2002 on query.
Battery Level(0xd218): error 2002 on query.
Picture Effect(0xd21b): error 2002 on query.
AB Filter(0xd21c): error 2002 on query.
Property 0xd21d: error 2002 on query.
ISO(0xd21e): error 2002 on query.
Property 0xd21f: error 2002 on query.
Property 0xd221: error 2002 on query.
Capture Target(0xd222): error 2002 on query.
Property 0xd223: error 2002 on query.
Property 0xd22a: error 2002 on query.
Focus Area(0xd22c): error 2002 on query.
Live View Setting Effect(0xd231): error 2002 on query.
Property 0xd235: error 2002 on query.
Property 0xd236: error 2002 on query.
Property 0xd23d: error 2002 on query.
Property 0xd23e: error 2002 on query.
Property 0xd23f: error 2002 on query.
Property 0xd240: error 2002 on query.
Property 0xd241: error 2002 on query.
Property 0xd242: error 2002 on query.
Property 0xd243: error 2002 on query.
Property 0xd244: error 2002 on query.
Property 0xd245: error 2002 on query.
Property 0xd246: error 2002 on query.
Property 0xd247: error 2002 on query.
Property 0xd248: error 2002 on query.
Property 0xd249: error 2002 on query.
Property 0xd24a: error 2002 on query.
Property 0xd24c: error 2002 on query.
Property 0xd24e: error 2002 on query.
Property 0xd24f: error 2002 on query.
Property 0xd250: error 2002 on query.
Property 0xd251: error 2002 on query.
Property 0xd252: error 2002 on query.
Property 0xd253: error 2002 on query.
Property 0xd254: error 2002 on query.
Property 0xd255: error 2002 on query.
Property 0xd259: error 2002 on query.
Property 0xd25a: error 2002 on query.
Property 0xd25b: error 2002 on query.
Property 0xd25c: error 2002 on query.
Property 0xd25d: error 2002 on query.
Property 0xd25f: error 2002 on query.
Property 0xd260: error 2002 on query.
Property 0xd261: error 2002 on query.
Property 0xd262: error 2002 on query.
Property 0xd263: error 2002 on query.
Property 0xd264: error 2002 on query.
Property 0xd267: error 2002 on query.
Property 0xd268: error 2002 on query.
Property 0xd269: error 2002 on query.
Property 0xd26a: error 2002 on query.
Property 0xd26b: error 2002 on query.
Property 0xd26c: error 2002 on query.
Property 0xd26d: error 2002 on query.
Property 0xd26e: error 2002 on query.
Property 0xd26f: error 2002 on query.
Property 0xd270: error 2002 on query.
Property 0xd271: error 2002 on query.
Property 0xd272: error 2002 on query.
Property 0xd273: error 2002 on query.
Property 0xd274: error 2002 on query.
Property 0xd275: error 2002 on query.
Property 0xd276: error 2002 on query.
Property 0xd278: error 2002 on query.
Property 0xd279: error 2002 on query.
Property 0xd27a: error 2002 on query.
Property 0xd27b: error 2002 on query.
Property 0xd27c: error 2002 on query.
Property 0xd27d: error 2002 on query.
Property 0xd27e: error 2002 on query.
Property 0xd27f: error 2002 on query.
Property 0xd280: error 2002 on query.
Property 0xd283: error 2002 on query.
Property 0xd284: error 2002 on query.
Property 0xd285: error 2002 on query.
Property 0xd295: error 2002 on query.
Autofocus(0xd2c1): error 2002 on query.
Capture(0xd2c2): error 2002 on query.
Property 0xd2c3: error 2002 on query.
Still Image(0xd2c7): error 2002 on query.
Movie(0xd2c8): error 2002 on query.
Property 0xd2c9: error 2002 on query.
Property 0xd2cd: error 2002 on query.
Property 0xd2ce: error 2002 on query.
Property 0xd2cf: error 2002 on query.
Property 0xd2d0: error 2002 on query.
Near Far(0xd2d1): error 2002 on query.
Property 0xd2d2: error 2002 on query.
Property 0xd2d5: error 2002 on query.
Property 0xd2d6: error 2002 on query.
Property 0xd2d7: error 2002 on query.
Property 0xd2d8: error 2002 on query.
Property 0xd2d9: error 2002 on query.
Property 0xd2da: error 2002 on query.
Property 0xd2db: error 2002 on query.
AF Area Position(0xd2dc): error 2002 on query.
Property 0xd2dd: error 2002 on query.
Property 0xd2df: error 2002 on query.
Property 0xd2e0: error 2002 on query.
Property 0xd2e1: error 2002 on query.
Property 0xd2e2: error 2002 on query.
Property 0xd2e4: error 2002 on query.
Property 0xd2e5: error 2002 on query.
Property 0xd2e6: error 2002 on query.

compiled with working libgphoto2 v2.5.30 or v2.5.31 with the change I mentioned above:

Camera summary:
Manufacturer: Sony Corporation
Model: ILCE-7C
  Version: 2.00
  Serial Number: 000000000000000032852331037*****
Vendor Extension ID: 0x11 (1.0)
Vendor Extension Description: Sony PTP Extensions

Capture Formats:
Display Formats: Association/Directory, JPEG, ARW, MPEG, Unknown(b982)

Device Capabilities:
        File Download, No File Deletion, File Upload
        No Image Capture, No Open Capture, Sony Capture

Storage Devices Summary:

Device Property Summary:
Compression Setting(0x5004):(readwrite) (type=0x2) Enumeration [16,20,19,18,4,3,2] value: 16
White Balance(0x5005):(readwrite) (type=0x4) Enumeration [2,4,32785,32784,6,32769,32770,32771,32772,7,32816,32786,32800,32801,32802] value: Automatic (2)
F-Number(0x5007):(readwrite) (type=0x4) Range [0 - 65535, step 1] value: f/4 (400)
Focus Mode(0x500a):(readwrite) (type=0x4) Enumeration [2,32773,32772,32774,1] value: Manual Focus (1)
Exposure Metering Mode(0x500b):(readwrite) (type=0x4) Enumeration [32769,32770,32772,32773,32771,32774] value: 32769
Flash Mode(0x500c):(readwrite) (type=0x4) Enumeration [] value: Fill flash (3)
Exposure Program Mode(0x500e):(readwrite) (type=0x4) Enumeration [] value: M (1)
Exposure Bias Compensation(0x5010):(readwrite) (type=0x3) Enumeration [] value: 0.0 stops (0)
Still Capture Mode(0x5013):(readwrite) (type=0x4) Enumeration [1,32786,32789,2,32784,32772,32771,32773,32776,32777,32780,32781,32782,32783,33591,34103,35127,33623,34135,35159,33655,34167,35191,33553,34065,35089,33569,34081,33585,34097,33590,34102,35126,33622,34134,35158,33654,34166,35190,33552,34064,35088,33568,34080,33584,34096,32808,32792,32809,32793] value: 0
DOC Compensation(0xd200):(readwrite) (type=0x3) Enumeration [] value: 0
DRangeOptimize(0xd201):(readwrite) (type=0x2) Enumeration [1,31,17,18,19,20,21] value: 1
Image size(0xd203):(readwrite) (type=0x2) Enumeration [1,2,3] value: 1
Shutter speed(0xd20d):(readwrite) (type=0x6) Range [0 - 4294967295, step 1] value: 0
Property 0xd20e:(readwrite) (type=0x2) Enumeration [] value: 2
Color temperature(0xd20f):(readwrite) (type=0x4) Range [2500 - 9900, step 100] value: 0
CC Filter(0xd210):(readwrite) (type=0x2) Range [164 - 220, step 1] value: 228
Aspect Ratio(0xd211):(readwrite) (type=0x2) Enumeration [1,3,2,4] value: 1
Focus status(0xd213):(readwrite) (type=0x2) Enumeration [] value: 1
Zoom(0xd214):(readwrite) (type=0x6) Range [0 - 4294967295, step 1] value: 4294967295
Objects in memory(0xd215):(readwrite) (type=0x4) Range [0 - 65535, step 1] value: 0
Property 0xd217:(readwrite) (type=0x2) Enumeration [] value: 1
Battery Level(0xd218):(readwrite) (type=0x1) Range [-1 - 100, step 1] value: -1
Picture Effect(0xd21b):(readwrite) (type=0x4) Enumeration [32768] value: 32768
AB Filter(0xd21c):(readwrite) (type=0x2) Range [164 - 220, step 2] value: 228
Property 0xd21d:(readwrite) (type=0x2) Range [0 - 2, step 1] value: 0
ISO(0xd21e):(readwrite) (type=0x6) Enumeration [] value: 16777215
Property 0xd21f:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd220:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd221:(readwrite) (type=0x2) Enumeration [] value: 0
Capture Target(0xd222):(readwrite) (type=0x4) Enumeration [1,17,16] value: 17
Property 0xd223: error 2002 on query.
Exposure Bias Compensation(0xd224):(readwrite) (type=0x3) Enumeration [] value: 0
ISO(0xd226):(readwrite) (type=0x6) Enumeration [16777215,50,64,80,100,125,160,200,250,320,400,500,640,800,1000,1250,1600,2000,2500,3200,4000,5000,6400,8000,10000,12800,16000,20000,25600,32000,40000,51200,64000] value: 16777215
Property 0xd227:(readwrite) (type=0x2) Enumeration [] value: 0
Property 0xd228:(readwrite) (type=0x2) Enumeration [4,5] value: 5
Shutter speed(0xd229):(readwrite) (type=0x6) Enumeration [] value: 0
Property 0xd22a:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd22b:(readwrite) (type=0x2) Enumeration [] value: 0
Property 0xd235:(readwrite) (type=0x2) Enumeration [0,1] value: 1
Property 0xd23e:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd23f:(readwrite) (type=0x2) Enumeration [0,1,2,3,4,5,6,7,8,9,10] value: 0
Property 0xd240:(readwrite) (type=0x2) Enumeration [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] value: 1
Property 0xd241:(readwrite) (type=0x2) Enumeration [8,9] value: 8
Property 0xd242:(readwrite) (type=0x4) Enumeration [33,36] value: 33
Property 0xd243:(readwrite) (type=0x4) Enumeration [] value: 2
Property 0xd244:(readwrite) (type=0x4) Enumeration [] value: 2
Property 0xd245:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd246:(readwrite) (type=0x2) Enumeration [] value: 2
Property 0xd247:(readwrite) (type=0x2) Enumeration [0,1,2,3,17,18,19,20] value: 0
Property 0xd248:(readwrite) (type=0x2) Enumeration [] value: 4
Property 0xd249:(readwrite) (type=0x6) Range [0 - 4294967295, step 1] value: 0
Property 0xd24a:(readwrite) (type=0x6) Range [0 - 4294967295, step 1] value: 0
Property 0xd24b:(readwrite) (type=0x2) Enumeration [] value: 0
Property 0xd24c:(readwrite) (type=0x2) Range [0 - 0, step 1] value: 0
Property 0xd24d:(readwrite) (type=0x2) Enumeration [0,1,2,3,4] value: 0
Property 0xd24e:(readwrite) (type=0x4) Enumeration [] value: 2
Property 0xd24f:(readwrite) (type=0x2) Enumeration [1,2] value: 2
Property 0xd250:(readwrite) (type=0x2) Enumeration [] value: 0
Property 0xd25b:(readwrite) (type=0x2) Enumeration [0,1] value: 0
Property 0xd25c:(readwrite) (type=0x6) Range [0 - 0, step 100] value: 0
Property 0xd25d:(readwrite) (type=0x6) 16777216
Property 0xd25f:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd260:(readwrite) (type=0x2) Enumeration [] value: 1
Property 0xd265:(readwrite) (type=0x2) Enumeration [] value: 0
Property 0xd266:(readwrite) (type=0x2) Enumeration [0,1] value: 1
Autofocus(0xd2c1):(readwrite) (type=0x4) Enumeration [1,2] value: 2
Capture(0xd2c2):(readwrite) (type=0x4) Enumeration [1,2] value: 2
Property 0xd2c3:(readwrite) (type=0x4) Enumeration [1,2] value: 2
Property 0xd2c5:(readwrite) (type=0x4) Enumeration [1,2] value: 1
Still Image(0xd2c7):(readwrite) (type=0x4) Enumeration [1,2] value: 1
Movie(0xd2c8):(readwrite) (type=0x4) Enumeration [1,2] value: 2
Property 0xd2c9:(readwrite) (type=0x4) Enumeration [1,2] value: 2
Near Far(0xd2d1):(readwrite) (type=0x3) Range [-7 - 7, step 1] value: 2
Property 0xd2d5:(readwrite) (type=0x4) Enumeration [1,2] value: 1
Property 0xd2d6:(readwrite) (type=0x4) Enumeration [1,2] value: 1
Property 0xd2d7:(readwrite) (type=0x4) Enumeration [1,2] value: 2
Property 0xd2d8:(readwrite) (type=0x4) Enumeration [1,2] value: 2
Property 0xd2d9:(readwrite) (type=0x4) Enumeration [1,2] value: 2
Property 0xd2dd:(readwrite) (type=0x1) Range [-1 - 1, step 1] value: 1
Property 0xd2de:(readwrite) (type=0x4) Enumeration [1,2] value: 2
msmeissn commented 7 months ago

thanks for the report, merged your fix.

kip666 commented 7 months ago

Exactly the same issue is present with ILCE-7RM4 camera. Commenting out line 4689 in ptp.h fixes it.

Logfile before commenting that line: summary.txt

Bluebrain2000 commented 7 months ago

I guess it will be the same with the other models. I was not able to find any information about this USB initialization value. "mode 200" / "mode 300" But I think it's only relevant for a new, specific camera model.

msmeissn commented 7 months ago

i had imported this from a forked tree, it seems either i missed pieces or did something else wrong.

I will check and revert it probably when I find a bit time,.

romain-ker commented 3 months ago

Same issue also with the ILCE-7RM5 (A7RV) Also fixed by commenting the corresponding line 4695 in ptp.h before recompiling the lib Before that, I was able to record a video but no picture and no control over parameters except white balanced. Now, I can remotely change shutter speed, aperture, and a lot more as well as take pictures through gphoto2.

Until now, and based on comments, it seems that A7C, A7RIV and A7RV are concerned and should be removed from that list. The list may still increase in the future

Ryther commented 2 months ago

Same issue with A7M4 (ILCE-7M4). Now I try to compile while commenting the line out. Had no way to try another version since I use gphoto with the indi drivers and it require the latest version as of now.

EDIT: commenting the line 4694 fix the issue and the camera start working correctly, but I cannot use the manual focus

knro commented 2 months ago

Right, multiple reports about this. Any side effects besides the manual focus @Ryther ?

Ryther commented 2 months ago

Hi @knro, in gphoto2, not one I'm aware of; capturing and downloading, the preview and video capturing are all apparently working correctly. I have a problem in kstars, tho, where if I try to take multiple shots it fails every other one, when using the "Preview" button, and abort on the download of the second shot while trying to get a sequence. If I try to take multiple shots using gphoto2, they're taken and downloaded without problem, so I think it's more a problem of indi/kstars.

msmeissn commented 2 months ago

something seems off with this line. I disabled the 2 cameras more

alexisdrakopoulos commented 1 month ago

Has there been any update on this? Does libgphoto2 work with a7c & a7cii?

Bluebrain2000 commented 4 weeks ago

Yes, they work fine as long as you deactivate "mode_300" for them.

msmeissn commented 4 weeks ago

i have commented out 7C and 7CII was never listed there from mode 300.

just probably not yet in a release.

nagmat84 commented 5 days ago

I found this thread while doing a Google search.

I have got a Sony Alpha 7C II. On the user level, I see an "unknown error 150" when I try to import media from the camera via MTP. (Different programs: KDE dolphin, Gwenview, ...).

Under the hood, all those programs use libgphoto2, version 2.5.31.

There are other reports that Sony Alpha 7C II is supposed to work fine, however those reports refer to older versions of libgphoto2. I could not downgrade to test those versions, because 2.5.31 is the only version included in the package manager of my Linux distro.

I am not sure if my problem is related to the issue at hand. If not, I can open another issue.