Hardware Reference
In-Depth Information
The second thing that will happen is the creation of a new bus in the /sys/bus/w1/devices filesystem. Let's take
a look at that now.
In Figure 3-15 you will see two devices. One has the 54-bit serial ID of your 1-wire device and the other will be the
w1_bus_master , which is the Raspberry Pi. You are going to be more interested in the device attached, in my case the
10-0008027e34ca . If you take a look at that device you will notice there is not much you can do with it. Take a look at
Figure 3-16 as an example.
Figure 3-15. The 1-wire device filesystem listing
Figure 3-16. Empty 1-wire client filesystem
There is a good reason for this being empty. You have just loaded the kernel module that controls the bus and the
bus master. Linux still has no idea what the device is. You're going to need to load another module. This one is called
w1_therm :
# modprobe w1_therm
Nothing will be printed in dmesg this time. If you now take a look at your 1-wire device filesystem you will see a
new entry called w1_slave . This is how you will access the temperature information from the DS1820B. Use cat to find
the w1_slave file; if all is well it should print some information for you. There will be a short delay on your shell when
you do this. Hopefully your output looks something like Figure 3-17 .
Figure 3-17. Successful output from the DS1820B
 
Search WWH ::




Custom Search