Bool fbdevHWProbe(struct pci_device *pPci, char *device, char **namep) { int fd; if (pPci) fd = fbdev_open_pci(pPci, namep); else fd = fbdev_open(-1, device, namep); if (-1 == fd) return FALSE; close(fd); return TRUE; }
Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device) { fbdevHWPtr fPtr; TRACE_ENTER("Init"); fbdevHWGetRec(pScrn); fPtr = FBDEVHWPTR(pScrn); /* open device */ if (pPci) fPtr->fd = fbdev_open_pci(pPci,NULL); else fPtr->fd = fbdev_open(pScrn->scrnIndex,device,NULL); if (-1 == fPtr->fd) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to open framebuffer device, consult warnings" " and/or errors above for possible reasons\n" "\t(you may have to look at the server log to see" " warnings)\n"); return FALSE; } /* get current fb device settings */ if (-1 == ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ioctl FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (-1 == ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } /* we can use the current settings as "buildin mode" */ fbdev2xfree_timing(&fPtr->var, &fPtr->buildin); fPtr->buildin.name = "current"; fPtr->buildin.next = &fPtr->buildin; fPtr->buildin.prev = &fPtr->buildin; fPtr->buildin.type |= M_T_BUILTIN; return TRUE; }