Author Topic: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock  (Read 19930 times)

wolf

  • Senior
  • ****
  • Posts: 263
Hi,

can't find any gui_unlock function with  grep -r "gui_unlock" in magic-lantern

CONFIG_PYMITE           = n
CONFIG_RELOC            = n
CONFIG_TIMECODE         = n
CONFIG_PTP              = y
CONFIG_PTP_CHDK         = y
CONFIG_PTP_ML           = n
CONFIG_PLUGINS          = y
CONFIG_CONSOLE          = y
CONFIG_DEBUGMSG         = n

I get:

ptp-chdk.o: In function `ptp_handler_PTP_OC_CHDK':
ptp-chdk.c:(.text+0xc4): undefined reference to `gui_unlock'
collect2: ld returned 1 exit status

The other thing is  howto compile ptpcam?
I tried to compile ptpcam from "https://github.com/mweerden/CHDK/zipball/ptp" like mentioned in the  wiki.
$ cd tools/ptpcam/
$ make
gcc -o ptpcam myusb.c properties.c ptp.c ptpcam.c  -lusb
$ ./ptpcam -L

Listing files...
ERROR: Could not open session!
There is also a patches dir
I tried "patch -p1 < {/path/to/patch/file}" but it didnt't work for me. I don't know how to patch.

Is there anywhere a working ptpcam source code without the need to patch or what I'am doing wrong?

Thanks for any hint or help
...Wolfgang


 

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: compiling ptpcam
« Reply #1 on: July 21, 2012, 04:48:01 PM »
I wasn't able to compile ptpcam.


>> Entering to core
gui.c -> gui.o
-> main.elf
arm-elf-gcc: error: unrecognized option '--start-group'
arm-elf-gcc: error: unrecognized option '--end-group'

Also what is the right platform?

Default:
PLATFORM=s3is
PLATFORMSUB=100a

wolf

  • Senior
  • ****
  • Posts: 263
I copied only the tools dir cause I didn't wanted to compile the CHDK firmware which needs to be cross-compiled for arm, as far as I understand it.
ptpcam should run on a Linux box.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
I can compile if I enable PTP and PTP_ML... are they completely different? I'll look in the tools dir.

rambler

  • New to the forum
  • *
  • Posts: 6
Re: compiling ptpcam
« Reply #4 on: July 21, 2012, 05:04:43 PM »
Also what is the right platform?

Default:
PLATFORM=s3is
PLATFORMSUB=100a
Not sure about compile problems (haven't tried since a couple years back), but quite certainly PLATFORM & PLATFORMSUB have nothing to do with ptpcam. Those are for compiling CHDK for a particular camera.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Yea, I think I didn't go into the tools directory and just did make on the whole thing.

Either way:

gcc -o ptpcam myusb.c properties.c ptp.c ptpcam.c  -lusb
myusb.c:32:17: fatal error: usb.h: No such file or directory
compilation terminated.
ptpcam.c:36:17: fatal error: usb.h: No such file or directory
compilation terminated.

wolf

  • Senior
  • ****
  • Posts: 263
You need the usb dev lib.

I believe PTP_ML is for the nice android gui of sztupy, but I am not sure.

I guess ptp_chdk is for ptpcam --chdk support which should allow read and write the whole SD-card.
I try this cause I rather like to remove my SD-card not that often while trying to script and experimenting with ML firmware.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Right, PTP_ML is for the Android app, and the CHDK part is for playing with the firmware.

I didn't touch this for probably more than one year - but I'll ask g3gg0 to post his patch, he is actually using PTP for poking things around.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Yea, I'm being slow, didn't have libusb-dev installed.

I need to send audio_ic_writes from PTP so have to look in the ml ptp-chdk source anyway.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
noticed this thread and the questions.
its already late - will answer tomorrow :)

cya
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Thanks., will test. Need to add audio_ic_read/write still.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3184
thats quite simple if you look at the changes i made to the tools.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

wolf

  • Senior
  • ****
  • Posts: 263
Thanks. I will try to build...

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
I think I can call the functions by the address from the changes.. will have to experiment. I connected it last night.

miyake

  • Developer
  • Senior
  • *****
  • Posts: 396
