DisplayLink on Fedora Linux
I had the opportunity to recently try one of the DisplayLink’s USB 2.0 graphics adapter. This one is supposedly a DL-165 but was bought on eBay as a “USB 2.0 to VGA DVI HDMI Multi-Display Graphic Adapter” for about 35EUR. Its purpose will be the projection of presentations and other e-learning materials in a school by a teacher. It’s a USB to DVI graphics adapter which comes with 2 adapters:
- 1 x DVI to VGA
- 1 x DVI to HDMI
Linux says it’s a DisplayLink SUNWEIT USB Display Adapter see bellow:
[ 122.227846] usb 2-1.3: New USB device found, idVendor=17e9, idProduct=024c [ 122.227853] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 122.227858] usb 2-1.3: Product: SUNWEIT USB Display [ 122.227862] usb 2-1.3: Manufacturer: DisplayLink [ 122.227866] usb 2-1.3: SerialNumber: 00000000-000794
I had several problems to put this to work under Linux as you will see next. I’ve googled around to look for setup instructions and found that starting from kernel 2.6.38 the udlfb driver which drives diplaylink devices under linux has been moved from staging to main kernel tree.
However the latest udlfb driver can also be obtained from here and the latest displaylink X.org driver can be pulled from here.
Now the setup procedure:
- I’ve decided to recompile kernel 3.0.4 in order to include udlfb (see my previous post on how to compile your custom vanilla kernel if you need directions here).
- I’ve found out somewhere, maybe here that after udlfb driver is correctly installed in your system you should get a green display, so after recompiling kernel 3.0.4 to include udlfb driver i’ve plugged the usb cable and have immediately gotten my green display as seen bellow.
- When you get your green screen you will also find a new device under
/dev/fb1
seedmesg
log bellow[ 9937.250452] udlfb: DisplayLink USB device /dev/fb1 attached. 800x600 resolution. Using 1880K framebuffer memory [ 9937.250501] usbcore: registered new interface driver udlfb
- The next step should be compiling the displaylink X.org driver. Start by cloning xf-video-udlfb git repo:
git clone http://git.plugable.com/webdav/xf-video-udlfb cd xf-video-udlfb ./configure make && make install
When done you will have two new files under
/usr/local/lib/xorg/modules/drivers/
[root@dell udlfb]# ls -l /usr/local/lib/xorg/modules/drivers/ total 160 -rwxr-xr-x 1 root root 993 Sep 19 00:56 displaylink_drv.la -rwxr-xr-x 1 root root 157291 Sep 19 00:56 displaylink_drv.so
- link
displaylink_drv.so
to/usr/lib64/xorg/modules/drivers/
if underx86_64
arch or/usr/lib/xorg/modules/drivers/
ifi386
arch.ln -s /usr/local/lib/xorg/modules/drivers/displaylink_drv.so /usr/lib64/xorg/modules/drivers/
or
ln -s /usr/local/lib/xorg/modules/drivers/displaylink_drv.so /usr/lib/xorg/modules/drivers/
You are done for now.
- Now it’s time to tailor a custom xorg.conf file for use. Recent Linux distros don’t come with a /etc/X11/xorg.conf file anymore so to generate a starting point issue the following command:
X -configure
you will maybe need to change to runlevel 3 to run the previous command successfully, you can do that by running
init 3
as root.
This command will create axorg.conf.new
as a basic starting point. Start by editing it to feet your needs. Remember that the displaylink monitor needs to be primary starting at:X.pos 0Y.pos 0
take a look into xorg.conf manual
man xorg.conf
to learn more about xorg.conf’s options. You can also look at xf-video-udlfb
README
file you got previously.
Bellow you can see how my xorg.conf file become after some tailoring:Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen1" 0 0 Screen 1 "Screen0" 1024 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" Option "Xinerama" "On" EndSection Section "Extensions" Option "Composite" "Enable" EndSection Section "Files" ModulePath "/usr/lib64/xorg/modules" FontPath "catalogue:/etc/X11/fontpath.d" FontPath "built-ins" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/input/mice" Option "ZAxisMapping" "4 5 6 7" EndSection Section "Monitor" Identifier "Monitor0" Option "Primary" "true" EndSection Section "Monitor" #DisplaySize 304 228 # mm Identifier "Monitor1" VendorName "SNY" ModelName "SDM-HS53" Option "DPMS" # 1024x768 @ 75.10 Hz (GTF) hsync: 60.23 kHz; pclk: 81.91 MHz Modeline "1024x768_75.10" 81.91 1024 1080 1192 1360 768 769 772 802 -HSync +Vsync Option "Primary" "false" EndSection Section "Device" Identifier "Card0" Driver "intel" BusID "PCI:0:2:0" EndSection Section "Device" Identifier "Card1" Driver "displaylink" Option "fbdev" "/dev/fb1" EndSection Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 16 SubSection "Display" Depth 1 Modes "1440x900" EndSubSection SubSection "Display" Depth 4 Modes "1440x900" EndSubSection SubSection "Display" Depth 8 Modes "1440x900" EndSubSection SubSection "Display" Depth 15 Modes "1440x900" EndSubSection SubSection "Display" Depth 16 Modes "1440x900" EndSubSection SubSection "Display" Depth 24 Modes "1440x900" EndSubSection EndSection Section "Screen" Identifier "Screen1" Device "Card1" Monitor "Monitor1" DefaultDepth 16 SubSection "Display" Depth 1 Modes "1024x768_75.10" "1024x768" EndSubSection SubSection "Display" Depth 4 Modes "1024x768_75.10" "1024x768" EndSubSection SubSection "Display" Depth 8 Modes "1024x768_75.10" "1024x768" EndSubSection SubSection "Display" Depth 15 Modes "1024x768_75.10" "1024x768" EndSubSection SubSection "Display" Depth 16 Modes "1024x768_75.10" "1024x768" EndSubSection SubSection "Display" Depth 24 Modes "1024x768_75.10" "1024x768" EndSubSection EndSection
gtf command can also become handy here
man gtf
- Finally let’s test our setup:
To do that lets create a new X session, issue the following:startx -- :2 -config xorg.conf.new
If everything went OK you should be now seeing an extended desktop on a new X session with the displaylink monitor set as primary.
If for some reason this didn’t workout for you, don’t worry you have probably run into some of the issues i have too ;-).
The rest of this blog post will introduce you to some problems I’ve found and how you can workaround those if you also run into them. You will want to look at/var/log/Xorg.*.log
anddmesg
logs from time to time to try to understand what’s going on.
Lets now start some debugging
- In my case after running
startx -- :2 -config xorg.conf.new
i got a segmentation fault WTF? right?
my log file stated the following[ 265.190] (--) using VT number 8 [ 267.692] (WW) Falling back to old probe method for displaylink [ 267.692] (II) Loading sub module "fbdevhw" [ 267.692] (II) LoadModule: "fbdevhw" [ 267.692] (II) Loading /usr/lib64/xorg/modules/libfbdevhw.so [ 267.692] (II) Module fbdevhw: vendor="X.Org Foundation" [ 267.692] compiled for 1.9.5, module version = 0.0.2 [ 267.692] ABI class: X.Org Video Driver, version 8.0 [ 267.692] (II) DL(0): using /dev/fb1 [ 267.692] (EE) DL(0): Unknown EDID version 0 [ 267.692] (**) DL(0): Depth 16, (--) framebuffer bpp 16 [ 267.692] (==) DL(0): RGB weight 565 [ 267.692] (==) DL(0): Default visual is TrueColor [ 267.692] (==) DL(0): Using gamma correction (1.0, 1.0, 1.0) [ 267.692] (II) DL(0): hardware: udlfb (video memory: 940kB) [ 267.692] (**) DL(0): Option "fbdev" "/dev/fb1" [ 267.692] (II) Loading sub module "fb" [ 267.692] (II) LoadModule: "fb" [ 267.693] (II) Loading /usr/lib64/xorg/modules/libfb.so [ 267.693] (II) Module fb: vendor="X.Org Foundation" [ 267.693] compiled for 1.9.5, module version = 1.0.0 [ 267.693] ABI class: X.Org ANSI C Emulation, version 0.4 [ 267.693] (II) DL(0): Output udlfb using monitor section Monitor1 [ 267.693] (**) DL(0): Option "Primary" "false" [ 267.693] (EE) DL(0): Unknown EDID version 245 [ 267.693] (II) DL(0): EDID for output udlfb [ 267.693] Backtrace: [ 267.693] 0: /usr/bin/X (xorg_backtrace+0x28) [0x4a0908] [ 267.694] 1: /usr/bin/X (0x400000+0x60e99) [0x460e99] [ 267.694] 2: /lib64/libc.so.6 (0x355e200000+0x33140) [0x355e233140] [ 267.694] 3: /usr/lib64/xorg/modules/drivers/displaylink_drv.so (0x7ff1425d0000+0x382e) [0x7ff1425d382e] [ 267.694] 4: /usr/bin/X (InitOutput+0x802) [0x470bb2] [ 267.694] 5: /usr/bin/X (0x400000+0x213cd) [0x4213cd] [ 267.694] 6: /lib64/libc.so.6 (__libc_start_main+0xfd) [0x355e21ee5d] [ 267.694] 7: /usr/bin/X (0x400000+0x21129) [0x421129] [ 267.694] Segmentation fault at address 0x24 [ 267.694] Fatal server error: [ 267.694] Caught signal 11 (Segmentation fault). Server aborting
my problem here was about the EDID. You can learn about EDID here.
when i’ve looked again into dmesg log i’ve also noticed this particular entry after connecting the displaylink device:[ 236.494596] udlfb: Unable to get valid EDID from device/display
- After some time i found out that this late message was coming from
udlfb.c
just search for it. It seems that udlfb driver isn’t being able to get the display EDID. As a workaround i’ve connected the monitor to the integrated VGA port on my laptop and ran the following:xrandr --prop
to get myself two 128bit arrays, one for my laptop LCD EDID and a second for the External Monitor connected to the integrated VGA port. Bellow you can see the EDID array for SONY SDM-HS53 Monitor
EDID: 00ffffffffffff004dd9502201010101 0b0e01030c1e1778ea8c3ea4584d9124 154f51a1080001010101010101010101 01010101010164190040410026301888 360030e410000018000000fd00393f1c 3109000a202020202020000000fc0053 444d2d485335330a20202020000000ff 00313235333730360a202020202000ce
I’ve also found that fedora provides a set of tools to play with EDIDs. If you are curious and want to try them out issue this:
yum install monitor-edid
in the end you can do something like
xrandr --prop | monitor-parse-edid
interesting stuff.
- As a next step I’ve tailored this hexadecimal array into a C array as follows:
unsigned char sony_sdmhs53_edid[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x4d, 0xd9, 0x50, 0x22, 0x01, 0x01, 0x01, 0x01, 0x0b, 0x0e, 0x01, 0x03, 0x0c, 0x1e, 0x17, 0x78, 0xea, 0x8c, 0x3e, 0xa4, 0x58, 0x4d, 0x91, 0x24, 0x15, 0x4f, 0x51, 0xa1, 0x08, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x64, 0x19, 0x00, 0x40, 0x41, 0x00, 0x26, 0x30, 0x18, 0x88, 0x36, 0x00, 0x30, 0xe4, 0x10, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x39, 0x3f, 0x1c, 0x31, 0x09, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x53, 0x44, 0x4d, 0x2d, 0x48, 0x53, 0x35, 0x33, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xff, 0x00, 0x31, 0x32, 0x35, 0x33, 0x37, 0x30, 0x36, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0xce, };
and added this to
udlfb.c
- The next step was to hardcode the EDID in
udlfb.c
since it wasn’t being able to successfully get it dynamically through the USB device.
Below you can see the changes i’ve madeBinary files udlfb.git/.git/index and udlfb.new/.git/index differ diff -uNrp udlfb.git/.git/logs/HEAD udlfb.new/.git/logs/HEAD --- udlfb.git/.git/logs/HEAD 2011-09-23 00:02:10.376129589 +0100 +++ udlfb.new/.git/logs/HEAD 2011-09-22 04:46:35.000000000 +0100 @@ -1 +1 @@ -0000000000000000000000000000000000000000 1811e5c48a29cc925f9b7a49465e06255196a80f Nuno M Reis 1316732530 +0100 clone: from http://git.plugable.com/webdav/udlfb +0000000000000000000000000000000000000000 1811e5c48a29cc925f9b7a49465e06255196a80f root 1316663195 +0100 clone: from http://git.plugable.com/webdav/udlfb diff -uNrp udlfb.git/.git/logs/refs/heads/master udlfb.new/.git/logs/refs/heads/master --- udlfb.git/.git/logs/refs/heads/master 2011-09-23 00:02:10.376129589 +0100 +++ udlfb.new/.git/logs/refs/heads/master 2011-09-22 04:46:35.000000000 +0100 @@ -1 +1 @@ -0000000000000000000000000000000000000000 1811e5c48a29cc925f9b7a49465e06255196a80f Nuno M Reis 1316732530 +0100 clone: from http://git.plugable.com/webdav/udlfb +0000000000000000000000000000000000000000 1811e5c48a29cc925f9b7a49465e06255196a80f root 1316663195 +0100 clone: from http://git.plugable.com/webdav/udlfb diff -uNrp udlfb.git/udlfb.c udlfb.new/udlfb.c --- udlfb.git/udlfb.c 2011-09-23 00:02:10.379129638 +0100 +++ udlfb.new/udlfb.c 2011-09-22 05:56:36.000000000 +0100 @@ -75,6 +75,138 @@ static int console = 1; /* Allow fbcon t static int fb_defio = 1; /* Detect mmap writes using page faults */ static int shadow = 1; /* Optionally disable shadow framebuffer */ + +unsigned char sony_sdmhs53_edid[] = { +0x00, +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +0x00, +0x4d, +0xd9, +0x50, +0x22, +0x01, +0x01, +0x01, +0x01, +0x0b, +0x0e, +0x01, +0x03, +0x0c, +0x1e, +0x17, +0x78, +0xea, +0x8c, +0x3e, +0xa4, +0x58, +0x4d, +0x91, +0x24, +0x15, +0x4f, +0x51, +0xa1, +0x08, +0x00, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x01, +0x64, +0x19, +0x00, +0x40, +0x41, +0x00, +0x26, +0x30, +0x18, +0x88, +0x36, +0x00, +0x30, +0xe4, +0x10, +0x00, +0x00, +0x18, +0x00, +0x00, +0x00, +0xfd, +0x00, +0x39, +0x3f, +0x1c, +0x31, +0x09, +0x00, +0x0a, +0x20, +0x20, +0x20, +0x20, +0x20, +0x20, +0x00, +0x00, +0x00, +0xfc, +0x00, +0x53, +0x44, +0x4d, +0x2d, +0x48, +0x53, +0x35, +0x33, +0x0a, +0x20, +0x20, +0x20, +0x20, +0x00, +0x00, +0x00, +0xff, +0x00, +0x31, +0x32, +0x35, +0x33, +0x37, +0x30, +0x36, +0x0a, +0x20, +0x20, +0x20, +0x20, +0x20, +0x00, +0xce, +}; + /* * When building as a separate module against an arbitrary kernel, * check on build presence of other kernel modules we have dependencies on. @@ -814,6 +946,7 @@ error: #endif +/* static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len) { int i; @@ -841,6 +974,7 @@ static int dlfb_get_edid(struct dlfb_dat return i; } +*/ static int dlfb_ops_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) @@ -1304,20 +1438,23 @@ static int dlfb_setup_modes(struct dlfb_ struct fb_info *info, char *default_edid, size_t default_edid_size) { - int i; + int i,j; const struct fb_videomode *default_vmode = NULL; int result = 0; - char *edid; + char *edid = NULL; int tries = 3; if (info->dev) /* only use mutex if info has been registered */ mutex_lock(&info->lock); - + edid = kmalloc(EDID_LENGTH, GFP_KERNEL); if (!edid) { result = -ENOMEM; goto error; } + for(j = 0; j < EDID_LENGTH; j++){ + edid[j] = sony_sdmhs53_edid[j]; + } fb_destroy_modelist(&info->modelist); memset(&info->monspecs, 0, sizeof(info->monspecs)); @@ -1329,11 +1466,13 @@ static int dlfb_setup_modes(struct dlfb_ */ while (tries--) { - i = dlfb_get_edid(dev, edid, EDID_LENGTH); + i = 128; - if (i >= EDID_LENGTH) + if (i >= EDID_LENGTH){ fb_edid_to_monspecs(edid, &info->monspecs); - + pr_warn("teste\t%x",edid[8]); + pr_warn("teste\t%x",sony_sdmhs53_edid[8]); + } if (info->monspecs.modedb_len > 0) { dev->edid = edid; dev->edid_size = i; @@ -1407,8 +1546,8 @@ static int dlfb_setup_modes(struct dlfb_ * default to resolution safe for projectors * (since they are most common case without EDID) */ - fb_vmode.xres = 800; - fb_vmode.yres = 600; + fb_vmode.xres = 1024; + fb_vmode.yres = 768; fb_vmode.refresh = 60; default_vmode = fb_find_nearest_mode(&fb_vmode, &info->modelist);
After applying this changes I’ve get ridden of the message I was getting earlier.
[ 236.494596] udlfb: Unable to get valid EDID from device/display
- Let’s go back to step no. 7 above
startx -- :2 -config xorg.conf.new
And this time everything worked and i got mayself a new X session running on the displaylink device as primary monitor as seen bellow.
And we are done! 😀If you intent to use gnome 3 or other 3D features, DisplayLink devices still lack 3D support under Linux. We will have to wait a little bit longer..
good contribution
you can’t end up being serious!
What do you mean?
Thank you for sharing your thoughts. Outstanding!
You made some decent points there. I looked on the internet for the issue and found most individuals will go along with with your website.
Hi!
In the end it’s the easy way to have things working fast. Although i think the USB communication to get the correct EDID should be taken into account in future work. The thing is i don’t have more freetime now to dedicate myself to this issue.
Thanks for your comment.
I was more than happy to find this web-site.I wanted to thanks on your time for this wonderful learn!! I undoubtedly having fun with each little bit of it and I have you bookmarked to check out new stuff you weblog post.
To be honest this is my third time visiting DisplayLink on Fedora Linux nameq0 today and finally decided to leave a comment. Great info and I love the theme. Keep it up!
Thanks.
I have honestly never read such overwhelmingly good content like this. I agree with your points and your ideas. This info is really great. Thanks. I will shurely make a link to https://nameq.wordpress.com/2011/09/21/displaylink-dl-165-running-on-linux-fedora/ on my site.
Hey!
Thanks. You are always welcome to comeback again.
As a Newbie, I am permanently searching online for articles that can be of assistance to me. Thank you
I am glad you wrote this great article and shared it here. You made great and poignant points that I can agree with and understand. I will certainly post a link to https://nameq.wordpress.com/2011/09/21/displaylink-dl-165-running-on-linux-fedora/ on my site.
Hi!
Thanks. You are always welcome to comeback.
I am always thought about this, regards for putting up.
🙂
I have done extensive research on this subject, and agree completely with the way this was written. I only wish I had the eloquence to put it into quality writing. I will most definitely make a link to https://nameq.wordpress.com/2011/09/21/displaylink-dl-165-running-on-linux-fedora/ on my site.
Great job on this article! I am impressed with your presentation of thoughts and writing skills. You must have put in hours of research on this subject to be able to write with such intelligence. I will most definitely post a link to https://nameq.wordpress.com/2011/09/21/displaylink-dl-165-running-on-linux-fedora/ on my site.
hmmm
Note that if you’re having EDID problems, it’s not necessary to change the code. You can write to a sysfs file (typically with a udev rule, so it happens each boot). See the “edid” sysfs option in udlfb’s documentation:
http://lxr.linux.no/linux+v3.0.4/Documentation/fb/udlfb.txt
Thanks Bernie.
Please-Please-Please may you elaborate a little bit more how you would add the EDID as a sysfs file (udev rule)?… For a linux n00b like me?
I already have the edid for my monitor in the form of:
00ffffffffffff001e6dfe56da420000
051501036a301b78eaaec5a2574a9c25
125054a54b00b3008180818f714f0101
010101010101023a801871382d40582c
4500dd0c1100001a21399030621a2740
68b03600dd0c1100001c000000fd0038
4b1e530f000a202020202020000000fc
0057323234330a202020202020200033
Hi!
Sorry about all this delay on answering you. Any luck with the sysfs in the meanwhile?
Anyway to do DisplayLink Linux to DisplayLink Windows?
This is not a windows blog. You could probably make it work by simply install the windows driver i guess.
Thanks for the useful article. I saw a sale on a USB->HDMI device and wondered about Linux support. I’m guessing that it is way too slow for reasonable videos.
Now that I’ve read the comments, I can’t quite figure out some of them. They sure look like spam but I don’t understand how the spammers win anything with them.
I was also very interested in bernieplugable’s comment for another reason. I have a KVM that doesn’t pass EDID and DDOC information and it is causing me problems. The sysfs file as replacement would be useful if it works with more than the udlfb code.
Any luck with the sysfs?
Thank you very much for this. Unfortunately, I’m using Arch which has the kernel updated frequently. So recompiling the kernel is almost impossible for me. Is there anyway to load the udlfb driver as a module?
Hi!
I guess it’s possible but i’m not a arch user so i think you are on your own there.
Thanks for your feedback.
Whenever I originally commented I clicked the Notify me any time new comments are added checkbox and currently each and every time a remark is added I receive 4 messages with the identical comment.
It’s probably a bug. I don’t control the internals of wordpress notification service when using wordpress.com hosting.
As the admin of this website is working, no question very rapidly it will be
famous, due to its quality contents.
I get pleasure from, result in I found just what I was having a look for.
You’ve ended my 4 day lengthy hunt! God Bless you man.
Have a nice day. Bye