Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 23dd6ab

Browse files
author
Mattijs Korpershoek
committed
Add README.md
Readme with GitHub flavored markdown containing the following informations: - How to build and install with cmake. - Minimalistic example mappings for File and Directory. Change-Id: Ib107cd623bb7ec598138d1d18bfd36b5de817aac Signed-off-by: Mattijs Korpershoek <[email protected]>
1 parent 0cec3da commit 23dd6ab

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Filesystem plugin for the parameter-framework
2+
3+
This is a file system plugin for the
4+
[parameter-framework](https://github.com/01org/parameter-framework)
5+
handling file system operations such as `read()` and `write()`.
6+
7+
8+
## Compiling
9+
10+
You need to install the parameter-framework libraries
11+
and headers first (see the parameter-framework's
12+
[README](https://github.com/01org/parameter-framework/blob/master/README.md)).
13+
14+
Generate the Makefiles with `cmake .` and build with `make`.
15+
If you installed the parameter-framework in a custom directory, you should add a
16+
`-DCMAKE_PREFIX_PATH=/path/to/custom/install` argument to `cmake` e.g:
17+
`cmake -DCMAKE_PREFIX_PATH=/home/myself/dev/pfw .` .
18+
19+
If you want to install the plugin to a custom directory, you can add a
20+
`-DCMAKE_INSTALL_PREFIX=/path/to/install/dir` argument to `cmake` e.g:
21+
`cmake -DCMAKE_INSTALL_PREFIX=/home/myself/dev/pfw .` .
22+
23+
Finally, install the libraries with `make install` .
24+
25+
26+
## Usage example
27+
28+
In this example, we are going to control two leds (*ledA* and *ledB*) via sysfs
29+
on a raspberry pi. Let's imagine that the leds are connected on the *pin4* and
30+
*pin7* on the raspberry's GPIO.
31+
32+
To enable sysfs for the pins, we must "export the pins" first:
33+
34+
echo "4" > /sys/class/gpio/export
35+
echo "7" > /sys/class/gpio/export
36+
37+
### Configuration file
38+
39+
Here is the complete `rpifs-subsystem.xml` file:
40+
```xml
41+
<?xml version="1.0" encoding="UTF-8"?>
42+
<Subsystem Name="RaspberryFS" Type="FS" Endianness="Little">
43+
<ComponentLibrary>
44+
<ComponentType Name="GpioPin">
45+
<StringParameter Name="direction" Mapping="File:direction" MaxLength="3"
46+
Description="the direction of the pin: can be out or in" />
47+
<StringParameter Name="state" Mapping="File:value" MaxLength="1"
48+
Description="the state of the pin: can be 0 or 1" />
49+
</ComponentType>
50+
</ComponentLibrary>
51+
<InstanceDefinition>
52+
<Component Name="ledA" Type="GpioPin" Mapping="Directory:/sys/class/gpio/gpio4"/>
53+
<Component Name="ledB" Type="GpioPin" Mapping="Directory:/sys/class/gpio/gpio7"/>
54+
</InstanceDefinition>
55+
</Subsystem>
56+
```
57+
58+
When declaring an `InstanceDefinition` the `Directory` mapping must be given to
59+
the component. Here it points towards the directory containing the GPIO pin4
60+
sysfs directory.
61+
62+
When describing a `ComponentType`, the `File:...` mapping must be given to each
63+
parameter. Here we have two parameters. Since we are describing a pin, we must
64+
provide the direction and the state.
65+
66+
### Usage
67+
If we consider that the `pfw` command is a shorthand for `remote-process
68+
localhost 5001`(where 5001 is the port defined at the top-level
69+
parameter-framework configuration file), which can be used to interact with the
70+
parameter-framework.
71+
72+
#### To initialize the leds:
73+
74+
pfw setTuningMode on
75+
pfw setParameter /Raspberry/RaspberryFS/ledA/direction out
76+
pfw setParameter /Raspberry/RaspberryFS/ledB/direction out
77+
78+
#### To turn the led A on:
79+
80+
pfw setParameter /Raspberry/RaspberryFS/ledA/value 1
81+
82+
#### To turn the led A off:
83+
84+
pfw setParameter /Raspberry/RaspberryFS/ledA/value 0
85+

0 commit comments

Comments
 (0)