Usb monitor on linux

I have a DisplayLink-based external USB monitor, which has both power and data over USB, and seems to work perfectly under Windows 7, but only can display a text console under Ubuntu 10.10, and that I can only use when I am actually switched to it. So the only Use I can have so far is to have some text-based monitoring or console that I can watch while working on the graphic display. I know there are some development done for DisplayLink, but I never could get it to actually run properly. Yes, I tried the detailed setup described in other posts, but they did not work, and instead crashed my X that I had to restore. Merci 🙂

Mine s the iMo USB Sub-Monitor, as sold at ThinkGeek.com / The Model is actually the XT-7, as I can see on the CDROM.

Which laptop/computer and graphics card do you have? I have an HP dv7 4183cl, and am trying to setup a triple head using 1 displaylink monitor.

I would like to add that only USB2 Displaylink devices are supported in Linux, but the newer USB3 devices are NOT supported. More info here: askubuntu.com/questions/517339/…

6 Answers 6

On Aug 3, 2015, Displaylink finally released the USB Monitor driver for Ubuntu.

I have an AOC usb monitor and Ubuntu 14.04. After installing the driver, my usb Monitor start working.

If the driver works for your monitor, please let other people know by posting it. Many people waiting for this driver. I’ve been waiting for 2 years. 🙂

I’ve been waiting for four years now. Actually, the monitor is in some box somwehere in the home. But I will get the driver and see hw if works on my installation. I now use Ubuntu 15.04. Thanks for the link.

It works for me on Ubuntu 14.04 after installing a more recent kernel than the standard one ( sudo apt-get install linux-generic-lts-utopic ). In my case, the monitors themselves do not use USB, but I use a Dell or HP docking station / port replicator to which I connect them. With compiz, the displays are not updated after each keystroke (only upon the next one), which is really annoying. With metacity, this problem does not occur.

Thank you so much (finally)! I can confirm this working with an HP NL571AA USB Graphics Adapter, Ubuntu 14.04.3 LTS 64-bit, and a HP 1955 19″ (tertiary) monitor. I only had to switch from the binary NVIDIA drivers to the open source Nouveau ones to make it work.

Maybe this will get you a little bit further.

General DisplayLink adapter information for Linux is available here.

Also, if your primary graphics adapter is from NVIDIA, you should read this.

Lots of useful links. Will take me some time to read it all and setup, but I htink I»m in the right way to get it working.

Not yet. All I can get so far is a graphical display, but then the other monitors are black, useless. I still have to merge the configuration files together. My existing xorg.conf file is empty, and if I put the config file for the DisplayLink, it disables everything. So I need to generate the xorg.conf file for my existing monitors and then figure out how to append the DisplayLink stuff in it. BTW: I now have an ATI-based dual-monitor display, while I used to only connect to the on-board Intel-based adapter.

Читайте также:  Linux with trim support

I see it’s been a while since this was updated. Would you mind telling me whether DisplayLink USB monitors work well for you with current software?

It is now possible to install the driver with new versions of kernels. I am writing this after updating to 4.20.13

You will have to use a script, however, which you can obtain from HERE (Github).

Once you have the script, remove the currently installed driver/module and install the new version. Script will download all dependencies for you. To remove old/install new apply the below steps:

sudo ./displaylink-debian.sh --uninstall sudo dkms remove evdi/1.6.0 --all -q sudo systemctl stop dlm.service sudo systemctl disable dlm.service sudo rm -f /lib/systemd/system/dlm.service sudo rmmod evdi sudo displaylink-debian.sh --install 

February 2019 -> Ubuntu 18.04 LTS

Installation:

Download driver from HERE. Then unzip, make sure it’s runable and install (change the below file names to your versions):

$ unzip DisplayLink USB Graphics Software for Ubuntu 4.4.zip $ chmod 775 displaylink-driver-4.4.24.run $ ./displaylink-driver-4.4.24.run 

Thats it! Once installed you can connect your DisplayLink to the PC and it should fly.

