--- x11setupdrv.c.orig 2005-08-08 19:10:50 +0300 +++ x11setupdrv.c 2005-10-17 18:04:54 +0300 @@ -45,6 +45,7 @@ {"driver", no_argument, 0, 'd'}, {"nosetup", no_argument, 0, 'n'}, {"help", no_argument, 0, 'h'}, + {"setdrv", required_argument, 0, 's' }, {0, no_argument, 0, 0} }; @@ -65,9 +66,11 @@ int param = 0; int driver = 0; int nosetup = 0; + int setdrv = 0; + unsigned char drv_name[51]; const char *cmdline; - while ((c = getopt_long (argc, argv, "cpdnh", longopts, 0)) != -1) + while ((c = getopt_long (argc, argv, "cpdnhs:", longopts, 0)) != -1) switch (c) { case 'c': config = 1; @@ -83,6 +86,11 @@ break; case 'h': usage (stdout, EXIT_SUCCESS); + break; + case 's': + strncpy(drv_name,optarg,50); + setdrv=1; + break; default: usage (stderr, EXIT_FAILURE); } @@ -101,7 +109,6 @@ XF86ConfigPtr conf; if (!(conf = xf86readConfigFile ())) error (1, errno, "%s: unable to parse config file", filename); - xf86closeConfigFile (); const char *drivername = conf->conf_layout_lst->lay_adjacency_lst->adj_screen->scrn_device->dev_driver; @@ -114,6 +121,10 @@ if (nosetup == 0) { char *path; + if ( setdrv == 1) { + conf->conf_layout_lst->lay_adjacency_lst->adj_screen->scrn_device->dev_driver=strdup(drv_name); + xf86writeConfigFile ( filename, conf ); + } if (asprintf (&path, "%s/%s", DRVDIR, drivername) < 0) error (1, errno, "asprintf"); execl (path, drivername, param ? filename : NULL, NULL); @@ -123,6 +134,7 @@ execl (path, "x11", NULL); }; + xf86closeConfigFile (); /* error (1, errno, "execl: %s", path); */ return 1; }