chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k - General Discussion and Assistance - CHDK Forum  

chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k

  • 16 Replies
  • 9970 Views
Advertisements
Hello CHDK enthusiasts!

I'm currently trying (and failing miserably) to build a working version of chdkptp on GNU/Linux (ubuntu 11.10, i686).
First of all, I use the last CHDK and CHDKPTP svn trunk sources (resp. Rev 2103 / Rev 286). (I also tried with other versions with same result).
I can build the complete chdk "firzipsubcomplete" image for my ixus40_sd300_100k, which installs on sd card and works great.
I can build the chdkptp tool in order to help pushing/debugging lua scripts on the camera, but always get the same kind of errors when I try to use it:
(first I disabled the libgphoto2 udev rules to avoid gvfs automounting of ptp device)
$ cd lua/
$ ../chdkptp -i
___> list
unexpected return code 0x2fd
ERROR: Could not close session!
!1: b=002 d=019 ERROR: error
___> connect
unexpected return code 0x2fd
ERROR: error
con> ls
unexpected return code 0x2ff
ERROR: ptp error
con> reboot
unexpected return code 0x2ff
ERROR: failed
con> dis
ERROR: Could not close session!

I've also tried to change the CHDK_SRC_DIR,  pointing to chdk source dir and rebuild, but same result.
I'm trying to sniff the usb trafic with usbmon (as attached to this post) corresponding to a chdkptp "list" command:
___> list
unexpected return code 0x2fd
ERROR: Could not close session!
!1: b=002 d=020 ERROR: error

So, I'm stuck here, no big deal though, I can remove the SD card, write my lua script on it and put it back in the camera, but this is quite tedious.
Is there any possibility to find what's going wrong or enable a "debug" mode in chdkptp ?
Anyway, I'm fond of chdk and associated tools, fantastic work, you all rock !
Regards,
sebh

*

Offline reyalp

  • ******
  • 14080
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #1 on: 26 / August / 2012, 14:52:48 »
Some things you can try:
- Does it work if you run as root ?
- Are there any messages in the system logs (dmesg | tail, /var/log/messages etc)
- do you have any other PTP devices (not canon or not chdk) connected to your PC ?

0x2fd is PTP_ERROR_RESP_EXPECTED which is not one I've seen before (although I did recently change the code, previously, many errors would get transformed into PTP_ERROR_IO instead of returning the original error code). This is a local error code (i.e. defined in chdkptp, not system) which can be generated in exactly one place: ptp.c ptp_usb_getresp if you want to look.

Another thought, the ixus40_sd300 is a very old USB 1.1 camera. srsa_4c mentions here: http://chdk.setepontos.com/index.php?topic=4338.msg89719#msg89719 that another old USB 1.1 camera needs a special hack in chdkptp to work. You may want to look at that.

Quote
I've also tried to change the CHDK_SRC_DIR,  pointing to chdk source dir and rebuild, but same result.
Your problem is related to accessing the device, so it's safe to say you don't need to do anything with this.

edit:
typo dmes->dmesg
« Last Edit: 26 / August / 2012, 16:04:56 by reyalp »
Don't forget what the H stands for.

Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #2 on: 27 / August / 2012, 15:37:34 »
thanks for the hints.
Unfortunately, I get the same error when I run chdkptp as root.
In the syslog, I get these:

Aug 27 20:44:57 mythtv kernel: [31622.640067] usb 5-1: new full-speed USB device number 8 using uhci_hcd
Aug 27 20:44:57 mythtv mtp-probe: checking bus 5, device 8: "/sys/devices/pci0000:00/0000:00:1d.3/usb5/5-1"
Aug 27 20:44:57 mythtv mtp-probe: bus: 5, device: 8 was not an MTP device
Aug 27 20:45:15 mythtv kernel: [31640.700065] usb 5-1: reset full-speed USB device number 8 using uhci_hcd
Aug 27 20:45:30 mythtv kernel: [31655.136113] usb 5-1: USB disconnect, device number 8

