PPCGeeks Forums HTC Arrive HTC HD2 HTC Thunderbolt HTC Touch Pro 2 HTC Evo 4G HTC Evo 3D Samsung Galaxy S II Motorola Droid X Apple iPhone Blackberry
Go Back   PPCGeeks > Windows Mobile > WM HTC Devices > HTC Touch Pro 2 > Android On TP2 > Android On TP2 Development
Register Community Search

Notices


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9 (permalink)  
Old 02-24-2012, 12:19 PM
[ACL]'s Avatar
VIP Member
Offline
Pocket PC: tp2
Carrier: Sprint
Threadstarter
Location: NY
 
Join Date: Feb 2010
Posts: 1,534
Reputation: 6350
[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community[ACL] is a trusted member of the community
Mentioned: 2 Post(s)
Tagged: 0 Thread(s)
Re: [TESTING] - NAND OMGB (1.2.3)

Quote:
Originally Posted by muziling View Post
Finally, easy to prevent erase or overwrite protected partition

platform/msm_shared/nand.c
Code:
int flash_erase(struct ptentry *ptn)
{
    unsigned block = ptn->start;
    unsigned count = ptn->length;

    if (ptn->perm == PERM_NON_WRITEABLE) {
        dprintf(INFO, "%s partition is protected, can't be erased.\n", ptn->name);
        return -1;
    }

    set_nand_configuration(ptn->type);
    while(count-- > 0) {
        if(flash_erase_block(flash_cmdlist, flash_ptrlist, block * 64)) {
            dprintf(INFO, "cannot erase @ %d (bad block?)\n", block);
        }
        block++;
    }
    return 0;
}

int flash_write(struct ptentry *ptn, unsigned extra_per_page, const void *data,
        unsigned bytes)
{
    unsigned page = ptn->start * 64;
    unsigned lastpage = (ptn->start + ptn->length) * 64;
    unsigned *spare = (unsigned*) flash_spare;
    const unsigned char *image = data;
    unsigned wsize = flash_pagesize + extra_per_page;
    unsigned n;
    int r;

    if (ptn->type == TYPE_MODEM_PARTITION)
    {
        dprintf(CRITICAL, "flash_write_image: model partition not supported\n");
        return -1;
    }

    if (ptn->perm == PERM_NON_WRITEABLE) {
        dprintf(INFO, "%s partition is protected, can't be overwrited.\n", ptn->name);
        return -1;
    }
Tested pass:
No, bad method. We arent supposed to keep those partitions. So what i might end up doing is reading, and removing them from the ptable. flash_erase is actually stock code from google/ca since it's not meant to check permissions. But really dood, you are wasting my time with this because you decided to wipe your own nand ? come on man stop spamming my thread.
__________________
Reply With Quote
 

  PPCGeeks > Windows Mobile > WM HTC Devices > HTC Touch Pro 2 > Android On TP2 > Android On TP2 Development


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 03:41 PM.


Powered by vBulletin® ©2000 - 2026, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0
©2012 - PPCGeeks.com