Software projects/OS/Slackware/Advanced usage/USB graphic

From Pandora Wiki
Revision as of 22:24, 20 December 2012 by Hermocom (talk | contribs) (correction of the RC6 section)
Jump to: navigation, search

Display Link for SL4P 14.0 RC6

In RC6, DisplayLink almost works out of the box.

All you need to do is open a terminal and do this:

su -

cd /boot
cp uImage-2.6.30-displaylink uImage

cd /lib/modules
cp -r 3.2.30-displaylink 3.2.30-dirty

reboot

and then proceed with testing the functionality of the DisplayLink adapter and adapting the /etc/xorg.cont file.

I.e. with SL4P 14.0 RC6 you skip the steps 1 to 4 of the below instructions and proceed here: #Step 5: First Test


Display Link for SL4P 14.0 RC4 and RC5

These instructions are for users of SL4P 14.0 RC4 and RC5.

If you use an earlier or later version of SL4P, the steps necessary to make DisplayLink work may be different.

Step 1: Preconditions

  • Boot SL4P
  • Open a console
  • Connect the Pandora to the Internet
  • Connect the Pandora to AC power
  • Make sure that you don't need to carry away the Pandora for the next 5 hours.

Step 2: Compile a new kernel with "udl" support

Needs Internet connection!

See also: Kernel compilation, especially the note about the 3D graphics driver, that should be considered when compiling a new kernel.

su -
sh kernel-sync.sh
cd /usr/src/linux
make xconfig (or, if that fails due to missing KDE, use "make menuconfig", which uses the text mode menu system)

(kernel-sync.sh is the script, that needs the Internet connection. It downloads the kernel sources, and that process will take some time.)

In xconfig or menuconfig, use the search feature, search for "udl". Check it to be compiled as a module, then save and exit the menu.

Afterwards:

cd
sh kernel.sh

This compiles a new kernel and all the modules. Depending on your CPU speed and RAM, this may take about 2 to 5 hours. Then reboot.

Step 3: Compile the X driver for DisplayLink (udlfb)

(ONLY UNTIL SL4P 14.0 RC4, in later versions this is already integrated into the default system, so in 14.0 RC5 and later versions you may skip this step!). Fetch sources of, compile, make a package and install the X driver:

Needs Internet connection!

