[argyllcms] Re: argyll v0.60.2 usb assignments

Op vrijdag 17 november 2006 19:59, schreef Caspar Maessen:

  > Op vrijdag 17 november 2006 15:54, schreef Graeme Gill:
  >   >         # DTP94
  >   >         SYSFS{idVendor}=="0765", SYSFS{idProduct}=="d094", \
  >   >         PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; \
  >   >         printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \
  >   >         NAME="%c", MODE="666"
  >
  >   <...>
  >
  >   > Unfortunately the udev in my Linux system seems to be an early,
  >   > crippled version, and I'm unable to test any of this.
  >
  > I'll give it a try later this evening
And this works:

caspar@casco:~> ls -l /dev/bus/usb/004/004
crw-rw-rw- 1 root root 189, 387 2006-11-17 21:26 /dev/bus/usb/004/004

caspar@casco:~> dispcal -
<...>
 -c listno 
    1 = 'usb:/bus0/dev4 (Xrite DTP94)'
    2 =
<...>

But now I'm curious about how this works. I'll try and give my 
explanation. Please correct where I'm wrong, or complete:

SYSFS{idVendor}=="0765", SYSFS{idProduct}=="d094",
  This is the recognition part. By these two codes the udev-system
  recognizes the fact that the Xrite DTP94 was plugged in.

PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; \
printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'",
  This is the external program that will be executed.
  In this case a series of commands executed in the shell, starting
  with assigning the variable K the value of the kernelname of the
  device. Then from the front of the string "usbdev" is being removed.
  And the remaining is handeled with the formatted print-command. 
  The output is assigned to the udev-substitution $result or %c.

NAME="%c", MODE="666"
  The result of the previous program is the name of the node to be
  created (or has been created in an earlier stage?) and will be given
  the attributes "666" or "rw-rw-rw-".

So, how am I doing so far?

What I can't figure out is the format in the printf command. It is given 
two arguments created form the K-variable by means of substring 
removal. But what is /%%03i/%%03i doing in the format. I referenced the 
man- and info-page, but couldn't find an explanation.


Caspar.
-- 
De problematiek [van de crisisbeheersing en rampenbestrijding] wordt 
vooral als een bestuurlijk probleem bezien, terwijl het een 
commandovoeringsprobleem is. Effectieve crisisbeheersing vereist 
heldere aansturing, simpele commandostructuren, heldere taken en 
bevoegdheden. --Rob de Wijk (Nationaal Congres Rampencoördinatie 2005)

Other related posts: