Two Qs sparked by sorting several hands full of SD890 and SD990 - page 3 - General Discussion and Assistance - CHDK Forum supplierdeeply

Two Qs sparked by sorting several hands full of SD890 and SD990

  • 28 Replies
  • 3772 Views
*

Offline koshy

  • *****
  • 1096
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #20 on: 12 / April / 2022, 18:26:49 »
Advertisements
Code: [Select]
--[[
@title dump ROM for any cam to file
--]]
binstr=require'binstr'
function getsig(addr)
 return binstr.pack({peek(addr),peek(addr+4)})
end
function printf(...)
    print(string.format(...))
end
function errf(...)
    error(string.format(...),2)
end

if (type(call_event_proc) ~= "function" ) then
    error("your CHDK does not support native calls")
end

if (call_event_proc("System.Create") == -1) then
    error("System.Create failed")
end

local startaddr,os,lcdmsg,msgstr,romsize,xx,XX

startaddr=0
os="unk"
lcdmsg=0
msgstr=0
romsize=0

if (getsig(0xFFC00004)=="gaonisoy") then
startaddr = 0xFFC00000
os = "dry"
elseif (getsig(0xFFC00008)=="Copyrigh") then
startaddr = 0xFFC00000
os = "vx"
elseif (getsig(0xFF810004)=="gaonisoy") then
startaddr = 0xFF810000
os = "dry"
elseif (getsig(0xFF820004)=="gaonisoy") then
startaddr = 0xFF810000
os = "dry"
elseif (getsig(0xFF810008)=="Copyrigh") then
startaddr = 0xFF810000
os = "vx"
elseif (getsig(0xFF000004)=="gaonisoy") then
startaddr = 0xFF000000
os = "dry"
elseif (getsig(0xFF020004)=="gaonisoy") then
startaddr = 0xFF010000
os = "dry"
elseif (getsig(0xFC020004)=="gaonisoy") then
startaddr = 0xFC000000
os = "dry"
romsize = 0x2000000
elseif (getsig(0xE0020004)=="gaonisoy") then
startaddr = 0xE0000000
os = "dry"
romsize = 0x2000000
end
if (romsize==0) then
romsize = 0xFFFFFFFC - startaddr
end

DUMPFILE="A/PRIMARY.BIN"
f=call_event_proc("Fopen_Fut",DUMPFILE,"wb")
if (f==0 or f==-1) then
    errf("Fopen_Fut %s failed %d",DUMPFILE,f)
end
r=call_event_proc("Fwrite_Fut",startaddr,romsize,1,f)
if (r ~= 1) then
    printf("Fwrite_Fut return %d expect 1",romsize)
end
call_event_proc("Fclose_Fut",f)
That is the FW dump, to fix what i had here before the elseifs are needed, otherwise positions seem to get read that can't and boom.
« Last Edit: 12 / April / 2022, 19:26:02 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline koshy

  • *****
  • 1096
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #21 on: 12 / April / 2022, 18:44:32 »
As a file maybe better... Now working.
« Last Edit: 12 / April / 2022, 19:26:42 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline reyalp

  • ******
  • 14079
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #22 on: 12 / April / 2022, 20:19:53 »
As a file maybe better... Now working.
For older cams (vxworks era), you may need SystemEventInit instead of System.Create to register the _Fut functions. The usual pattern is:
Code: [Select]
if call_event_proc('SystemEventInit') == -1 then
    if call_event_proc("System.Create") == -1 then
        error("System.Create failed")
    end
end
Don't forget what the H stands for.

*

Offline koshy

  • *****
  • 1096
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #23 on: 12 / April / 2022, 20:21:36 »
Based on what @Caefix provided I added an optional parameter "CreateRenameBatch" to the script that defaults to "off".

If turned "on" a windows batch file "!Ren2Cam.Bat" will be created which will contain the command like:
Code: [Select]
ren PRIMARY.BIN PRIMARY-IXUS980_SD990-100e.binThat way renaming the FW to something to store away is just a double click when exchanging CHDK for the next cam.

Pretty much what I hoped for and pretty neat. Thanks folks.

For older cams (vxworks era), you may need SystemEventInit instead of System.Create to register the _Fut functions.
Thank you, I added it in.
« Last Edit: 12 / April / 2022, 21:20:59 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)


*

Offline koshy

  • *****
  • 1096
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #24 on: 12 / April / 2022, 21:34:53 »
Returning to the original Questions, this YT find seems promising (do mute this though).
Watch timecode 3:20 through 6:20 lens disassembly and re-assembly in 3 minutes.
PS A2300, but close enough....



Does not loook impossible. Regarding the Sensor: that is not dislocated at all.
Only the other side of the hot mirror filter becomes accessible and I take it that side will be where my little dusty fiends hide.
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #25 on: 14 / April / 2022, 10:40:03 »
 ;) ...  0xFE020004 :blink:  :-[
All lifetime is a loan from eternity.

*

Offline koshy

  • *****
  • 1096
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #26 on: 14 / April / 2022, 11:23:10 »
;) ...  0xFE020004 :blink:  :-[
You know, a little more verbose would be cool. Like: For my IXY 640, which is the Japanese Ixus275/Elph350 HS is see an unexpected adress of 0xFE020004 for "gaonisoy"
You see that is why... The meta data is from the camera you shot the screen of the SX270 with and only the file name tells...

Anyway, are you saying that both my script and the original Canon Basic dumper fail?
 :o Where did the FW dump come from then?

I don't have an IXUS 275 HS but I bought one a few days ago when going over my camera list and looking at added ports.
An SX270 I have, let's see...
« Last Edit: 14 / April / 2022, 11:31:45 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline koshy

  • *****
  • 1096
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #27 on: 14 / April / 2022, 11:47:00 »
If I try the script on the SX270 I get a 32MiB rom dump, but I do not get the batch file.
Seems another of the existing cases handles this and the "gaonisoy" at 0xFE020004 is irrelevant.

Lordy, I made its creation optional and didn't activate the option so what did I expect...
« Last Edit: 14 / April / 2022, 14:51:54 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)


*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Two Qs sparked by sorting several hands full of SD890 and SD990
« Reply #28 on: 14 / April / 2022, 14:33:02 »
but I do not get the batch file.
I got 2. This  #Ren2Cam.bat You can feed with mouse. ::) Move a file in root A/ upon it to get it renamed.
Code: [Select]
XX="-"..string.upper(bi.platform)
XX=XX.."-"..bi.platsub
stw="set x="..XX..crLf.."set s=%1"..crLf.."set s=%s:~0,-4%"..crLf.."set e=%s:~-4,4%"..crLf.."set t=%s:~3,123%%x%"
bat="A/#Ren2Cam.Bat"
txt=io.open(bat,'w')
txt:write(stw..crLf)
        stw="if %~x1?==? (cmd /T:4E/Kdir/b/ad/s/on %1) else (cmd /T:1F/K ren %1 %t%.*)"
txt:write(stw..crLf)
txt:close()
Quote
set x=-SX270HS-102b
set s=%1
set s=%s:~0,-4%
set e=%s:~-4,4%
set t=%s:~3,222%%x%
if %~x1?==? (cmd /T:4E/Kdir/b/ad/s/on %1) else (cmd /T:1F/K ren %1 %t%.*)
Edit: Sorry, forgot .*  :haha
« Last Edit: 14 / April / 2022, 15:30:21 by Caefix »
All lifetime is a loan from eternity.

 

Related Topics