@@ -197,9 +197,11 @@ xf86OutputClassDriverList(int index, XF86MatchedDrivers *md)
197197
198198 LogMessageVerb (X_INFO , 1 , "Applying OutputClass \"%s\" to %s\n" ,
199199 cl -> identifier , path );
200- LogMessageVerb (X_NONE , 1 , "\tloading driver: %s\n" , cl -> driver );
201-
202- xf86AddMatchedDriver (md , cl -> driver );
200+ if (cl -> driver != NULL && * (cl -> driver )) {
201+ LogMessageVerb (X_NONE , 1 , "\tloading driver: %s\n" , cl -> driver );
202+ xf86AddMatchedDriver (md , cl -> driver );
203+ } else
204+ LogMessageVerb (X_NONE , 1 , "\tno driver specified\n" );
203205 }
204206 }
205207}
@@ -261,7 +263,8 @@ xf86platformProbe(void)
261263 Bool pci = TRUE;
262264 XF86ConfOutputClassPtr cl , cl_head = (xf86configptr ) ?
263265 xf86configptr -> conf_outputclass_lst : NULL ;
264- char * old_path , * path = NULL ;
266+ char * driver_path , * path = NULL ;
267+ char * curr , * next , * copy ;
265268
266269 config_odev_probe (xf86PlatformDeviceProbe );
267270
@@ -284,19 +287,85 @@ xf86platformProbe(void)
284287 if (!OutputClassMatches (cl , & xf86_platform_devices [i ]))
285288 continue ;
286289
287- if (cl -> modulepath && xf86ModPathFrom != X_CMDLINE ) {
288- old_path = path ;
289- XNFasprintf (& path , "%s,%s" , cl -> modulepath ,
290- path ? path : xf86ModulePath );
291- free (old_path );
292- LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath extended to \"%s\"\n" ,
293- cl -> identifier , path );
294- LoaderSetPath (path );
290+ if (xf86ModPathFrom != X_CMDLINE ) {
291+ if (cl -> driver ) {
292+ if (cl -> modulepath ) {
293+ if (* (cl -> modulepath )) {
294+ XNFasprintf (& driver_path , "%s,%s" , cl -> modulepath , xf86ModulePath );
295+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath for driver %s overridden with \"%s\"\n" ,
296+ cl -> identifier , cl -> driver , driver_path );
297+ } else {
298+ XNFasprintf (& driver_path , "%s" , xf86ModulePath );
299+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath for driver %s reset to standard \"%s\"\n" ,
300+ cl -> identifier , cl -> driver , driver_path );
301+ }
302+ } else {
303+ driver_path = NULL ;
304+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath for driver %s reset to default\n" ,
305+ cl -> identifier , cl -> driver );
306+ }
307+ if (* (cl -> driver )) LoaderSetPath (cl -> driver , driver_path );
308+ if (cl -> modules ) {
309+ LogMessageVerb (X_CONFIG , 1 , " and for modules \"%s\" as well\n" ,
310+ cl -> modules );
311+ XNFasprintf (& copy , "%s" , cl -> modules );
312+ curr = copy ;
313+ while ((curr = strtok_r (curr , "," , & next ))) {
314+ if (* curr ) LoaderSetPath (curr , driver_path );
315+ curr = NULL ;
316+ }
317+ free (copy );
318+ }
319+ free (driver_path );
320+ }
321+ else if (cl -> modules ) {
322+ if (cl -> modulepath ) {
323+ if (* (cl -> modulepath )) {
324+ XNFasprintf (& driver_path , "%s,%s" , cl -> modulepath , xf86ModulePath );
325+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath for modules %s overridden with \"%s\"\n" ,
326+ cl -> identifier , cl -> modules , driver_path );
327+ } else {
328+ XNFasprintf (& driver_path , "%s" , xf86ModulePath );
329+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath for modules %s reset to standard \"%s\"\n" ,
330+ cl -> identifier , cl -> modules , driver_path );
331+ }
332+ } else {
333+ driver_path = NULL ;
334+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" ModulePath for modules %s reset to default\n" ,
335+ cl -> identifier , cl -> modules );
336+ }
337+ XNFasprintf (& copy , "%s" , cl -> modules );
338+ curr = copy ;
339+ while ((curr = strtok_r (curr , "," , & next ))) {
340+ if (* curr ) LoaderSetPath (curr , driver_path );
341+ curr = NULL ;
342+ }
343+ free (copy );
344+ } else {
345+ driver_path = path ; /* Reuse for temporary storage */
346+ if (* (cl -> modulepath )) {
347+ XNFasprintf (& path , "%s,%s" , cl -> modulepath ,
348+ path ? path : xf86ModulePath );
349+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" default ModulePath extended to \"%s\"\n" ,
350+ cl -> identifier , path );
351+ } else {
352+ XNFasprintf (& path , "%s" , xf86ModulePath );
353+ LogMessageVerb (X_CONFIG , 1 , "OutputClass \"%s\" default ModulePath reset to standard \"%s\"\n" ,
354+ cl -> identifier , path );
355+ }
356+ }
357+ /* Otherwise global module search path is left unchanged */
295358 }
296359 }
297360 }
298361
299- free (path );
362+ if (xf86ModPathFrom != X_CMDLINE ) {
363+ if (path ) {
364+ LoaderSetPath (NULL , path );
365+ free (path );
366+ } else
367+ LoaderSetPath (NULL , xf86ModulePath );
368+ }
300369
301370 /* First see if there is an OutputClass match marking a device as primary */
302371 for (i = 0 ; i < xf86_num_platform_devices ; i ++ ) {
0 commit comments