DryOS - some success

  • 220 Replies
  • 105776 Views
*

Offline jeff666

  • ****
  • 181
  • A720IS
  • Publish
    Re: DryOS - some success
    « Reply #100 on: 12 / January / 2008, 12:56:04 »
    Advertisements
    nothing substantial was changed besides this file and the entire SDHC handling + SDlock (which can be handled through the keyboard code, I read?

    As stated by GrAnd the SDLock is just another switch and thus managed in the keyboard-handler.
    You might even have some success by deleting the corresponding bit from the loop in spytask. The lines in the platform/generic/kbd.c are

    #define SD_READONLY_FLAG (0x20000)
    physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;

    Cheers.

    *

    Offline GrAnd

    • ****
    • 916
    • [A610, S3IS]
      • CHDK
  • Publish
    Re: DryOS - some success
    « Reply #101 on: 12 / January / 2008, 15:17:57 »
    edit: state updated, currently missing:
    strncmp strchr strncpy strcat strrchr strtol strpbrk

    Found "by the way".
    Code: [Select]
    strncpy                                     FFC0E84C   
    strrchr                                     FFC71BCC   
    strstr                                      FFD62534   
    CHDK Developer.

    *

    Offline ewavr

    • ****
    • 1057
    • A710IS
  • Publish
    Re: DryOS - some success
    « Reply #102 on: 12 / January / 2008, 16:52:34 »
    Code: [Select]
    strncpy                                     FFC0E84C   
    strrchr                                     FFC71BCC   
    strstr                                      FFD62534   

    Thanks.

    Instead of opendir, readdir, closedir I found OpenFastDir (0xFFDC1B04), ReadFastDir (0xFFDC1B980) and CloseFastDir(0xFFDC1C68) - names are from VxWorks cameras. ReadFastDir is similar to readdir(), but:
    - prototype is:  int ReadFasrDir(DIR* d, struct dirent * de) - return 1 if "d" is valid argument
    - don't fill buffer for deleted files
    - can read non-latin (cyrillic, for example) filenames (or only DRYOS can this?)

    Would do well to use these functions in VxWorks cameras.

    edit: struct dirent contain file name (8.3), attributes, size and create/modification/access time:

    struct dirent {
        char                name[13];  // in reality all members 4-byte aligned
        unsigned long   unk1;
        unsigned char  attrib;
        unsigned long   size;
        unsigned long   time1;
        unsigned long   time2;
        unsigned long   time3;
    };

    edit2: Also works fine on A710 (VxWorks).

    edit3: Work continued,
     NHSTUB(qsort, 0xFFD62A14)
    « Last Edit: 14 / January / 2008, 07:12:02 by ewavr »

    *

    Offline intrinsic

    • *
    • 29
    • S5IS
  • Publish
    Re: DryOS - some success
    « Reply #103 on: 12 / January / 2008, 19:33:35 »
    Edit3: It does seem to be required, though... my camera won't boot when I replace STRD by STR or STRH or comment it out. If replacing it by two STR instructions fixes the problem, it seems that it does do the right thing then.

    My cam boots fine running the code you published with the strd's substituted by str's, I would suggest that as your code will eventually end up in trunk and 3.4.6 is the recommended version for building trunk that you're better writing your code against that, it certainly seems to be something that's changed from 3.4.3 to 3.4.6.


    *

    Offline jeff666

    • ****
    • 181
    • A720IS
  • Publish
    Re: DryOS - some success
    « Reply #104 on: 14 / January / 2008, 08:11:23 »
    Quote from: DataGhost
    http://stack.dataghost.com/chdk/20080112-platform-s5is-sub-101b-boot.c

    I had a look in the file, located the function(s) in the S5 and A720 firmware and found the function-path in the A720 firmware to be much simpler than in the S5. It's still more complex than it would be with VxWorks, thanks to the missing CreateTaskHookAdd.
    I suggest we all go to our nearest canon dealer and whine about missing features :)

    If I'm awake enough this evening, I will port your code to the A720.

    Quote from: GrAnd
    Code: [Select]
    strncpy                                     FFC0E84C   
    strrchr                                     FFC71BCC   
    strstr                                      FFD62534   
    Quote from: ewavr
    NHSTUB(qsort, 0xFFD62A14)

    How do you find such functions? Great Work, btw.

    Cheers.

    *

    Offline GrAnd

    • ****
    • 916
    • [A610, S3IS]
      • CHDK
  • Publish
    Re: DryOS - some success
    « Reply #105 on: 14 / January / 2008, 09:05:44 »
    How do you find such functions? Great Work, btw.

    Accidentally... :D
    Found some similar functions in A610 and A720 firmwares, which uses stdlib functions. Then checked the calls sequences.
    For ex, a function in A610 calls the functions:
    Code: [Select]
    unknown
     strlen
     strstr
     strlen
     strcpy
     unknown
     strrchr
     strncpy

    The same function in the A720:
    Code: [Select]
    unknown
     strlen
     unknown
     strlen
     strcpy
     unknown
     unknown
     unknown
    So, it's quite understandable which 'unknown' should be what. :)
    CHDK Developer.

    *

    Offline ewavr

    • ****
    • 1057
    • A710IS
  • Publish
    Re: DryOS - some success
    « Reply #106 on: 14 / January / 2008, 09:28:53 »
    How do you find such functions?
    I found some function (sub_FFCAD560 in a720, sub_FFE59E00 in a710), which calls qsort() - near "Dataset.c" string. qsort() in a710 and a720 not too similar, but I tested it in a720, it works.

    Work continued, found (and tested):

    NHSTUB(strncmp, 0xFFC71B5C)
    NHSTUB(strchr, 0xFFC71BA8)
    NHSTUB(strcat, 0xFFC71B20)
    NHSTUB(strtol, 0xFFC1FC0C)

    But strpbrk() not found  :(

    is*() functions did not exist in a720 (replaced by macros) - compare sub_FFCA625C in a720 and sub_FFE4C96C in a710. Requires its own implementation of these functions - via lookup table? (like this and this)

    Currently not found: time, localtime, utime, strpbrk (or its replacement).

    edit: NHSTUB(time, 0xFFC55F0C) == Time
    instead of localtime() I found LocalTime(): NHSTUB(LocalTime, 0xFFC56058): struct tm * LocalTime(const unsigned long *, struct tm *);
    struct tm is the same as in VxWorks (stdlib).
    strpbrk() implementation can be found here - or copied from VxWorks firmware.

    need: utime()
    « Last Edit: 14 / January / 2008, 12:09:18 by ewavr »

    *

    Offline DataGhost

    • ****
    • 314
    • EOS 40D, S5IS
      • DataGhost.com
  • Publish
    Re: DryOS - some success
    « Reply #107 on: 14 / January / 2008, 14:41:21 »
    Small (depends on your viewpoint, though) update on the S5: the keyboard will now do whatever I want, OS functions still supported :) The code still looks like a complete mess, though, it doesn't even run in it's own task yet. Currently, it's constantly called from within the gui functions, since I could not get a proper task hook going before, so I placed all my code in there. Still loads of work to do, but I'm getting closer and closer :)


    *

    Offline lukg

    • ***
    • 162
    • Eos 450D+18-55is+55-250is & Powershot S5is - 1.01a
  • Publish
    Re: DryOS - some success
    « Reply #108 on: 14 / January / 2008, 15:14:29 »
    Great Dataghost! do you think that your final working chdk will work even in firmware v1.00a?

    *

    Offline DataGhost

    • ****
    • 314
    • EOS 40D, S5IS
      • DataGhost.com
  • Publish
    Re: DryOS - some success
    « Reply #109 on: 14 / January / 2008, 15:54:14 »
    I'm fairly certain that it won't. If they added just a couple of lines, it would screw up *all* alignment in the rest of the code. Once I get this done, though, I could have a look at the 1.01a firmware... (wait, did you say 1.00a? I'll need a dump for that) ...and point the code to the right addresses, as the differences shouldn't be as big as S5 <--> A720 :) This will still require time, though, and personally I think there are enough people here, with at least limited knowledge, who can do this based on the code I'm producing, so I probably won't have to do that. I'll first have to get the rest working and clean up my code, though, I'm constantly changing stuff around :)

     

    Related Topics