the "reset full-speed" occurs when I run the "list" command in chdkptp
the ixus is the only ptp device being connected.
I have tried to modify ptp.c according to srsa_4c's patch at the end of ptp_usb_senddata:


   if ((usbdata.length & (params->max_packet_size-1)) == 0)
//ugly spec case for PowerShot A410  ...ixus40??
          if (!((params->vendor_id==0x04a9) && ((params->product_id==0x30f9) || (params->product_id==0x30bf)) && (usbdata.length==0x40)))
      params->write_func(data, 0, params->data);

without altering the rest , rebuilt and run, but got the same result to the same commands.

I tried to monitor the usb trafic with wireshark, but as I couldn't find a "USB for Dummies" book I could not understand anything from that :-)
here is a chdkptp session corresponding to the wireshark capture of usb trafic (pluging the device, waiting ~10s, typing the commands with a delay of ~10s to see them in the timestamps).
I don't know if anyone can get useful infos from that,  but I will keep trying :-)

___> set
time 0.0001
r 0 0/s w 0 0/s
cli_time=true
cli_xferstats=true
cli_verbose=1
cli_source_max=10
___> list
unexpected return code 0x2fd
ERROR: Could not close session!
time 5.4290
r 0 0/s w 0 0/s
!1: b=005 d=011 ERROR: error
___> c
unexpected return code 0x2fd
time 0.0520
r 2048 39377/s w 44 846/s
ERROR: error
con> dis
ERROR: Could not close session!
time 5.2699
r 0 0/s w 0 0/s
« Last Edit: 27 / August / 2012, 15:41:38 by sebh »

*

