*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* fbc_query_device - Query a frame buffer device
*/
#include <errno.h> /* errno */
#include <stdlib.h> /* free(), malloc() */
#include <string.h> /* memset(), strerror(), strlen(), strstr() */
#include <unistd.h> /* ioctl() */
#include "gfx_common.h" /* Model name, part #, cur video mode, EDID */
#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
#include "fbc_error.h" /* Error reporting */
#include "fbc_query_device.h" /* Query a frame buffer device */
/*
* fbc_get_attributes()
*
* Query the frame buffer device for attribute information. Return
* zero upon success, along with the attribute information. In the
* event of an error, display an error message, clear the fbgattr
* structure, and return the errno code.
*/
int
int device_fd, /* Device file descriptor number */
{
error_code = 0;
error_code = errno;
}
return (error_code);
} /* fbc_get_attributes() */
/*
* fbc_get_fb_model_name()
*
* Return a pointer to a dynamically allocated string containing the
* complete frame buffer model name string (with any "SUNW," prefix)
* as well as a pointer to the simple model name substring (without
* any "SUNW," prefix), else NULLs in the event of an error.
*
* It is the caller's responsibility to free the dynamically
* allocated model name string.
*/
char *
int device_fd, /* Device file descriptor number */
char **simple_model_name) /* Returned name w/o "SUNW," */
{
if (full_model_name != NULL) {
if (strncmp(full_model_name,
}
}
}
}
return (full_model_name);
} /* fbc_get_fb_model_name() */
/*
* fbc_get_edid_data()
*
* Query the frame buffer device for EDID data. Return zero upon
* success, along with the EDID data, etc. In the event of an error,
* display an error message and return the errno code and a NULL
* data pointer.
*/
#include "fbc_predid.h"
int
int device_fd, /* Device file descriptor number */
int stream_index, /* Video stream index (zero-based) */
{
GFX_EDID_HEAD_A, /* Video stream A */
GFX_EDID_HEAD_B /* Video stream B */
};
/*
* In case of error
*/
*edid_length = 0;
/*
* Get the byte length of the available EDID data (else try to fake it)
*
* If there's an error, assume the display device isn't
* present. Don't report the error here. Just try to keep
* going.
*/
error_code = 0;
error_code = errno;
return error_code;
}
return -1;
}
/*
* Allocate the EDID data buffer
*/
error_code = errno;
fbc_errormsg("%s, malloc(%u)\n",
return (error_code);
}
/*
* Get the EDID data
*
* If there's an error, assume the display device isn't
* present. Don't report the error here. Just return the
* first error code encountered.
*/
if (error_code == 0) {
error_code = errno;
}
return (error_code);
}
/*
* Return successfully with the EDID data
*/
return (0);
} /* fbc_get_edid_data() */
/*
* fbc_get_edid_res_info()
*
* For each stream indicated by the effective -dev option, retrieve
* the EDID data from the display device and return the following
* information:
* * Manufacturer ID
* * Product Code
* * Pointer to a dynamically allocated array of supported video
* mode name strings w/ preferred video mode in first element
* The display device information is returned in the
* edid_res_info[FBC_MAX_STREAMS] array.
*/
void
{
/*
* Repeat for each video stream
*/
stream_index += 1) {
/*
* Get the EDID data for the display device
*/
&edid_length) != 0) {
continue;
}
/*
* Get the -res related data for this display device
*/
&serial_num);
edid_res_info[0].video_mode =
}
}
} /* fbc_get_edid_res_info() */
/* End of fbc_query_device.c */