Make sure you have dkms installed on your system.

$ sudo dpkg -l | grep dkms ii dkms 2.3-3ubuntu9.2 all Dynamic Kernel Module Support Framework 

Also note, it works perfectly with the 4.15.0-45-generic kernel. However, I tried with the newest kernel 4.20 and the driver will not work — evdi for dkms will not compile. I haven’t tried other kernels — if I try I will update the answer — but beware of this issue!

You can check your current kernel like this:

EDIT: (14.02.2019)

Ok, so I decided to try some kernels and it seems that 4.18.20-041820-generic is the most recent working. Nothing higher worked for me.

Here’s an easy way to test if your DisplayLink device is operable at a low level, under Linux. If you plug in the device and get a green screen, you’re ready for the next step.

First convert a bitmap to the size of your screen, then convert it to 16 bit RGB color. Then copy to the framebuffer for the device:

convert -resize '800x480!' input.jpg temp1.png mkdfiff -f RGB16 temp1.png > temp2.png dd if=temp2.png of=/dev/fb1 

Note that your DisplayLink is probably at /dev/fb1, but you can check with dmesg :

[581145.816821] udlfb: DisplayLink Kensington M01063 - serial #202241900817 [581145.817000] udlfb: vendor descriptor length:22 data:22 5f 01 0020 05 00 01 03 00 04 [581145.817005] udlfb: DL chip limited to 2360000 pixel modes [581145.909488] udlfb: DisplayLink USB device /dev/fb1 attached. 800x480 resolution. 

Only version 1 DisplayLink chips are supported by Linux. The DisplayLink 1 chips are limited to 16 bit RGB. Getting the device to work properly under X windows is more challenging.

Источник

C++ Как в Linux мониторить usb устройства?

У меня есть графическое GTK приложение и мне нужно получать информацию об подключенных USB девайсах, используя libusb я могу получить то что нужно но как оформить сам мониторинг, правильно ли запускать в отдельном потоке вечный цикл и обновлять поток UI? Мне интересно каким образом работают такие системы, какие есть модели управления потоками, возможно есть какие-нибудь механизмы взаимодействия с системой так как программа работает в user space, system calls?

Точно не уверен, но наверно нужно использовать udev, он должен уметь отправлять события об изменении устройств

Нужно автомонтирование флешки производить я правильно понял? А что бы смотреть изменения воспользуйтесь debus как раз на этой шине происходит обноружения флешки если она примонтирована

Читайте также:  Установка драйверов через терминал линукс

в потоке действия какого рода выполняются? Запускается один раз или каждый раз при подключении девайса?

1 ответ 1

Для начала поставить библиотеку libudev

sudo apt-get install libudev-dev 
#include #include #include int main() < struct udev *udev; struct udev_device *dev; struct udev_monitor *mon; int fd; int status; /* create udev object */ udev = udev_new(); if (!udev) < fprintf(stderr, "Can't create udev\n"); return 1; >//группы сообщений //(1)kernel - посылает событие к udevd в момент подключения устройства для его инициализации //(2)udev - посылает событие в userspace программам, используемым libudev mon = udev_monitor_new_from_netlink(udev, "udev"); //Можно также добавлять подсистемы pci, usb, scsi, scsi_host, scsi_generic //Типы устройств usb_device, usb_interface, scsi_host, scsi_device, disk, partition udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk"); //флешки udev_monitor_enable_receiving(mon); fd = udev_monitor_get_fd(mon); printf("Start. \n"); fflush(stdout); while (1) < fd_set fds; struct timeval tv; int ret; FD_ZERO(&fds); FD_SET(fd, &fds); tv.tv_sec = 0; tv.tv_usec = 0; ret = select(fd+1, &fds, NULL, NULL, &tv); if (ret >0 && FD_ISSET(fd, &fds)) < dev = udev_monitor_receive_device(mon); if (dev) < printf("I: ACTION=%s\n", udev_device_get_action(dev)); printf("I: DEVNAME=%s\n", udev_device_get_sysname(dev)); printf("I: DEVPATH=%s\n", udev_device_get_devpath(dev)); printf("I: MACADDR=%s\n", udev_device_get_sysattr_value(dev, "address")); printf("---\n"); fflush(stdout); /* free dev */ udev_device_unref(dev); >> /* 500 milliseconds */ usleep(500*1000); > /* free udev */ udev_unref(udev); return 0; > 

