partition functions (was Re: CHIMP) - General Discussion and Assistance - CHDK Forum

partition functions (was Re: CHIMP)

  • 6 Replies
  • 6196 Views
partition functions (was Re: CHIMP)
« on: 25 / June / 2017, 20:11:52 »
Advertisements
Quote
swap_partitions(2) makes the second partition first, so get_part_type() returns the wrong data.
Yeah, sounds like a bug, either in the active partition logic or swapping code. I'm not totally sure it was originally intended to reflect updates before reboot, but swap does update mbr_buf in RAM so it seems like it should.

Fixed. The size is still wrong, but that I can live with.

Edit: Patch.
« Last Edit: 26 / June / 2017, 13:31:37 by reyalp »
Author of CHIMP, Canon Hack Installation and Management Platform

Re: Re: CHIMP - Canon Hack Installation and Management Platform
« Reply #1 on: 26 / June / 2017, 11:31:21 »
Fixed. The size is still wrong, but that I can live with.

Fixed the size as well (Source).

I've been thinking. Although it seems I'm the first one to actually use this function, it might be worth making it backward-compatible by adding the partition number (1 or above) as an optional argument. Both modified/added C functions already take a partition number parameter, and if it's 0, return info for the active partition.

P.S. Please split from the CHIMP topic.
« Last Edit: 26 / June / 2017, 11:35:46 by dmitrys »
Author of CHIMP, Canon Hack Installation and Management Platform

*

Offline reyalp

  • ******
  • 14119
Re: partition functions (was Re: CHIMP)
« Reply #2 on: 26 / June / 2017, 13:33:02 »
Split from https://chdk.setepontos.com/index.php?topic=13091.80 (there was some more discussion in earlier posts too, but it was mixed with other stuff)
Don't forget what the H stands for.

Re: partition functions (was Re: CHIMP)
« Reply #3 on: 26 / June / 2017, 13:38:22 »
Split from https://chdk.setepontos.com/index.php?topic=13091.80 (there was some more discussion in earlier posts too, but it was mixed with other stuff)

Thanks. Initial post on the bug.
Author of CHIMP, Canon Hack Installation and Management Platform


Re: partition functions (was Re: CHIMP)
« Reply #4 on: 27 / June / 2017, 10:49:25 »
I'm trying to add the optional argument to the Lua function. This is what it looks like right now:
Code: (modules/luascript.c) [Select]
static int luaCB_get_partitionInfo( lua_State* L )
{
    if (camera_info.cam_has_multipart)
    {
      int part;
      int count = get_part_count();
      int active = get_active_partition();
      switch (lua_gettop(L))
      {
      case 0:
        part = 0;
        break;
      case 1:
        part = luaL_checknumber(L, 1);
        if (part < 1 || part > count)
        {
          return luaL_error(L, "invalid partition number");
        }
        break;
      default:
         return luaL_error(L, "invalid argument count");
      }
      lua_createtable(L, 0, 4);
      SET_INT_FIELD("count",  count);
      SET_INT_FIELD("active", active);
      SET_INT_FIELD("type",   get_part_type(part));
      SET_INT_FIELD("size",   get_part_size(part)>>10);
      return 1;
    }
    return 0;
}

Calling get_partitionInfo() from a PTP test client crash. What am I doing wrong?
Author of CHIMP, Canon Hack Installation and Management Platform

*

Offline reyalp

  • ******
  • 14119
Re: partition functions (was Re: CHIMP)
« Reply #5 on: 27 / June / 2017, 13:44:38 »
Calling get_partitionInfo() from a PTP test client crash. What am I doing wrong?
I could easily be missing something, but I don't see anything obvious wrong with that code. A romlog (http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29) can sometimes help debug crashes.
Don't forget what the H stands for.

Re: partition functions (was Re: CHIMP)
« Reply #6 on: 27 / June / 2017, 16:03:06 »
I could easily be missing something, but I don't see anything obvious wrong with that code. A romlog (http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29) can sometimes help debug crashes.

I'm sorry I was unclear. It's the .NET PTP client that was crashing. Anyway, uploading an updated LUALIB seems to have solved the problem.

return get_partitionInfo() now gives the same bogus results as it did before; see screenshot.

Edit: Patch.
« Last Edit: 27 / June / 2017, 16:09:45 by dmitrys »
Author of CHIMP, Canon Hack Installation and Management Platform

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal