Irene
06-13-2017, 11:23 AM
Hello guys,
I am new to this domain, I am working on an application which requires virtual display driver.
I am using VBOX setup (Virtual Box 5.0.12) and running Ubuntu 16.04 (Kernel 4.4.0-79-generic).
Code Output:
3228
dmesg Output:
3227
If anyone could tell me what i am missing out on. Thank you in advance.
mlukaszek
06-13-2017, 02:31 PM
Hi,
Can you attach it as text?
Is it possible to share the code of the program you write, at least partially?
Have you tried sample client code from https://github.com/mlukaszek/evdipp to verify evdi works in the environment?
Cheers,
Michal
Irene
06-14-2017, 04:38 AM
Hi,
I am going through those files. Like I said very new to this domain, it is difficult to understand without documentation.
Code :
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "evdi_lib.h"
#include <stdlib.h>
#include <unistd.h>
int main(){
int new_node = 0;
int dev_status = 0;
evdi_handle new_handle;
evdi_buffer new_buffer;
const unsigned char* edid;
bool update;
char opt[3];
int *new_rect_num; // buffer description
new_buffer.id=0;
int new_buf_id=new_buffer.id;
new_buffer.width=1920; // Horizontal size
new_buffer.height=1096; // Vertical size
new_buffer.stride=1920;
new_buffer.rect_count=100; // frame count
new_rect_num=&new_buffer.rect_count;
const unsigned char edid_dummy[128]={
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x58, 0x58, 0x00, 0x00, 0x80, 0x07, 0x48, 0x04,
0x01, 0x00, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78, 0xEE, 0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26,
0x0F, 0x50, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xBE, 0x31, 0x80, 0x06, 0x70, 0x48, 0x06, 0x40, 0x02, 0x02,
0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x00, 0xC8, 0x00,
0xC8, 0x64, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x56,
0x42, 0x4F, 0x58, 0x20, 0x6D, 0x6F, 0x6E, 0x69, 0x74, 0x6F, 0x72, 0x0A, 0x00, 0x00, 0x00, 0x10,
0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x17};
edid=edid_dummy;
evdi_selectable new_selectable;
evdi_event_context node_context;
evdi_event_context* new_context;
new_context=&node_context;
new_node = evdi_add_device(); // Adding new EVDI node
if (new_node>0)
{
printf("\n New EVDI node added\n");
dev_status = evdi_check_device(new_node); // Checking if the above node is available EVDI node for use
printf(" Status of the node : ");
if (dev_status == AVAILABLE)
{
printf(" AVAILABLE\n");
new_handle = evdi_open(new_node);
printf(" Status of the EVDI handle : ");
if (new_handle == EVDI_INVALID_HANDLE)
{
printf(" EVDI_INVALID_HANDLE\n");
}
else
{
printf(" EVDI_VALID_HANDLE\n");
evdi_connect(new_handle,edid,130,1096); // Opening connections
printf(" Opening connections\n");
evdi_register_buffer(new_handle, new_buffer); // Registering Buffers
printf(" Registering Buffers\n");
new_selectable=evdi_get_event_ready(new_handle);
printf(" Event Handler = %d\n",new_selectable);
evdi_handle_events(new_handle, new_context); // Event Handler
update=evdi_request_update(new_handle, new_buf_id); // Requesting screen update
printf(" Screen Update Status : %s\n", update?"TRUE":"FALSE");
evdi_grab_pixels(new_handle, new_buffer.rects, new_rect_num); // Grabbing pixels
evdi_unregister_buffer(new_handle, new_buf_id); // Unregistering Buffers
printf(" Unregistering Buffers\n");
evdi_disconnect(new_handle); // Disconnecting
printf(" Disconnecting\n");
evdi_close(new_handle); // Closing devices
printf(" Closing devices\n \n ");
}
}
else if (dev_status == UNRECOGNIZED)
printf(" UNRECOGNIZED\n \n");
else
printf(" NOT_PRESENT\n \n");
}
else
printf(" Error occurred while adding a new EVDI node \n \n");
return 0;
}
Code Output :
New EVDI node added
Process id : 25308
Match found : 7f93f547f000-7f93f577f000 rw-s 100004000 00:06 463 /dev/dri/card2
fd = 4
IOCTL FAILED AND RETURNED ERROR : Invalid argument
[libevdi] ioctl: drop_master error=-1
Status of the node : AVAILABLE
Process id : 25308
Match found : 7f93f547f000-7f93f577f000 rw-s 100004000 00:06 463 /dev/dri/card2
fd = 5
IOCTL FAILED AND RETURNED ERROR : Invalid argument
[libevdi] ioctl: drop_master error=-1
Status of the EVDI handle : EVDI_VALID_HANDLE
Opening connections
Registering Buffers
Event Handler = 5
Event Handling Loop
No DATA to be read
Screen Update Status : TRUE
IOCTL FAILED AND RETURNED ERROR : Resource temporarily unavailable
[libevdi] ioctl: grabpix error=-1
[libevdi] Grabbing pixels for buffer 0 failed. Should be ignored if caused by change of mode in kernel.
Unregistering Buffers
Disconnecting
Closing devices
Thank you
Regards,
Irene
Irene
06-14-2017, 05:50 AM
Hi,
I tried the wrapper program u suggested, not sure if i did it right but this is the output I got.
OUTPUT :
irs1cob@irs1cob-vm:~/target/bin$ sudo ./monitorsim /sys/class/drm/card0/card0-VGA-1/edid
[libevdi] ioctl: drop_master error=-1
[libevdi] ioctl: drop_master error=-1
[libevdi] ioctl: drop_master error=-1
[libevdi] evdi version:1.3.43[libevdi] doesn't match libevdi compatibility one 1.4.0
No usable EVDI found
irs1cob@irs1cob-vm:~/target/bin$ sudo ./example /sys/class/drm/card0/card0-VGA-1/edid
[libevdi] ioctl: drop_master error=-1
Attempting to use device /dev/dri/card5...
[libevdi] ioctl: drop_master error=-1
[libevdi] evdi version:1.3.43[libevdi] doesn't match libevdi compatibility one 1.4.0
No usable EVDI found
Regards,
Irene
mlukaszek
06-14-2017, 02:49 PM
To use the wrapper, you need to have fresh evdi from GitHub so the versioning check doesn't stop you. Your evdi is 1.3.x, the library is 1.4.
Have you read https://displaylink.github.io/evdi/ ?
You're passing 130 as the EDID length - why? It should be 128, or more if you have extension block (but you don't).
There are other things which are explained better in the docs, or you could peek at the example client how they're done. Device adding, buffer allocation, connection, registering event handler and handling events - have a look at the example code, you'll see how they should be used in practice.
Cheers,
Michal
vBulletin® v3.8.7, Copyright ©2000-2026, vBulletin Solutions, Inc.