rm -rf /tmp/build/*
cd
git clone http://git.plugable.com/webdav/xf-video-udlfb/
cd xf-video-udlfb

export CFLAGS="-DPANDORA -O2 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
export CXXFLAGS="-DPANDORA -O2 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"

./autogen.sh
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
make
make install DESTDIR=/tmp/build/
cd /tmp/build/
makepkg -c y /tmp/xf-video-udlfb-201211-arm-1.tgz
installpkg /tmp/xf-video-udlfb-*-arm-1.tgz


Step 4: Find out framebuffer device

Find out, which framebuffer device is used:

Plug in the DisplayLink adapter, then do a

dmesg

The output should show you, what fb device is used. For me, it's /dev/fb3. You should see something like this:

[ 230.808593] usb 1-2: new high-speed USB device number 2 using ehci-omap
[ 235.933532] usb 1-2: device descriptor read/64, error -32
[ 236.201080] usb 1-2: New USB device found, idVendor=17e9, idProduct=0198
[ 236.201110] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 236.201110] usb 1-2: Product: WS Tech USB-DVI
[ 236.201141] usb 1-2: Manufacturer: DisplayLink
[ 236.201141] usb 1-2: SerialNumber: 305711
[ 236.443908] udlfb: DisplayLink WS Tech USB-DVI - serial #305711
[ 236.443939] udlfb: vid_17e9&pid_0198&rev_0015 driver's dlfb_data struct at c7890800
[ 236.443939] udlfb: console enable=1
[ 236.443969] udlfb: fb_defio enable=1
[ 236.443969] udlfb: shadow enable=1
[ 236.444244] udlfb: vendor descriptor length:1e data:1e 5f 01 001c 05 00 01 03 04 02
[ 236.444274] udlfb: DL chip limited to 1500000 pixel modes
[ 236.445434] udlfb: allocated 4 65024 byte urbs
[ 236.447937] usbcore: registered new interface driver udlfb
[ 236.598724] udlfb: Unable to get valid EDID from device/display
[ 236.598754] udlfb: 640x350 @ 85 Hz valid mode
[ 236.598785] udlfb: 640x400 @ 85 Hz valid mode
[ 236.598785] udlfb: 721x400 @ 85 Hz valid mode
[ 236.598815] udlfb: 640x480 @ 60 Hz valid mode
[ 236.598815] udlfb: 640x480 @ 72 Hz valid mode
[ 236.598815] udlfb: 640x480 @ 75 Hz valid mode
[ 236.598846] udlfb: 640x480 @ 85 Hz valid mode
[ 236.598846] udlfb: 800x600 @ 56 Hz valid mode
[ 236.598876] udlfb: 800x600 @ 60 Hz valid mode
[ 236.598876] udlfb: 800x600 @ 72 Hz valid mode
[ 236.598876] udlfb: 800x600 @ 75 Hz valid mode
[ 236.598907] udlfb: 800x600 @ 85 Hz valid mode
[ 236.598907] udlfb: 1024x768 @ 43 Hz valid mode
[ 236.598937] udlfb: 1024x768 @ 60 Hz valid mode
[ 236.598937] udlfb: 1024x768 @ 70 Hz valid mode
[ 236.598968] udlfb: 1024x768 @ 75 Hz valid mode
[ 236.598968] udlfb: 1024x768 @ 85 Hz valid mode
[ 236.598968] udlfb: 1152x864 @ 75 Hz valid mode
[ 236.598999] udlfb: 1280x960 @ 60 Hz valid mode
[ 236.598999] udlfb: 1280x960 @ 85 Hz valid mode
[ 236.599029] udlfb: 1280x1024 @ 60 Hz valid mode
[ 236.599060] udlfb: 1280x1024 @ 75 Hz valid mode
[ 236.599060] udlfb: 1280x1024 @ 85 Hz valid mode
[ 236.599060] udlfb: 1600x1200 beyond chip capabilities
[ 236.599090] udlfb: 1600x1200 beyond chip capabilities
[ 236.599090] udlfb: 1600x1200 beyond chip capabilities
[ 236.599121] udlfb: 1600x1200 beyond chip capabilities
[ 236.599121] udlfb: 1600x1200 beyond chip capabilities
[ 236.599121] udlfb: 1792x1344 beyond chip capabilities
[ 236.599151] udlfb: 1792x1344 beyond chip capabilities
[ 236.599151] udlfb: 1856x1392 beyond chip capabilities
[ 236.599182] udlfb: 1856x1392 beyond chip capabilities
[ 236.599182] udlfb: 1920x1440 beyond chip capabilities
[ 236.599182] udlfb: 1920x1440 beyond chip capabilities
[ 236.599212] udlfb: Reallocating framebuffer. Addresses will change!
[ 236.600250] udlfb: 800x600 @ 60 Hz valid mode
[ 236.600250] udlfb: set_par mode 800x600
[ 236.642547] udlfb: DisplayLink USB device /dev/fb3 attached. 800x600 resolution. Using 1880K framebuffer memory

(Note last line mentioning the device /dev/fb3)


Step 5: First Test

Plug in the DisplayLink adapter, connect the display. Make sure that USB Host is enabled on the Pandora. Then reboot the Pandora. After the reboot, the external display should turn green, as the sign that the DisplayLink driver is active and talking to the DisplayLink adapter. If it does, the first test was successful.


Step 6: Adjust /etc/X11/xorg.conf

Add this block to /etc/X11/xorg.conf (and replace "/dev/fb3" with the framebuffer device you discovered in Step 4 above):

################ DisplayLink Stuff ###################
Section "Device"
Identifier "DisplayLinkDevice"
Driver "fbdev"
BusID "USB" # needed to use multiple DisplayLink devices
Option "fbdev" "/dev/fb3" # change to whatever device you want to use
# Option "rotate" "CCW" # uncomment for rotation
EndSection

Section "Monitor"
Identifier "DisplayLinkMonitor"
EndSection

Section "Screen"
Identifier "DisplayLinkScreen"
Device "DisplayLinkDevice"
Monitor "DisplayLinkMonitor"
DefaultDepth 16
EndSection

Then find the Section "ServerLayout" and add a reference to the new screen, e.g. like this:

Screen 0 "DisplayLinkScreen"
Screen 1 "Screen0" LeftOf "DisplayLinkScreen"
Option "Xinerama" "on"


Hints:

  • "Screen0" is the reference to the Pandora screen. I think that's the default identified in SL4P and SuperZaxxon. You may check to make sure it's correct.
  • You may replace "LeftOf" by "RightOf", "Above" or "Below".
  • For cloning, you may experiment with
    Option "Clone" "on"
    . However, this will need adjustment of the DisplayLink display's resolution and probably more, in order to produce a satisfying result. Please document it here, if you find a good solution for cloning.


Optional: Further tweaking of the setup

If you want to change xorg.conf and test the changes without waiting for X with XFCE to start up each time, you may As a user:

xwmconfig

choose fvwm2

As root, edit /etc/inittab, and change:

id:4:initdefault:

into

id:3:initdefault:

Then SL4P boots into text mode, and you can log in and type startx to start X with the much quicker loading fwwm2 window manager. Once you have found a setup you want to use, you may revert the last steps to boot directly into XFCE again.


To Do: Hotplug

We still need to find a satisfactory hotplug solution. Currently, the X server needs to be restarted, in order to make a newly plugged in DisplayLink adapter work, or to revert the desktop to 800x480 Pandora screen size, when the adapter has been disconnected.

It seems that real hotplug is not possible with the versions of X and udlfb (kernel): [1]

What would in theory be possible using the hotplug mechanism of Linux, as I understand it, would be, to kill and restart X automatically on every plug / unplug of a DisplayLink device. Of course, this is a really bad hack. Open applications would lose any unsaved data. But I could think of a semi-automatic solution: Whenever hot(un)plug of a DisplayLink adapter is detected, prompt the user to save any unsaved data, and to then hit the "Restart X" button of the prompting dialog.

Work in progress...

Usage hint: Use two instances of the X server

If you modified your xorg.conf as mentioned here in Step 6, it is possible to either start the X server with or without the DisplayLink adapter connected. Either method will work and give a good displaying result.

If you want to plug or unplug the DisplayLink adapter and then adapt the display (e.g.: You worked at home with DisplayLink, then unplug DisplayLink and want to continue our work on the way using just the Pandora screen), there is currently no way around closing the application(s) you worked with, saving your files, restarting the X server and reopening your applications and files.

However, there is at least a method, that makes it a bit easier by avoiding the need to leave X entirely:

Use two instances of the X server:

  • Let the Pandora boot, without DisplayLink connected, into the X environment (i.e. the /etc/inittab modification is not necessary for that method)
  • (work on the Pandora as usual)
  • (then close all applications, that you plan to use with DisplayLink later)
  • Plug in the DisplayLink adapter with the connected display. The display will be green
  • Open a console and type "startx"

--> Another instance of the X server will be started, that uses the DisplayLink-enabled setup and is shown on the external screen. The first X instance won't be visible and usable during the second instance runs.

  • (open your applications again and continue your work on the large screen)
  • (close your applications on the large screen)
  • Click the "exit" icon in the lower right corner and choose "Log out"

--> The 2nd instance of the X server will quit and you are back on the Pandora screen in the first instance of the X server

  • Now you can disconnect the DisplayLink adapter

However, please take care to really quit and restart your applications. Otherwise you may start a second instance of your application on the other screen, maybe load the same file and end up in a big mess with your data files.

SiS USB2VGA adapters

They should work in general, using the sisusbvga / sisusb kernel module and X driver. However, I have not succeeded to make one work in SL4P yet.

Work in progress...