Go Back   DisplayLink Forum > DisplayLink Applications > Embedded Applications

Reply
 
Thread Tools Search this Thread Display Modes
Old 08-05-2016, 06:11 PM   #1
Jim2220
Junior Member
 
Join Date: Nov 2015
Posts: 11
Default udl module, essential? comes from where?

I have written a program to output to a Xenarc 700TSU which contains a Displaylink. My program uses libdlo which uses libusb 1.0.20. After booting Linux Mint 17.2 and starting my application Mint makes a USB hotplug sound, the display moves from all blue then briefly flashes what my program sends it. But about 1 second later, the display goes back to blue, the hotplug sound happens again, and I get an error when my program attempts further output.

Here is why I believe this behavior has something to do with the udl module and Displaylink support for Windows plug and play:
If I do this experiment again with the Linux utility "Disks", I notice that after boot the Displaylink appears as a CD in the list of storage devices that are online! I also notice that lsmod does not initially show the presence of udl. lsusb shows
Bus 002 Device 005: ID 17e9:0199 DisplayLink

When I run my program, the Disks screen updates and the Displaylink as a CD rom disappears. But shortly thereafter when the Xenarc screen goes back to blue, Disks updates to again show Displaylink as a CD. udl appears when I run lsmod.

When libusb makes ioctrl calls what device or software is being addressed, udl or is it somehow being bypassed and I'm talking directly to the Displaylink?
Since udl is somehow being enabled did it load from the Displaylink CD Drive?
If so, how can my program get udl loaded and accessable to libusb, then get the Displaylink CD Drive out of the way?
Jim2220 is offline   Reply With Quote
Old 08-05-2016, 11:38 PM   #2
Jim2220
Junior Member
 
Join Date: Nov 2015
Posts: 11
Default udl is in the Xenarc

Another clue:
If I boot my desktop PC without the Xenarc then do
lsmod | grep udl
nothing (i.e. no udl module) is there.
sudo modprobe udl
lsmod | grep udl
still nothing is there.

Repeating this experiment with the Xenarc plugged in at boot, I can load udl manually with modprobe.
Unfortunately, having udl pre-loaded has no beneficial effects on my program being able to initialize and output to the Xenarc one second after my program starts. It still goes offline.

Linux Mint hotplug / unplug sounds correspond exactly to the appearance / disappearance of Displaylink CD on the "Disks" utility screen.
Jim2220 is offline   Reply With Quote
Old 08-06-2016, 12:18 AM   #3
Jim2220
Junior Member
 
Join Date: Nov 2015
Posts: 11
Default Perhaps udl is not needed?

If I use
sudo modprobe -r udl
my application still runs and can maintain output to the Xenarc after one second ("Displaylink CD" not present and no Mint hotplug sounds).

Does this mean that udl is not required when accessing a Displaylink device through libdlo? If so, then perhaps I should focus on making "Displaylink CD" disappear from the devices list of the "Disks" utility?
Jim2220 is offline   Reply With Quote
Old 08-06-2016, 06:44 PM   #4
Jim2220
Junior Member
 
Join Date: Nov 2015
Posts: 11
Default IOCTL_USB_DISCONNECT, right or wrong track?

A call to this function of libusb in linux.c

