> Date: Thu, 21 Apr 2016 22:04:42 +0200
> From: Matthieu Herrb <[email protected]>
> 
> On Thu, Apr 21, 2016 at 02:39:32PM +0200, Matthieu Herrb wrote:
> > On Thu, Apr 21, 2016 at 01:22:40PM +0100, Stuart Henderson wrote:
> > > If the bootloader sets up a serial console, I can no longer get X to
> > > start:
> > > 
> > > [   138.658] (--) checkDevMem: using aperture driver /dev/xf86
> > > [   138.738] (EE) 
> > > Fatal server error:
> > > [   138.738] (EE) xf86OpenConsole: No console driver found
> > >   Supported drivers: wscons
> > >   Check your kernel's console driver configuration and /dev entries(EE) 
> > > [   138.738] (EE) 
> > > Please consult the The X.Org Foundation support 
> > >    at http://wiki.x.org
> > >  for help. 
> > > [   138.738] (EE) Please also check the log file at "/var/log/Xorg.0.log" 
> > > for additional information.
> > > [   138.738] (EE) 
> > > [   138.739] (EE) Server terminated with error (1). Closing log file.
> > > 
> > > Any ideas what it was that might have broken this?
> > 
> > Very probably the switch to native WSCONS support in the X server, and
> > more precisely the fact that the X server now uses sysctl to figure
> > out what is the console device to open.
> > 
> > I need to tink a bit on a good solution... 
> >
> 
> This diff should fix the problem by testing if the console device is a
> wsdisplay(4) device and falling back to /dev/ttyCn otherwise. I've
> changed the logic a bit in the hope to make the code more readable,
> but it's still a bit of a mess.

I think that makes sense.

> I don't know if we need to add a knob to explicitely set the path of
> the device to use for X.

I could use such a knob to test Xorg on my blade2k with multiple
graphics cards.  We also would need such a knob if we'd want to
support "multi-seat" configurations.  But the vast majority of the
users (including sthen@) wouldn't need it.

> Index: bsd_init.c
> ===================================================================
> RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/os-support/bsd/bsd_init.c,v
> retrieving revision 1.18
> diff -u -p -u -r1.18 bsd_init.c
> --- bsd_init.c        2 Apr 2016 14:25:10 -0000       1.18
> +++ bsd_init.c        21 Apr 2016 19:55:19 -0000
> @@ -611,17 +611,27 @@ xf86OpenWScons(void)
>      if (xf86Info.ShareVTs)
>          FatalError("-sharevt is not supported with wscons\n");
>  
> +    /* default value if probing the console device fails */
> +    snprintf(vtprefix, sizeof(vtprefix), "/dev/ttyC");
> +
> +    /* probe console device - it my be /dev/ttyD0 on some multi-heads setups 
> */
>      mib[0] = CTL_KERN;
>      mib[1] = KERN_CONSDEV;
>      len = sizeof(dev);
>      if (sysctl(mib, 2, &dev, &len, NULL, 0) != -1) {
> -        snprintf(vtprefix, sizeof(vtprefix), "/dev/%s", devname(dev, 
> S_IFCHR));
> -        /* strip number, assuming 0 */
> -        p = strchr(vtprefix, '0');
> -        *p = '\0';
> -    } else
> -        snprintf(vtprefix, sizeof(vtprefix), "/dev/ttyC");
> -
> +        snprintf(vtname, sizeof(vtname), "/dev/%s", devname(dev, S_IFCHR));
> +     if ((fd = open(vtname, O_RDWR)) != -1) {
> +         if (ioctl(fd, WSDISPLAYIO_GTYPE, &i) == 0) {
> +                /* console is a wsdisplay(4) device */
> +                strlcpy(vtprefix, vtname, sizeof(vtprefix));
> +                /* strip number, assuming 0 */
> +                p = strchr(vtprefix, '0');
> +                *p = '\0';
> +             close(fd);
> +             fd = -1;
> +         }
> +     }
> +    }
>      if (VTnum != -1) {
>          snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, VTnum - 1);
>          xf86Info.vtno = VTnum;
> 
> -- 
> Matthieu Herrb
> 
> --HP6Q57Svx0BGs1ke
> Content-Type: text/plain; charset=us-ascii
> X-Former-Content-Type: application/pgp-signature; name="signature.asc"
> 
> [file:/home/kettenis/detached/signature_0030.asc]
> --HP6Q57Svx0BGs1ke--
> 
> 

Reply via email to