Skip to content

Commit f27a255

Browse files
committed
Mention sample program execution with Linux framebuffer and input system
1 parent d406326 commit f27a255

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,54 @@ benefiting the entire application stack.
6060

6161
## Build and Verify
6262

63+
### Prerequisites
64+
6365
`Mado` is built with a minimalist design in mind. However, its verification
6466
relies on certain third-party packages for full functionality and access to all
65-
its features. To ensure proper operation, the development environment should
66-
have the [SDL2 library](https://www.libsdl.org/), [libjpeg](https://www.ijg.org/), and [libpng](https://github.com/pnggroup/libpng) installed.
67+
its features. We encourage the development environment to be installed with all optional
68+
packages, including [libjpeg](https://www.ijg.org/), [libpng](https://github.com/pnggroup/libpng),
69+
and the [SDL2 library](https://www.libsdl.org/).
6770
* macOS: `brew install sdl2 jpeg libpng`
6871
* Ubuntu Linux / Debian: `sudo apt install libsdl2-dev libjpeg-dev libpng-dev`
6972

70-
Configure via [Kconfiglib](https://pypi.org/project/kconfiglib/)
73+
### Configuration
74+
75+
Configure via [Kconfiglib](https://pypi.org/project/kconfiglib/), you should select either SDL
76+
video output or the Linux framebuffer.
7177
```shell
7278
$ make config
7379
```
7480

75-
Build the library and demo program.
81+
### Build and execution
82+
83+
Build the library and demo program:
84+
7685
```shell
7786
$ make
7887
```
7988

80-
Run sample `Mado` program:
89+
To run demo program with SDL backend:
90+
8191
```shell
8292
$ ./demo-sdl
8393
```
8494

8595
Once the window appears, you should be able to move the windows and interact with the widgets.
8696

97+
To run demo program with the Linux framebuffer backend:
98+
99+
```shell
100+
$ sudo ./demo-fbdev
101+
```
102+
103+
Normal users don't have access to `/dev/fb0` so require `sudo`. Alternatively, you can add the user to the video group to avoid typing `sudo` every time:
104+
105+
```shell
106+
$ sudo usermod -a -G video $USERNAME
107+
```
108+
109+
In addition, the framebuffer device can be assigned via the environment variable `FRAMEBUFFER`.
110+
87111
## License
88112

89113
`Mado` is available under a MIT-style license, permitting liberal commercial use.

backend/fbdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ static void _twin_fbdev_put_span(twin_coord_t left,
5757

5858
twin_coord_t width = right - left;
5959
off_t off = top * screen->width + left;
60-
uint32_t *src = pixels;
6160
uint32_t *dest =
6261
(uint32_t *) ((uintptr_t) tx->fb_base + (off * sizeof(uint32_t)));
63-
memcpy(dest, src, width * sizeof(uint32_t));
62+
memcpy(dest, pixels, width * sizeof(uint32_t));
6463
}
6564

6665
static void twin_fbdev_get_screen_size(twin_fbdev_t *tx,
@@ -159,6 +158,7 @@ static bool twin_vt_setup(twin_fbdev_t *tx)
159158
{
160159
/* Open VT0 to inquire information */
161160
if ((tx->vt_fd = twin_vt_open(0)) < -1) {
161+
log_error("Failed to open VT0");
162162
return false;
163163
}
164164

0 commit comments

Comments
 (0)