For windows users:
You do not forget to execute "libusb-win32-bin-1.2.6.0\bin\inf-wizard.exe"
If you do not do this command, you can not see USB device from ptpcam.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Code: [Select]
<conn> c 0xFF06A144 0x6b10
00000000 0
<conn> c 0xFF06A144 0x6b00
00000000 0
<conn> c 0xFF06A144 0x6908
00000000 0
<conn> c 0xFF06A144 0x670f
00000000 0
<conn> c 0xFF06A144 0x67ff
00000000 0
<conn> c 0xFF06A144 0x0100
00000000 0
<conn> c 0xFF06A144 0x2100
00000000 0
<conn> c 0xFF06A144 0x2126
00000000 0


I got some registers to change but it seems like others don't even though they did from calling audio write from ML.

The read only returns 8 for some reason.

coutts

  • Developer
  • Senior
  • *****
  • Posts: 401
Re: compiling ptpcam
« Reply #17 on: July 26, 2012, 10:33:37 PM »
I wasn't able to compile ptpcam.


>> Entering to core
gui.c -> gui.o
-> main.elf
arm-elf-gcc: error: unrecognized option '--start-group'
arm-elf-gcc: error: unrecognized option '--end-group'

Also what is the right platform?

Default:
PLATFORM=s3is
PLATFORMSUB=100a
I had this problem too, compile with normal gcc not arm-elf ;)

I've only succesfully compiled this under ubuntu (same with alex). BUT, ptp-chdk is broken in the current ML code I have discovered. In past versions of ML, the ptp handler was registered. In the current repo, I couldnt' find any calls to ptp_register_handler, which means it never registers the ML ptp handler.


also, the usb error is because you need to install libusb: http://www.libusb.org/

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
the stuff g3gg0 fixed works for most writes at least.

miyake put some new handlers in but I haven't ported them to ptpcam yet. I'm using the version linked.

wolf

  • Senior
  • ****
  • Posts: 263
I am connected and I can write and read files, but if a file is larger than approximatley 50kb then it fails. For me it is not possible to write the autoexec.bin file but I can read it.

I use Arch Linux and the USB cable is 1m long.

Anybody any clue?

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Does it have ferrite chokes on it? Maybe that would help. The cheaper cables don't. Otherwise something is broken in the code.

jplxpto

  • Developer
  • Hero Member
  • *****
  • Posts: 506
Hello guys,

I read this post, and applied the patch and compiled ptpcam but this  command does not work when
I use the switch --chdk. Maybe the stub is wrong.

40D111
Code: [Select]
NSTUB(0xFFB93290, ptp_register_handler)

./ptpcam -i

Camera information
==================
Model: Canon EOS 40D
  manufacturer: Canon Inc.
  serial number: 'xxxxxxxxxxxxxxxx'
  device version: 3-1.1.1
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x00c8

---

ptpcam -l

Listing devices...
bus/dev   vendorID/prodID   device model
001/026   0x04A9/0x3146   Canon EOS 40D

---
lsusb | grep -i canon
Bus 001 Device 026: ID 04a9:3146 Canon, Inc.

---
Code: [Select]
  0x1003: CloseSession
  0x1006: GetNumObjects
  0x1004: GetStorageIDs
  0x9101: UNKNOWN
  0x1005: GetStorageInfo
  0x9102: UNKNOWN
  0x1007: GetObjectHandles
  0x1008: GetObjectInfo
  0x9103: UNKNOWN
  0x1009: GetObject
  0x9104: UNKNOWN
  0x100a: GetThumb
  0x101b: GetPartialObject
  0x9107: UNKNOWN
  0x100c: SendObjectInfo
  0x100d: SendObject
  0x100b: DeleteObject
  0x9105: UNKNOWN
  0x100f: FormatStore
  0x9106: UNKNOWN
  0x9110: UNKNOWN
  0x9127: UNKNOWN
  0x910b: UNKNOWN
  0x9108: UNKNOWN
  0x9109: UNKNOWN
  0x910c: UNKNOWN
  0x910e: UNKNOWN
  0x910f: UNKNOWN
  0x9125: UNKNOWN
  0x9126: UNKNOWN
  0x9115: UNKNOWN
  0x9114: UNKNOWN
  0x9113: UNKNOWN
  0x9116: UNKNOWN
  0x9117: UNKNOWN
  0x9120: UNKNOWN
  0x91f0: UNKNOWN
  0x9118: UNKNOWN
  0x9121: UNKNOWN
  0x91f1: UNKNOWN
  0x911d: UNKNOWN
  0x910a: UNKNOWN
  0x911b: UNKNOWN
  0x911c: UNKNOWN
  0x911e: UNKNOWN
  0x911a: UNKNOWN
  0x9153: UNKNOWN
  0x9154: UNKNOWN
  0x9155: UNKNOWN
  0x9157: UNKNOWN
  0x9158: UNKNOWN
  0x9159: UNKNOWN
  0x911f: UNKNOWN
  0x91fe: UNKNOWN
  0x91ff: UNKNOWN
  0x9801: UNKNOWN
  0x9802: UNKNOWN
  0x9803: UNKNOWN
  0x9804: UNKNOWN
  0x9805: UNKNOWN
  0x91c0: UNKNOWN
  0x91c1: UNKNOWN
  0x91c2: UNKNOWN
  0x91c3: UNKNOWN
  0x91c4: UNKNOWN
  0x91c5: UNKNOWN
  0x91c6: UNKNOWN
  0x91c7: UNKNOWN
  0x91c8: UNKNOWN
  0x91c9: UNKNOWN
  0x91ca: UNKNOWN
  0x91cb: UNKNOWN
  0x91cc: UNKNOWN
  0x91ce: UNKNOWN
  0x91cf: UNKNOWN
  0x91e1: UNKNOWN
  0x91e2: UNKNOWN
  0x91e3: UNKNOWN
  0x91e4: UNKNOWN
  0x91e5: UNKNOWN
  0x91e6: UNKNOWN
  0x91e7: UNKNOWN
  0x91e8: UNKNOWN
  0x91e9: UNKNOWN
  0x91ea: UNKNOWN
  0x91eb: UNKNOWN
  0x91f2: UNKNOWN
  0x91f3: UNKNOWN
  0x91f4: UNKNOWN
  0x91f7: UNKNOWN
  0x9122: UNKNOWN
  0x9123: UNKNOWN
  0x9124: UNKNOWN
  0x91f5: UNKNOWN
  0x91f6: UNKNOWN

---

ptpcam -p

Listing properties...
Camera: Canon EOS 40D
  0xd402: UNKNOWN
  0xd407: UNKNOWN
  0xd406: UNKNOWN

----

ptpcam --show-all-properties

Camera: Canon EOS 40D
0xd402: "Canon EOS 40D"
0xd407: 0x00000001 (1)
0xd406: "Unknown Initiator"

----

ptpcam --chdk

unexpected return code 0x2005
error: cannot get camera CHDK PTP version; either it has an unsupported version or no CHDK PTP support at all

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
I have no way of checking the 40D stub, but:
- Make sure your Makefile.user contains
Code: [Select]
CONFIG_PTP = y
CONFIG_PTP_CHDK = y
CONFIG_GDBSTUB = n

- Use the ptpcam version I uploaded today under contrib/ptpcam
(I also updated the ptp-chdk.(h|c) files so you should probably do a make clean)
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

jplxpto

  • Developer
  • Hero Member
  • *****
  • Posts: 506
I have no way of checking the 40D stub, but:
- Make sure your Makefile.user contains
Code: [Select]
CONFIG_PTP = y
CONFIG_PTP_CHDK = y
CONFIG_GDBSTUB = n

- Use the ptpcam version I uploaded today under contrib/ptpcam
(I also updated the ptp-chdk.(h|c) files so you should probably do a make clean)


Thank you ... I'll test it...

jplxpto

  • Developer
  • Hero Member
  • *****
  • Posts: 506
Hi,

I have news...

I already made some progress with the PTP in 40D.
Finally I was able register the operations of ML & CHDK.
I still did not push because I'm not finished my changes.

I once again used the cache_hacks.

I've got connect me with ptpcam --chdk. I got an error because the version of PTPcam is not compatible with my camera. I still do not know what the impact of that. I made a small patch to ptpcam to recognize the identifiers of our operations.


contrib/ptpcam$ ./ptpcam -o | grep -e "chdk\|ml"
  0x9999: CANON EOS chdk
  0xa1e8: CANON EOS ml

---

echo version |./ptpcam --chdk
error: camera has unsupported camera version 0.1; some functionality may be missing or cause unintented consequences
<conn> ptpcam: 2.0
camera: 0.1
<conn>


Nanomad : I did do what I said :)