Событие uevent , которое udevd получает от драйвера ядра — это GROUP_KERNEL (1), а уведомление программ из пространства пользователя /lib/udev programs or others — это GROUP_UDEV (2). Workflow отсюда

введите сюда описание изображения

По поводу взаимодействия, я бы форкул цикл ожидания событий монитора и при инициализации нового устройства посылал родительскому процессу сигналы (сигналы реального времени, чтоб устройство не потерять при подключении, т.к. эти сигналы ставятся в очередь). Поправьте если не прав.

#include #include #include #include #include #include void task() < printf("Create thread and join my func"); auto func = []() < for(auto i = 0 ; ifflush(stdout); >; std::thread t(func); t.join(); > int main() < struct udev *udev; struct udev_device *dev; struct udev_monitor *mon; int fd; int status; /* create udev object */ udev = udev_new(); if (!udev) < fprintf(stderr, "Can't create udev\n"); return 1; >pid_t pid = fork(); switch (pid) < case -1: exit(EXIT_FAILURE); /*Ошибко*/ case 0: < /*Выполнение дочернего процесса*/ //группы сообщений //kernel - посылает событие к udevd в момент подключения устройства для его инициализации //udev - посылает событие в userspace программам, используемым libudev mon = udev_monitor_new_from_netlink(udev, "udev"); //Можно также добавлять подсистемы pci, usb, scsi, scsi_host, scsi_generic //Типы устройств usb_device, usb_interface, scsi_host, scsi_device, disk, partition udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk"); //флешки udev_monitor_filter_add_match_subsystem_devtype(mon, "usb", "usb_device"); //флешки udev_monitor_filter_add_match_subsystem_devtype(mon, "usb", "usb_interface"); //флешки udev_monitor_enable_receiving(mon); fd = udev_monitor_get_fd(mon); printf("Start. \n"); fflush(stdout); while (1) < fd_set fds; int ret; FD_ZERO(&fds); FD_SET(fd, &fds); ret = select(fd+1, &fds, nullptr, nullptr, nullptr); if (ret >0 && FD_ISSET(fd, &fds)) < dev = udev_monitor_receive_device(mon); if (dev) < printf("I: ACTION=%s\n", udev_device_get_action(dev)); printf("I: DEVNAME=%s\n", udev_device_get_sysname(dev)); printf("I: DEVPATH=%s\n", udev_device_get_devpath(dev)); printf("I: MACADDR=%s\n", udev_device_get_sysattr_value(dev, "address")); printf("---\n"); fflush(stdout); if(strncmp(udev_device_get_action(dev), "add", 3) == 0) < union sigval value; value.sival_int = 1; sigqueue(getppid(), SIGRTMIN, value); >/* free dev */ udev_device_unref(dev); > > /* 500 milliseconds */ usleep(500*1000); > /* free udev */ udev_unref(udev); > default: < /*Продолжение выполнения родительского процесса*/ int ex; int sig; siginfo_t si; sigset_t allSigs; sigfillset(&allSigs); if(sigprocmask(SIG_SETMASK, &allSigs, NULL) == -1) < printf("fail\n"); exit(EXIT_FAILURE); >while(1) < sig = sigwaitinfo(&allSigs, &si); printf("sig %s\n",strsignal(sig)); if(SIGINT == sig || SIGTERM == sig) < kill(pid, SIGTERM); exit(EXIT_SUCCESS); >if(SIGRTMIN == sig) < task(); /*Запускаем функцию, где реализуем отдельный поток*/ >> > > //switch return 0; > 

Источник

USB performance/traffic monitor?

First of all, I found a similar question but it doesn’t really solve my problem. I am trying to discover if the USB bus for a device I am using is the bottleneck in my program. How can I monitor a USB bus (similar to how gnome-system-monitor works) to show bus utilization? Basically I want to identify when the bus is being ‘maxed’ out. I guess what I am looking for is some interface for usbmon, as that appears like it would do what I need. This came about from testing the USRP and GNU Radio. I am running into a situation where it appears that the USB bus could be a limiting factor, so I ask the more general question of USB performance monitoring.

Читайте также:  Linux найти все файлы старше даты

While wireshark and usbmon get the traffic, I need something that can more easily give me an idea of throughput and such.

Do you see the usb bus reaching its theoretical maximum? Did you compare the traffic you get with benchmarks of your hardware? Max throughput is usually depended on the device connected and not the system bus, so to test it properly you’ll need some hardware specifically made for that purpose.

6 Answers 6

Use usbtop, it gives a nice overview of what devices are using how much bandwidth:

Bus ID 1 (USB bus number 1) To device From device Device ID 1 : 0.00 kb/s 0.00 kb/s Device ID 2 : 0.00 kb/s 0.00 kb/s Bus ID 2 (USB bus number 2) To device From device Device ID 1 : 0.00 kb/s 0.00 kb/s Device ID 4 : 141.73 kb/s 13777.68 kb/s Device ID 5 : 9.98 kb/s 11.24 kb/s Device ID 6 : 0.00 kb/s 0.00 kb/s Device ID 7 : 0.00 kb/s 0.00 kb/s Device ID 8 : 141.71 kb/s 15257.26 kb/s 

Thanks for pointing me to usbtop . It looks useful. Here’s how to install it: unix.stackexchange.com/a/489268/114401.

As recalled in other posts, usbtop needs the usbmon kernel module to be loaded. For instance with sudo modprobe usbmon

1. usbtop:

As sebas points out, usbtop seems to give a certain minimum level of useful information (although it could be much better), so I recommend it.

enter image description here

Here’s how to install it (build usbtop from source code):

git clone https://github.com/aguinet/usbtop.git 
sudo apt update sudo apt install \ libboost-dev \ libpcap-dev \ libboost-thread-dev \ libboost-system-dev \ cmake \ build-essential 
cmake -DCMAKE_BUILD_TYPE=Release .. 

If I missed anything let me know in the comments.

Install References:

2. Update: You can also use iostat instead:

Run at 1-second intervals with:

OR with 0.1-second intervals with:

Sample output of iostat -d 1 :

enter image description here

References:

Additional reading:

iostat would be so much better if it just kept a sum of the amount copied, and rewrite over the previous value, instead of creating additional lines!

Since usbmon provides the length of each packet transferred, I would approach this by writing a quick program to parse the 0u file (which has data for all USB devices.) It would pick out the USB bus and device numbers, then keep a running total of the packet length field in both directions for each device.

This will then give you the amount of data transferred per device, in each direction. If you print it once a second you’ll get a pretty good idea of each device’s throughput. Note that it won’t include any USB overhead, but if you compare the figures to a device that is able to saturate the available bandwidth you’ll know whether you’re getting close to the limit.

I’ve wrote a pair of shell scripts to get the throughput from a USB device. If someone what to use it, you can find it in this post.

Using htop , I pressed F2 for Setup , selected columns, added IO_READ_RATE , IO_WRITE_RATE or IO_RATE , and i was able to see the speed at which processes were reading or writing from and to disks.

This question is about USB traffic though, not disk traffic (e.g. how much bandwidth a USB webcam uses.)

    Make sure usbmon is running

sudo wireshark # may or may not requiring sudoing 

You can compare the bytes/s with the max speed of USB2.0 or USB3.0 depending on your USB interface.

Источник

Оцените статью
Adblock
detector