Xorg: add -modalias option
This scans the installed video drivers and prints a Linux-style modalias listing of the devices each driver claims to support.
This commit is contained in:
parent
3eb52de7f2
commit
8e368cf5b9
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
/* General parameters */
|
/* General parameters */
|
||||||
extern int xf86DoConfigure;
|
extern int xf86DoConfigure;
|
||||||
|
extern Bool xf86DoModalias;
|
||||||
extern Bool xf86DoConfigurePass1;
|
extern Bool xf86DoConfigurePass1;
|
||||||
extern DevPrivateKey xf86ScreenKey;
|
extern DevPrivateKey xf86ScreenKey;
|
||||||
extern DevPrivateKey xf86CreateRootWindowKey;
|
extern DevPrivateKey xf86CreateRootWindowKey;
|
||||||
|
|
|
@ -144,6 +144,7 @@ Bool xf86Resetting = FALSE;
|
||||||
Bool xf86Initialising = FALSE;
|
Bool xf86Initialising = FALSE;
|
||||||
Bool xf86DoProbe = FALSE;
|
Bool xf86DoProbe = FALSE;
|
||||||
Bool xf86DoConfigure = FALSE;
|
Bool xf86DoConfigure = FALSE;
|
||||||
|
Bool xf86DoModalias = FALSE;
|
||||||
DriverPtr *xf86DriverList = NULL;
|
DriverPtr *xf86DriverList = NULL;
|
||||||
int xf86NumDrivers = 0;
|
int xf86NumDrivers = 0;
|
||||||
InputDriverPtr *xf86InputDriverList = NULL;
|
InputDriverPtr *xf86InputDriverList = NULL;
|
||||||
|
|
|
@ -1472,6 +1472,8 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
|
||||||
if (sectlist)
|
if (sectlist)
|
||||||
*sectlist = NULL;
|
*sectlist = NULL;
|
||||||
|
|
||||||
|
if (xf86DoModalias) return 0;
|
||||||
|
|
||||||
if (xf86DoProbe) return 1;
|
if (xf86DoProbe) return 1;
|
||||||
|
|
||||||
if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
|
if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
|
||||||
|
|
|
@ -244,6 +244,84 @@ xf86PrintMarkers()
|
||||||
LogPrintMarkers();
|
LogPrintMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DoModalias()
|
||||||
|
{
|
||||||
|
int i = -1;
|
||||||
|
char **vlist;
|
||||||
|
|
||||||
|
/* Get all the drivers */
|
||||||
|
vlist = xf86DriverlistFromCompile();
|
||||||
|
if (!vlist) {
|
||||||
|
ErrorF("Missing output drivers. PCI Access dump failed.\n");
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load all the drivers that were found. */
|
||||||
|
xf86LoadModules(vlist, NULL);
|
||||||
|
|
||||||
|
xfree(vlist);
|
||||||
|
|
||||||
|
/* Iterate through each driver */
|
||||||
|
for (i = 0; i < xf86NumDrivers; i++) {
|
||||||
|
struct pci_id_match *match;
|
||||||
|
|
||||||
|
/* Iterate through each pci id match data, dumping it to the screen */
|
||||||
|
for (match = (struct pci_id_match *) xf86DriverList[i]->supported_devices ;
|
||||||
|
match && !(!match->vendor_id && !match->device_id) ; match++) {
|
||||||
|
/* Prefix */
|
||||||
|
ErrorF("alias pci:");
|
||||||
|
|
||||||
|
/* Vendor */
|
||||||
|
if (match->vendor_id == ~0)
|
||||||
|
ErrorF("v*");
|
||||||
|
else
|
||||||
|
ErrorF("v%08X", match->vendor_id);
|
||||||
|
|
||||||
|
/* Device */
|
||||||
|
if (match->device_id == ~0)
|
||||||
|
ErrorF("d*");
|
||||||
|
else
|
||||||
|
ErrorF("d%08X", match->device_id);
|
||||||
|
|
||||||
|
/* Subvendor */
|
||||||
|
if (match->subvendor_id == ~0)
|
||||||
|
ErrorF("sv*");
|
||||||
|
else
|
||||||
|
ErrorF("sv%08X", match->subvendor_id);
|
||||||
|
|
||||||
|
/* Subdevice */
|
||||||
|
if (match->subdevice_id == ~0)
|
||||||
|
ErrorF("sd*");
|
||||||
|
else
|
||||||
|
ErrorF("sd%08X", match->subdevice_id);
|
||||||
|
|
||||||
|
/* Class */
|
||||||
|
if (match->device_class_mask >> 16 & 0xFF == 0xFF)
|
||||||
|
ErrorF("bc%02X", match->device_class >> 16 & 0xFF);
|
||||||
|
else
|
||||||
|
ErrorF("bc*");
|
||||||
|
if (match->device_class_mask >> 8 & 0xFF == 0xFF)
|
||||||
|
ErrorF("sc%02X", match->device_class >> 8 & 0xFF);
|
||||||
|
else
|
||||||
|
ErrorF("sc*");
|
||||||
|
if (match->device_class_mask & 0xFF == 0xFF)
|
||||||
|
ErrorF("i%02X*", match->device_class & 0xFF);
|
||||||
|
else
|
||||||
|
ErrorF("i*");
|
||||||
|
|
||||||
|
/* Suffix (driver) */
|
||||||
|
ErrorF(" %s\n", xf86DriverList[i]->driverName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bail:
|
||||||
|
OsCleanup(TRUE);
|
||||||
|
AbortDDX();
|
||||||
|
fflush(stderr);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
xf86CreateRootWindow(WindowPtr pWin)
|
xf86CreateRootWindow(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
|
@ -596,6 +674,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
else
|
else
|
||||||
xf86ServerName = argv[0];
|
xf86ServerName = argv[0];
|
||||||
|
|
||||||
|
if (!xf86DoModalias) {
|
||||||
xf86PrintBanner();
|
xf86PrintBanner();
|
||||||
xf86PrintMarkers();
|
xf86PrintMarkers();
|
||||||
if (xf86LogFile) {
|
if (xf86LogFile) {
|
||||||
|
@ -606,9 +685,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
|
xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
|
||||||
xf86LogFile, ct);
|
xf86LogFile, ct);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Read and parse the config file */
|
/* Read and parse the config file */
|
||||||
if (!xf86DoProbe && !xf86DoConfigure) {
|
if (!xf86DoProbe && !xf86DoConfigure && !xf86DoModalias) {
|
||||||
switch (xf86HandleConfigFile(FALSE)) {
|
switch (xf86HandleConfigFile(FALSE)) {
|
||||||
case CONFIG_OK:
|
case CONFIG_OK:
|
||||||
break;
|
break;
|
||||||
|
@ -644,6 +724,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
if (xf86DoConfigure)
|
if (xf86DoConfigure)
|
||||||
DoConfigure();
|
DoConfigure();
|
||||||
|
|
||||||
|
/* Do the PCI Access dump */
|
||||||
|
if (xf86DoModalias)
|
||||||
|
DoModalias();
|
||||||
|
|
||||||
if (autoconfig) {
|
if (autoconfig) {
|
||||||
if (!xf86AutoConfig()) {
|
if (!xf86AutoConfig()) {
|
||||||
xf86Msg(X_ERROR, "Auto configuration failed\n");
|
xf86Msg(X_ERROR, "Auto configuration failed\n");
|
||||||
|
@ -1684,6 +1768,12 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
xf86AllowMouseOpenFail = TRUE;
|
xf86AllowMouseOpenFail = TRUE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(argv[i], "-modalias"))
|
||||||
|
{
|
||||||
|
xf86DoModalias = TRUE;
|
||||||
|
xf86AllowMouseOpenFail = TRUE;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (!strcmp(argv[i], "-isolateDevice"))
|
if (!strcmp(argv[i], "-isolateDevice"))
|
||||||
{
|
{
|
||||||
int bus, device, func;
|
int bus, device, func;
|
||||||
|
@ -1723,6 +1813,7 @@ ddxUseMsg()
|
||||||
ErrorF("-logfile file specify a log file name\n");
|
ErrorF("-logfile file specify a log file name\n");
|
||||||
ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
|
ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
|
||||||
}
|
}
|
||||||
|
ErrorF("-modalias output a modalias-style filter for each driver installed\n");
|
||||||
ErrorF("-config file specify a configuration file, relative to the\n");
|
ErrorF("-config file specify a configuration file, relative to the\n");
|
||||||
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
|
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
|
||||||
ErrorF("-probeonly probe for devices, then exit\n");
|
ErrorF("-probeonly probe for devices, then exit\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user