How to Integrate the Driver in the Kernel build operation
How to Integrate the Driver in the Kernel build operation
...
@@ -27,7 +29,7 @@ How to Integrate the Driver in the Kernel build operation
...
@@ -27,7 +29,7 @@ How to Integrate the Driver in the Kernel build operation
7) Generate your kernel
7) Generate your kernel
How to Build the Linux Kernel Driver
How to Build the Linux Kernel Driver
====================================
====================================
...
@@ -43,13 +45,13 @@ Before building the driver, you may need to config the linux kernel to enable th
...
@@ -43,13 +45,13 @@ Before building the driver, you may need to config the linux kernel to enable th
If you want to use the driver with your current kernel (without recompiling the kernel and replacing it with the current one), please make sure the kernel header, the config and the related build scripts you used is belonged to this version of kernel.
If you want to use the driver with your current kernel (without recompiling the kernel and replacing it with the current one), please make sure the kernel header, the config and the related build scripts you used is belonged to this version of kernel.
Please make sure the following kernel features have been enabled. (via make menuconfig under your kernel source)
Please make sure the following kernel features have been enabled. (via make menuconfig under your kernel source)
0) framebuffer support (CONFIG_FB=y)
0) framebuffer support (CONFIG_FB=y)
1) deferred io support in framebuffer (CONFIG_FB_DEFERRED_IO=y)
1) deferred io support in framebuffer (CONFIG_FB_DEFERRED_IO=y)
2) fb file operation support
2) fb file operation support
* CONFIG_FB_CFB_FILLRECT=y
* CONFIG_FB_CFB_FILLRECT=y
* CONFIG_FB_CFB_COPYAREA=y
* CONFIG_FB_CFB_COPYAREA=y
* CONFIG_FB_CFB_IMAGEBLIT=y
* CONFIG_FB_CFB_IMAGEBLIT=y
...
@@ -58,14 +60,14 @@ Please make sure the following kernel features have been enabled. (via make menu
...
@@ -58,14 +60,14 @@ Please make sure the following kernel features have been enabled. (via make menu
* CONFIG_FB_SYS_IMAGEBLIT=m
* CONFIG_FB_SYS_IMAGEBLIT=m
* CONFIG_FB_SYS_FOPS=m
* CONFIG_FB_SYS_FOPS=m
* CONFIG_FB_MODE_HELPERS=y
* CONFIG_FB_MODE_HELPERS=y
3) Input event support (Generic input layer support)
3) Input event support (Generic input layer support)
You may modify the .config directly to enable these features.
You may modify the .config directly to enable these features.
Alternatively, here is a tricky method:
Alternatively, here is a tricky method:
Select the Displaylink display driver ( Device Drivers-> Graphics support -> Support for frame buffer devices-> Displaylink USB Framebuffer support) as an external module. By doing so, the above features will be selected by the menuconfiger.
Select the Displaylink display driver ( Device Drivers-> Graphics support -> Support for frame buffer devices-> Displaylink USB Framebuffer support) as an external module. By doing so, the above features will be selected by the menuconfiger.
You may need to recompile the kernel if the above configuration changes have been made.
You may need to recompile the kernel if the above configuration changes have been made.
II. Native Build - build the kernel driver for the current machine
II. Native Build - build the kernel driver for the current machine
...
@@ -75,7 +77,9 @@ You should have followed the steps described in the prerequisite section already
...
@@ -75,7 +77,9 @@ You should have followed the steps described in the prerequisite section already
Enter the Robopeak USB Displayer linux kernel driver folder (i.e. rpusbdisp/drivers/linux-driver), using the following command:
Enter the Robopeak USB Displayer linux kernel driver folder (i.e. rpusbdisp/drivers/linux-driver), using the following command:
```shell
$ make KERNEL_SOURCE_DIR=~/workspace/linux-kernel
$ make KERNEL_SOURCE_DIR=~/workspace/linux-kernel
```
You should find the build result under the current folder: rp_usbdisplay.ko
You should find the build result under the current folder: rp_usbdisplay.ko
...
@@ -87,7 +91,9 @@ You should have followed the steps described in the prerequisite section already
...
@@ -87,7 +91,9 @@ You should have followed the steps described in the prerequisite section already
Let's also assume the target platform is ARMv7. We need to use the cross-compiler : arm-linux-gnueabihf-gcc.
Let's also assume the target platform is ARMv7. We need to use the cross-compiler : arm-linux-gnueabihf-gcc.
Enter the following command to build the kernel driver for the target:
Enter the following command to build the kernel driver for the target:
```shell
make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm KERNEL_SOURCE_DIR=~/workspace/target-linux-kernel
make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm KERNEL_SOURCE_DIR=~/workspace/target-linux-kernel
```
You should find the build result under the current folder: rp_usbdisplay.ko
You should find the build result under the current folder: rp_usbdisplay.ko
...
@@ -95,7 +101,7 @@ You should find the build result under the current folder: rp_usbdisplay.ko
...
@@ -95,7 +101,7 @@ You should find the build result under the current folder: rp_usbdisplay.ko
How to Use the Kernel Driver
How to Use the Kernel Driver
============================
============================
I.deploy the dependencies modules
I. Deploy the dependencies modules
---------------------------------
---------------------------------
If you had re-configed and recompiled the Linux kernel as required by the building process, you need to deploy the new kernel and all the kernel modules to the target system.
If you had re-configed and recompiled the Linux kernel as required by the building process, you need to deploy the new kernel and all the kernel modules to the target system.
...
@@ -106,21 +112,21 @@ To be specific, you need to deploy AT LEAST the following kernel module to the
...
@@ -106,21 +112,21 @@ To be specific, you need to deploy AT LEAST the following kernel module to the
* sysimgblt.ko
* sysimgblt.ko
* fb_sys_fops.ko
* fb_sys_fops.ko
II. deploy the compiled kernel driver
II. Deploy the compiled kernel driver
-------------------------------------
-------------------------------------
Reboot the target system to using the new kernel. Copy the compiled usb display driver (rp_usbdisplay.ko) to the following location:
Reboot the target system to using the new kernel. Copy the compiled usb display driver (rp_usbdisplay.ko) to the following location:
/lib/modules/`uname -r`/kernel
/lib/modules/`uname -r`/kernel
Enter the above folder and execute the following command:
Enter the above folder and execute the following command:
depmod -a
depmod -a
III. load the kernel driver
III. Load the kernel driver
---------------------------
---------------------------
Once you had deployed the kernel driver and all of its dependencies, you can ask the kernel to load the driver using :
Once you had deployed the kernel driver and all of its dependencies, you can ask the kernel to load the driver using :
modprobe rp_usbdisplay
modprobe rp_usbdisplay
By default the frame per seconds is set to 16. You can change it with the fps option when you load the driver :
By default the frame per seconds is set to 16. You can change it with the fps option when you load the driver :
...
@@ -135,45 +141,53 @@ If you want to let the kernel load the driver automatically each time when the s
...
@@ -135,45 +141,53 @@ If you want to let the kernel load the driver automatically each time when the s
(i.e. cat rp_usbdisplay >> /etc/modules)
(i.e. cat rp_usbdisplay >> /etc/modules)
IV. verify the driver
IV. Verify the driver
---------------------
---------------------
Using the lsmod command to check whether the driver has been loaded correctlly. You should get the output similar to the following text:
Using the lsmod command to check whether the driver has been loaded correctlly. You should get the output similar to the following text:
# lsmod
```shell
Module Size Used by
# lsmod
rp_usbdisplay 12171 0 [permanent]
Module Size Used by
fb_sys_fops 1412 1 rp_usbdisplay
rp_usbdisplay 12171 0 [permanent]
sysimgblt 2199 1 rp_usbdisplay
fb_sys_fops 1412 1 rp_usbdisplay
sysfillrect 3295 1 rp_usbdisplay
sysimgblt 2199 1 rp_usbdisplay
syscopyarea 3112 1 rp_usbdisplay
sysfillrect 3295 1 rp_usbdisplay
syscopyarea 3112 1 rp_usbdisplay
```
Also, you should find the following message in the dmesg log:
Also, you should find the following message in the dmesg log:
[ 7.535799] input: RoboPeakUSBDisplayTS as /devices/virtual/input/input0
```log
[ 7.535799] input: RoboPeakUSBDisplayTS as /devices/virtual/input/input0
[ 7.548115] usbcore: registered new interface driver rp-usbdisp
[ 7.548115] usbcore: registered new interface driver rp-usbdisp
```
To verify the driver work with the RoboPeak USB Display, connect the display to the target system via the USB cable. The display should display RoboPea Logo and turn to black (or something else) for about 3 second.
To verify the driver work with the RoboPeak USB Display, connect the display to the target system via the USB cable. The display should display RoboPea Logo and turn to black (or something else) for about 3 second.
If the display keeps showing the white noise animation and the message : Waiting for signal, you should check the dmesg to see what happens. Normally, the driver will prompt the following message when the display has been pluged in :
If the display keeps showing the white noise animation and the message : Waiting for signal, you should check the dmesg to see what happens. Normally, the driver will prompt the following message when the display has been pluged in :
[ 1814.173232] rp-usbdisp 4-1:1.0: RP USB Display found (#1), Firmware Version: X.XX, S/N: XXXXXXXXXXXX
```log
[ 1814.173232] rp-usbdisp 4-1:1.0: RP USB Display found (#1), Firmware Version: X.XX, S/N: XXXXXXXXXXXX
```
Once the driver recognizes the display, a framebuffer device will be created. (e.g. /dev/fb0)
Once the driver recognizes the display, a framebuffer device will be created. (e.g. /dev/fb0)
Use the following command to see whether framebuffer device is belonged to the USB display:
Use the following command to see whether framebuffer device is belonged to the USB display:
# cat /proc/fb
```bash
# cat /proc/fb
2 rpusbdisp-fb <
2 rpusbdisp-fb <
```
In the above example, /dev/fb2 is the related framebuffer device. To test whether the framebuffer device works, you may using the following command:
In the above example, /dev/fb2 is the related framebuffer device. To test whether the framebuffer device works, you may using the following command:
# cat /dev/urandom > /dev/fb2
```bash
# cat /dev/urandom > /dev/fb2
```
You should see the display screen is filled with random color dots.
You should see the display screen is filled with random color dots.
V. make X11 output to the USB display
V. Make X11 output to the USB display
-------------------------------------
-------------------------------------
There is a sample X11 config file under the source folder: rpusbdisp/drivers/linux-driver/xserver_conf/10-disp.conf. You can use this sample file as the template to make X11 on your target system to output to the USB display.
There is a sample X11 config file under the source folder: rpusbdisp/drivers/linux-driver/xserver_conf/10-disp.conf. You can use this sample file as the template to make X11 on your target system to output to the USB display.
...
@@ -183,12 +197,19 @@ STEP1: determine the framebuffer device name of the display.
...
@@ -183,12 +197,19 @@ STEP1: determine the framebuffer device name of the display.
STEP2: modify the 10-disp.conf, change the framebuffer device name to the one determined in STEP1.
STEP2: modify the 10-disp.conf, change the framebuffer device name to the one determined in STEP1.
STEP3: copy the file 10-disp.conf to the X11's config folder (/usr/share/X11/xorg.conf.d for most systems).
STEP3: copy the file 10-disp.conf to the X11's config folder (/usr/share/X11/xorg.conf.d for most systems).
STEP4: restart the X11 server
STEP4: restart the X11 server
The X11 desktop should appear on the USB display.
The X11 desktop should appear on the USB display.
User Mode SDK
=============
Besides the Linux kernel driver, we also provide a user mode sdk which is available on Windows, OS X, and Linux.
You can find the SDK in the [drivers/usermode-sdk](https://github.com/cnwzhjs/rpusbdisp/tree/master/drivers/usermode-sdk) subdirectory.