Distinguishing between cameras with ptpcam - General Help and Assistance on using CHDK stable releases - CHDK Forum  

Distinguishing between cameras with ptpcam

  • 6 Replies
  • 6731 Views
Distinguishing between cameras with ptpcam
« on: 13 / April / 2012, 17:43:02 »
Advertisements
Hey all, another ptpcam question here.

I am using multiple S95's connected to a Linux computer. I would like to know if there is a way to assign a custom name to each S95 that ptpcam can see (other than the S/N).

Let me show you what I've got so far:


$ ./ptpcam -l

Listing devices...
bus/dev   vendorID/prodID   device model
002/006   0x04A9/0x3212   Canon PowerShot S95
002/005   0x04A9/0x3212   Canon PowerShot S95

This is great. Is the device model something that can be changed? Either through modifying something in the CHDK on the camera's card or with ptpcam?

I realize that I can use ./ptpcam -i to get more detailed information, but is any of the editable? And if so, where and how?

$ ./ptpcam --dev=5 -i

Camera information
==================
**DEBUG: open_camera(), dev: 5 bus: 0 force: 0
Model: Canon PowerShot S95
  manufacturer: Canon Inc.
  serial number: '8DA4BC07A9014A3DAFAC1A32B44F8AE5'
  device version: 1-9.0.1.0
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x0064

$ ./ptpcam --dev=5 --show-all-properties

**DEBUG: open_camera(), dev: 5 bus: 0 force: 0
Camera: Canon PowerShot S95 (bus 0, dev 5)
0xd045: 0x0002 (2)
0xd04a: 0
0xd02e: 0x00080000 (524288)
0xd02f: 0x00080000 (524288)
0x5001: 3
0xd002: 0x0000 (0)
0xd003: 0x00000001 (1)
0xd034: 0x4F884612 (1334330898)
0xd047: 0x0002 (2)
0xd046: 0x0101 (257)
0xd030: 0x00000100 (256)
0xd049: 0x02950000 (43319296)
0xd032: "Canon PowerShot S95"
0xd033:
0xd031: 0x01000000 (16777216)
0xd050: 0
0xd051:
0xd402: "Canon PowerShot S95"
0xd406: "Windows"
0xd407: 0x00000001 (1)
0xd303: 1

All of these properties are exactly the same for the other camera except for 0xd034: 0x4F88461B (1334330907).

However, it doesn't seem like any of these "properties" can be set (I only tried the ones without values in them initially):

$ ./ptpcam --set-property=0xd051 --val="test"

**DEBUG: open_camera(), dev: 0 bus: 0 force: 0
Camera: Canon PowerShot S95
'UNKNOWN' is set to:
Changing property value to test [(null)] FAILED!!!
PTP: I/O error
ERROR: Could not close session!

$ ./ptpcam --set-property=0xd051 --val=42

**DEBUG: open_camera(), dev: 0 bus: 0 force: 0
Camera: Canon PowerShot S95
'UNKNOWN' is set to:
Changing property value to 42 [(null)] FAILED!!!
PTP: I/O error
ERROR: Could not close session!

Am I not doing this correctly or is this not supported with CHDK?

I noticed that the CHDK customization of ptpcam has some stuff in there for reading and setting memory on the camera:

$ ./ptpcam --chdk="memory 0x1-0xff"

Does anybody know some locations of memory that are possibly unused that could be set to something custom?

Any help would be appreciated.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Distinguishing between cameras with ptpcam
« Reply #1 on: 13 / April / 2012, 19:06:38 »
With the 'Camera Window' software that comes with the camera you should be able to set the 'Owners Name' on each camera - although you'll need a PC or Mac to do it.

I don't know if this would be listed by ptpcam; but it might be worth a try.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Distinguishing between cameras with ptpcam
« Reply #2 on: 13 / April / 2012, 19:41:40 »
I think the Canon firmware responds to the standard PTP operation code 'PTP_OC_GetDeviceInfo' and fills the deviceinfo structure with (among other things) Manufacturer,Model,DeviceVersion and SerialNumber.

*

Offline reyalp

  • ******
  • 14120
Re: Distinguishing between cameras with ptpcam
« Reply #3 on: 13 / April / 2012, 22:33:43 »
I think the Canon firmware responds to the standard PTP operation code 'PTP_OC_GetDeviceInfo' and fills the deviceinfo structure with (among other things) Manufacturer,Model,DeviceVersion and SerialNumber.
Yes, modern cameras return a serial number. Not sure where the cutover is, a540 (digic II vxworks) doesn't, d10 (dryos r31) does.

The owner name should be available as a param http://chdk.wikia.com/wiki/Params which can be read in lua: http://chdk.wikia.com/wiki/Lua/Lua_Reference#Flash_parameters

Setting from lua is not supported, although it should be pretty easy to add.
Don't forget what the H stands for.


*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Distinguishing between cameras with ptpcam
« Reply #4 on: 14 / April / 2012, 04:04:58 »
The owner name is also stored in propertycases. I think only readable.

Propset 2 -> 197
Propset 4 -> 201

Convert the value -> hex -> ASCII.

msl
CHDK-DE:  CHDK-DE links

Re: Distinguishing between cameras with ptpcam
« Reply #5 on: 16 / April / 2012, 15:34:21 »
Ok, I've got a name set with the Canon software and I can retrieve it with the lua command.

It doesn't show up in ptpcam's info or properties, though, but I can see it with this:


$ ./ptpcamx86 --chdk="luar get_parameter_data(7)"
script:1
1:ret:'S95_RGB_18'

The interesting thing is that I set the name to "S95_RGB_1". I used the parameter dump script to get this in a log as well:

...
7: 0x53 0x39 0x35 0x5f 0x52 0x47 0x42 0x5f 0x31 0x00 0x38 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ["S95_RGB_1\0008\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"]
...

Before I had set the name, there was some garbage info in there. Anyone know how to clear that out? Also, what would it take to make this value changeable from a lua script/command?

*

Offline reyalp

  • ******
  • 14120
Re: Distinguishing between cameras with ptpcam
« Reply #6 on: 17 / April / 2012, 01:15:01 »
get_parameter_data() returns the entire param value as a lua string, with however many bytes the Canon firmware thinks it has.

It looks like the name value is null terminated "S95_RGB_1\000"

You can use lua to get everything up to the null, using one of the string functions http://www.lua.org/manual/5.1/manual.html#5.4
e.g.
luar string.match(get_parameter_data(7),'^([^%z]*)')
or something like that

Quote
Also, what would it take to make this value changeable from a lua script/command?
Implement set_parameter_data. This should be fairly easy, I believe the underlying canon function is known. However, it writes to onboard flash, so mistakes could be costly.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal