Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: wolf on July 20, 2012, 01:24:16 PM

Title: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: wolf on July 20, 2012, 01:24:16 PM
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



Title: Re: compiling ptpcam
Post by: 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
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: wolf on July 21, 2012, 04:54:23 PM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 21, 2012, 05:02:04 PM
I can compile if I enable PTP and PTP_ML... are they completely different? I'll look in the tools dir.
Title: Re: compiling ptpcam
Post by: rambler on July 21, 2012, 05:04:43 PM
Quote from: 1% on July 21, 2012, 04:48:01 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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 21, 2012, 05:07:43 PM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: wolf on July 21, 2012, 05:13:56 PM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: a1ex on July 21, 2012, 05:17:38 PM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 21, 2012, 05:18:30 PM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: g3gg0 on July 22, 2012, 02:57:55 AM
noticed this thread and the questions.
its already late - will answer tomorrow :)

cya
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: g3gg0 on July 22, 2012, 09:12:11 PM
these are my changes to PTP:

http://upload.g3gg0.de/pub_files/d8a81ee4cc85b10dbb830c72e3585bd9/ptp.diff

but not sure if its still working.

i use the PTP tools from https://tools.assembla.com/svn/chdkde/trunk
and patched it: http://upload.g3gg0.de/pub_files/1190cd7afe35a71dedfb020fed46dbed/ptpcam.diff

BR,
g3gg0
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 22, 2012, 09:23:34 PM
Thanks., will test. Need to add audio_ic_read/write still.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: g3gg0 on July 23, 2012, 12:15:09 AM
thats quite simple if you look at the changes i made to the tools.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: wolf on July 23, 2012, 10:29:36 AM
Thanks. I will try to build...
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 23, 2012, 03:11:38 PM
I think I can call the functions by the address from the changes.. will have to experiment. I connected it last night.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: miyake on July 24, 2012, 03:10:32 PM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 25, 2012, 05:10:47 AM

<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.
Title: Re: compiling ptpcam
Post by: coutts on July 26, 2012, 10:33:37 PM
Quote from: 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
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/
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 27, 2012, 12:22:41 AM
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.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: wolf on July 29, 2012, 03:04:02 PM
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?
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: 1% on July 29, 2012, 10:20:21 PM
Does it have ferrite chokes on it? Maybe that would help. The cheaper cables don't. Otherwise something is broken in the code.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: jplxpto on October 16, 2012, 05:11:48 PM
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

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.

---

  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
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: nanomad on October 16, 2012, 06:22:22 PM
I have no way of checking the 40D stub, but:
- Make sure your Makefile.user contains

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)
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: jplxpto on October 16, 2012, 08:54:04 PM
Quote from: nanomad on October 16, 2012, 06:22:22 PM
I have no way of checking the 40D stub, but:
- Make sure your Makefile.user contains

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...
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: jplxpto on October 23, 2012, 04:15:30 AM
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 :)
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: nanomad on October 23, 2012, 10:01:37 AM
Nice job. You can probably anticipate the register_handler call right after the boot hack and it should work (assuming it's a timing issue on VxWorks)
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: jplxpto on October 30, 2012, 02:16:01 AM
Quote from: nanomad on October 23, 2012, 10:01:37 AM
Nice job. You can probably anticipate the register_handler call right after the boot hack and it should work (assuming it's a timing issue on VxWorks)


nanomad: Thank you.

I have found that some operations are not registered after doing push of my changes. I think it's nothing serious. I had some problems that caused the lock of the camera. I'll have to devote more time to take tests. Despite this problem, the PTP seems to me functional. I also devoted some time trying to debug with GDB stubs but still could not. An error occurred when I started debugging. I have not had time to examine the code in detail. This is not so urgent, so I put on the waiting list.
Title: Re: Compiling ML with ptp-chdk enabled fails cause undefined reference to gui_unlock
Post by: Jed Smith on December 05, 2019, 10:38:59 AM
If you really need lib USB dev, I believe PTP_ML for Android gui is the best of sztupy, but I'm not really sure.แทงบอลสูงต่ำ (https://cmsexpo.net/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%81%E0%B8%97%E0%B8%87%E0%B8%9A%E0%B8%AD%E0%B8%A5%E0%B8%AA%E0%B8%B9%E0%B8%87%E0%B8%95%E0%B9%88%E0%B8%B3/)

From my guess it's ptp_chdk for ptpcam-chdk supports, which should allow to read and write all SD cards.เล่นบอลสูงต่ำยังไง (https://cmsexpo.net/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%81%E0%B8%97%E0%B8%87%E0%B8%9A%E0%B8%AD%E0%B8%A5%E0%B8%AA%E0%B8%B9%E0%B8%87%E0%B8%95%E0%B9%88%E0%B8%B3/)
แทงบอลสูงต่ำราคาดีที่สุด (https://cmsexpo.net/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%81%E0%B8%97%E0%B8%87%E0%B8%9A%E0%B8%AD%E0%B8%A5%E0%B8%AA%E0%B8%B9%E0%B8%87%E0%B8%95%E0%B9%88%E0%B8%B3/)
I have tried this as well because I don't want to delete my SD card often and while I try to do scripts and experiment with ML firmware.แทงบอลสูงต่ำดีมั้ย (https://cmsexpo.net/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%81%E0%B8%97%E0%B8%87%E0%B8%9A%E0%B8%AD%E0%B8%A5%E0%B8%AA%E0%B8%B9%E0%B8%87%E0%B8%95%E0%B9%88%E0%B8%B3/)