This isn't the right answer to my original question, however, it does solve the original problem.
There are two reasons why one would want to change the DS18B20 resolution:
1. To read a single device much more quickly than 750ms
2. To read a bunch of devices more frequently than (#devices * 750ms)
If you want to do 1, then you're stuck - as far as I can tell from the w1_therm source code here there is no support for writing to the config register, and in any case the w1_therm driver has the 750ms wait value hard coded in it.
However, it appears that the w1_therm driver does support multiple calls to devices concurrently. As a read operation is really three steps:
- Issue read command to device
- Wait 750ms
- Read temperature reading
it is actually possible to issue a read command to all your devices, and provided you're not using parasitic power mode there should be enough juice for all your devices to do the temperature conversion concurrently.
How does this work?
readAllSlow looks like this - this is the slow way of reading your devices.
tN is a symbolic link to the file you'd normally read the temperature from the command line.
#!/bin/bash
cat t1
cat t2
cat t3
cat t4
If we run this with time command, on my Pi it takes 3s+ - this is 750ms for each device plus overhead.
However, if we do the reads concurrently like this:
#!/bin/bash
cat t1 &
PID1=$!
cat t2 &
PID2=$!
cat t3 &
PID3=$!
cat t4 &
PID4=$!
wait $PID1
wait $PID2
wait $PID3
wait $PID4
Then timing the script using time takes only 900ms - 1s.
Some caveats - I can't see how w1_therm achieves this as as far as I can see it goes to sleep with the mutex held (so I'm surprised this works).
And an apology for the formatting - I've spent 20 mins trying to figure out how to do formatted code and failed. Hope this helps.