int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface)
{
struct usb_ioctl command;
int ret;

command.ifno = interface;
command.ioctl_code = IOCTL_USB_DISCONNECT;
command.data = NULL;

printf ("****** Attempt to detach interface %d --> ", interface);
ret = ioctl(dev->fd, IOCTL_USB_IOCTL, &command);

with interface 0
makes the device /dev/sr1 (Displaylink CD) disappear.
Unfortunately, it has very strange side effects: my main desktop monitor shows pixelated garbage, Cinnamon crashes, session logout.
Jim2220 is offline   Reply With Quote
Old 08-11-2016, 12:31 AM   #5
Jim2220
Junior Member
 
Join Date: Nov 2015
Posts: 11
Default Displaylink as CD reappears after error, might not be cause of error

I believe that the Displaylink CD Drive reconnection occurs AFTER my program
- successfully connects to the 700TSU / Displaylink
- successfully outputs 3 (of 6) small rectangles to the screen
- but then, for no reason I can find, disconnects

my code...
cout << i << " at " << seconds_since_boot() << " -> ";
dlo_retcode_t ret = dlo_fill_rect(display.uid, &view, &rec, DLO_RGB(0xFF, 0xFF, i*32));
cout << ret << ' ' << dlo_strerror(ret) << endl;

from lsusb...
Bus 001 Device 006: ID 17e9:0199 DisplayLink

Timestamp at the start of my program
Time since boot is 151.03

then a little later the Displaylink is found after searching the USB connections...
The USB open (for RDWR) of /dev/bus/usb/001/006 returned 3
at 151.029999 usb: open: uhand &1161490 at /home/fred/ProgrammingFiles/from_libdlo/dlo_usb.cpp 334
There are 1 interfaces. Try to get a name.
usb: interface 0: driver (usb-storage) already attached to device
****** Attempt to detach interface 0 --> success
at 151.039993 usb_detach_kernel_driver_np for interface 0 returned 0
Attempting to set configuration of 1161490 at /home/fred/ProgrammingFiles/from_libdlo/dlo_usb.cpp 380 --> configuration setting succeeded.
at 151.059998 usb: open: claiming iface 0 at line 0 --> usb claim succeeded
usb: open: the timeout for the device will be 10000 ms
dlo_usb_open returned 0 at /home/fred/ProgrammingFiles/from_libdlo/libdlo.cpp 434
dlo_mode_set_default for dev 1161280
at /home/fred/ProgrammingFiles/from_libdlo/libdlo.cpp 463Claimed 1161280
the uid is 0x1161280
Attempting dlo_get_mode with uid 0x1161280
- screen dimensions are 800x480
- virtual screens are numbered 0 to 13
Attempting dlo_fill_rect to clear screen... returns 0: Successful

(at this point I enter a slow loop - sleep (1); - putting some small rectangles on the screen. I can see them flash all at once on the screen, but then it turns blue, and shortly thereafter, the hotplug indication sounds)

0 at 151.09 -> 0 Successful
1 at 152.09 -> 0 Successful
2 at 153.09 -> 0 Successful
3 at 154.09 -> error submitting URB: on 3 No such device at /home/fred/ProgrammingFiles/from_libusb/linux.cpp 219

from dmesg...
[ 30.451797] input: eGalaxTouch Virtual Device for Single as /devices/virtual/input/input15
[ 30.642360] init: plymouth-stop pre-start process (1911) terminated with status 1
[ 151.340623] usbcore: registered new interface driver udl
[ 153.586097] usb 1-8: USB disconnect, device number 5
[ 153.586109] usb 1-8.2: USB disconnect, device number 6
[ 153.587955] usb 1-8.3: USB disconnect, device number 7
[ 153.683214] usb 1-8.4: USB disconnect, device number 8
[ 154.010692] usb 1-8: new high-speed USB device number 9 using ehci-pci
[ 154.143060] usb 1-8: New USB device found, idVendor=058f, idProduct=6254
[ 154.143072] usb 1-8: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 154.143535] hub 1-8:1.0: USB hub found
[ 154.143674] hub 1-8:1.0: 4 ports detected
[ 154.431005] usb 1-8.2: new high-speed USB device number 10 using ehci-pci
[ 154.544580] usb 1-8.2: New USB device found, idVendor=17e9, idProduct=0199
[ 154.544592] usb 1-8.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 154.544599] usb 1-8.2: Product: Mini USB Monitor
[ 154.544605] usb 1-8.2: Manufacturer: DisplayLink

This is the libusb code which discovers the error...

ret = ioctl(dev->fd, IOCTL_USB_SUBMITURB, &urb);
if (ret < 0) {
// USB_ERROR_STR(-errno, "error submitting URB: %s", strerror(errno));
printf ("error submitting URB: on %d %s at %s %d\n", dev->fd, strerror(errno), __FILE__, __LINE__);

Why is this disconnecting 3 seconds after a successful connection?
Jim2220 is offline   Reply With Quote
Reply

Tags
displaylink cd, libdlo, libusb, udl, xenarc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:11 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.