Offline srsa_4c

  • ******
  • 4451
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #3 on: 27 / August / 2012, 16:08:48 »
@sebh
Try the camera with standard PTP clients (like gphoto, or anything based on libgphoto). I have a feeling that it's either a hardware or kernel issue. I haven't been able to do anything useful with my S1IS (testing CHDK PTP support) on my current PC (nVidia MCP78S/Geforce 8200 based, running kernel 3.1, x86), because of similarly unstable connection.
Quote
I have tried to modify ptp.c according to srsa_4c's patch at the end of ptp_usb_senddata
That was based on camera behaviour while running a certain test (http://chdk.setepontos.com/index.php?topic=4338.msg87103#msg87103), this situation seems to be different (the A410 has no similar basic communication problems).

update: just tried again, the camera (S1IS) does work fine without CHDK's PTP support. It has to be some compatibility issue affecting the oldest CHDK-capable cameras (S1, Ixus30, Ixus40)...
« Last Edit: 27 / August / 2012, 17:13:56 by srsa_4c »


Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #4 on: 28 / August / 2012, 05:09:11 »
Hi,
libgphoto2-based tools (like shotwell) start automagically provided the right udev rule (40-libgphoto2.rules) is at the right place.

Just to confirm, I tried ptpcam included with libptp2 source:

guest@mythtv:/usr/local/src/libptp2-1.1.10/src$ ./ptpcam -o

Listing supported operations...
Camera: Canon DIGITAL IXUS 40
  0x1014: GetDevicePropDesc
  0x1015: GetDevicePropValue
  0x1016: SetDevicePropValue
  0x1017: ResetDevicePropValue
  0x1001: GetDeviceInfo
  0x1002: OpenSession
  0x1003: CloseSession
  0x9013: CANON CheckEvent
  0x901f: UNKNOWN
  0x900e: UNKNOWN
  0x900f: UNKNOWN
  0x9010: UNKNOWN
  0x9011: UNKNOWN
  0x1004: GetStorageIDs
  0x1005: GetStorageInfo
  0x1006: GetNumObjects
  0x1007: GetObjectHandles
  0x1008: GetObjectInfo
  0x1009: GetObject
  0x100a: GetThumb
  0x101b: GetPartialObject
  0x100c: SendObjectInfo
  0x100d: SendObject
  0x100b: DeleteObject
  0x100f: FormatStore
  0x1012: SetObjectProtection
  0x9001: CANON GetObjectSize
  0x9021: CANON GetFolderEntries
  0x901b: CANON GetPartialObject
  0x901e: UNKNOWN
  0x9019: UNKNOWN
  0x9006: UNKNOWN
  0x901c: UNKNOWN
  0x9002: UNKNOWN
  0x9027: UNKNOWN
  0x9024: UNKNOWN
  0x9025: UNKNOWN
  0x9022: UNKNOWN
  0x9026: UNKNOWN
  0x9023: UNKNOWN
  0x9999: UNKNOWN

« Last Edit: 28 / August / 2012, 05:12:28 by sebh »

*

Offline srsa_4c

  • ******
  • 4451
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #5 on: 28 / August / 2012, 09:04:48 »
Just to confirm: my Ixus30 does the same (it's still on CHDK 0.9.9), regular PTP works, chdkptp not. So, it really looks like
It has to be some compatibility issue affecting the oldest CHDK-capable cameras (S1, Ixus30, Ixus40)...
meaning: the correct firmware functions are available and found, but somehow do not work as expected...

*

Offline reyalp

  • ******
  • 14080
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #6 on: 28 / August / 2012, 12:53:45 »
Hi,
libgphoto2-based tools (like shotwell) start automagically provided the right udev rule (40-libgphoto2.rules) is at the right place.

Just to confirm, I tried ptpcam included with libptp2 source:
This is quite interesting, because chdkptp is closely based on ptpcam. Can you try the CHDK version ptpcam, included in the chdkde source here http://trac.assembla.com/chdkde/browser/trunk/tools/ptpcam ?

Just to confirm: my Ixus30 does the same (it's still on CHDK 0.9.9), regular PTP works, chdkptp not. So, it really looks like
It has to be some compatibility issue affecting the oldest CHDK-capable cameras (S1, Ixus30, Ixus40)...
meaning: the correct firmware functions are available and found, but somehow do not work as expected...
This is odd because the error in sebh's original post looks like it happens before any CHDK specific stuff.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #7 on: 28 / August / 2012, 13:36:50 »
@reyalp
Tried the CHDKDE ptpcam fork (after doing this). It doesn't work in chdk mode
Code: [Select]
./ptpcam -v --chdk
unexpected return code 0x2fd
error: cannot get camera CHDK PTP version; either it has an unsupported version or no CHDK PTP support at all
<conn> mode 1
usb_bulk_write: Connection timed out
unexpected return code 0x2ff
mode switch failed!
But it does work in non-CHDK mode. Just like the libgphoto based PTP support for KDE.

Note that I haven't touched that port since October 2011 (time to do so :) )

add_ptp_handler has been found by the sigfinder, PTP support is enabled.
Each failure results in a line like this in syslog:
Code: [Select]
usb 4-1: reset full speed USB device number 5 using ohci_hcd
« Last Edit: 28 / August / 2012, 14:59:50 by srsa_4c »


*

Offline reyalp

  • ******
  • 14080
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #8 on: 28 / August / 2012, 16:02:49 »
OK, i see now it's actually failing in one of the chdk command that's implicit on connect in chdkptp, that clears things up a bit.

Might be worth looking the ptp_data structure and and the functions it points to. If canon moved something around or added parameters to the functions, that might explain it.

The reset may be due to the ptp code trying to recover from an error.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: chdkptp build on ubuntu (11.10 32bit) failing with ixus40_sd300_100k
« Reply #9 on: 29 / August / 2012, 13:52:21 »
Might be worth looking the ptp_data structure and and the functions it points to. If canon moved something around or added parameters to the functions, that might explain it.
Thanks for the advice, I've found one difference. send_resp() in ptp_data has an additional parameter (always 0). Connection now works, file download works, but "ls" does not return anything (there are no error messages). Other commands which echo something (rmem, version) work well.

Code: [Select]
con> ls
con 1>

I'll try a quick port to 1.1...
« Last Edit: 29 / August / 2012, 15:21:22 by srsa_4c »

 

Related Topics