static void driver_close_device( void *driver_data ) { KeyboardData *data = (KeyboardData*) driver_data; /* stop input thread */ direct_thread_cancel( data->thread ); direct_thread_join( data->thread ); direct_thread_destroy( data->thread ); if (tcsetattr( data->vt_fd, TCSAFLUSH, &data->old_ts ) < 0) D_PERROR("DirectFB/keyboard: tcsetattr for original values failed!\n"); if (dfb_system_type() == CORE_FBDEV && dfb_config->vt) { if (ioctl( data->vt_fd, KDSKBMODE, K_XLATE ) < 0) D_PERROR("DirectFB/keyboard: Could not set mode to XLATE!\n"); if (ioctl( data->vt_fd, KDSETMODE, KD_TEXT ) < 0) D_PERROR("DirectFB/keyboard: Could not set terminal mode to text!\n"); } close( data->vt_fd ); /* free private data */ D_FREE( data ); }
/* * Return the number of available devices. * Called once during initialization of DirectFB. */ static int driver_get_available() { if (dfb_system_type() == CORE_SDL) return 1; return 0; }
static DFBResult Probe( IDirectFBImageProvider_ProbeContext *ctx ) { if (dfb_system_type() == CORE_ANDROID) return DFB_OK; return DFB_UNSUPPORTED; }
static int driver_probe( CoreGraphicsDevice *device ) { switch (dfb_system_type()) { case CORE_X11VDPAU: return 1; default: break; } return 0; }
static int driver_probe(CoreGraphicsDevice *device) { D_DEBUG_AT(PVR2D__2D, "%s()\n", __FUNCTION__); switch (dfb_system_type()) { case CORE_PVR2D: case CORE_CARE1: return 1; default: break; } return 0; }
static int driver_get_available() { int fd; if (dfb_system_type() == CORE_FBDEV && dfb_config->vt) return 1; fd = open( "/dev/tty0", O_RDWR | O_NOCTTY ); if (fd < 0) return 0; close( fd ); return 1; }
static int driver_probe( CoreGraphicsDevice *device ) { switch (dfb_system_type()) { case CORE_X11: { int ee; DFBX11 *x11 = dfb_system_data(); return glXQueryExtension( x11->display, &ee, &ee ); } default: break; } return 0; }
static int driver_get_available( void ) { struct utsname uts; bool check_psaux = true; bool check_input = true; if (dfb_system_type() != CORE_FBDEV) return 0; if (dfb_config->mouse_protocol && (strcasecmp( dfb_config->mouse_protocol, "PS/2") == 0 || strcasecmp( dfb_config->mouse_protocol, "IMPS/2") == 0)) { int fd = open( dfb_config->mouse_source, O_RDONLY | O_NONBLOCK ); if (fd < 0) { D_PERROR( "DirectFB/PS2Mouse: opening %s failed!\n", dfb_config->mouse_source ); return 0; } devlist[0] = dfb_config->mouse_source; close( fd ); return 1; } if (uname( &uts ) < 0) D_PERROR( "DirectFB/PS2Mouse: uname() failed!\n" ); else if (!strncmp( uts.release, "2.6.", 4 ) || !strncmp( uts.release, "2.5.", 4 )) check_psaux = false; if (check_psaux) CHECK_DEVICES( dev_psaux ); if (check_input) CHECK_DEVICES( dev_input ); return ndev; }
static int driver_get_available() { struct serial_struct serial_info; struct timeval timeout; MouseProtocol protocol; fd_set set; int fd; char buf[8]; int readlen; int lines; int flags; if (dfb_system_type() != CORE_FBDEV) return 0; protocol = mouse_get_protocol(); if (protocol == LAST_PROTOCOL) return 0; /* initialize source device name to read from */ /* initialize flags to open device with */ flags = O_NONBLOCK; D_INFO( "DirectFB/SerialMouse: mouse detection on device '%s'...", dfb_config->mouse_source ); /* open device to read from */ fd = open( dfb_config->mouse_source, flags ); if (fd < 0) { D_INFO( "DirectFB/SerialMouse: could not open device '%s'!\n", dfb_config->mouse_source ); return 0; } /* test if this is a serial device */ if (dfb_config->mouse_gpm_source) { /* test whether a there is really a GPM driver active */ /* availibity of device name is enough */ goto success; } else { if (ioctl( fd, TIOCGSERIAL, &serial_info )) goto error; /* test if there's a mouse connected by lowering and raising RTS */ if (ioctl( fd, TIOCMGET, &lines )) goto error; lines ^= TIOCM_RTS; if (ioctl( fd, TIOCMSET, &lines )) goto error; usleep (1000); lines |= TIOCM_RTS; if (ioctl( fd, TIOCMSET, &lines )) goto error; /* wait for the mouse to send 0x4D */ FD_ZERO (&set); FD_SET (fd, &set); timeout.tv_sec = 0; timeout.tv_usec = 50000; while (select (fd+1, &set, NULL, NULL, &timeout) < 0 && errno == EINTR); if (FD_ISSET (fd, &set) && (readlen = read (fd, buf, 8) > 0)) { int i; for (i=0; i<readlen; i++) { if (buf[i] == 0x4D) break; } if (i < readlen) goto success; } } error: D_INFO("DirectFB/SerialMouse: Failed\n"); close (fd); return 0; success: D_INFO("DirectFB/SerialMouse: OK\n"); close (fd); return 1; }
static int driver_probe( CoreGraphicsDevice *device ) { return dfb_system_type() == CORE_SDL; }
/* * Return the number of available devices. * Called once during initialization of DirectFB. */ static int driver_get_available( void ) { return dfb_system_type() == CORE_X11VDPAU; }
static DFBResult driver_open_device( CoreInputDevice *device, unsigned int number, InputDeviceInfo *info, void **driver_data ) { int fd; struct termios ts; KeyboardData *data; if (dfb_system_type() == CORE_FBDEV && dfb_config->vt) { FBDev *dfb_fbdev = dfb_system_data(); fd = dup( dfb_fbdev->vt->fd ); if (fd < 0) { D_PERROR( "DirectFB/Keyboard: Could not dup() file descriptor of TTY!\n" ); return DFB_INIT; } /* put keyboard into medium raw mode */ if (ioctl( fd, KDSKBMODE, K_MEDIUMRAW ) < 0) { D_PERROR( "DirectFB/Keyboard: K_MEDIUMRAW failed!\n" ); return DFB_INIT; } } else { fd = open( "/dev/tty0", O_RDWR | O_NOCTTY ); if (fd < 0) { D_PERROR( "DirectFB/Keyboard: Could not open() /dev/tty0!\n" ); return DFB_INIT; } } /* allocate and fill private data */ data = D_CALLOC( 1, sizeof(KeyboardData) ); data->device = device; data->vt_fd = fd; tcgetattr( data->vt_fd, &data->old_ts ); ts = data->old_ts; ts.c_cc[VTIME] = 0; ts.c_cc[VMIN] = 1; ts.c_lflag &= ~(ICANON|ECHO|ISIG); ts.c_iflag = 0; tcsetattr( data->vt_fd, TCSAFLUSH, &ts ); tcsetpgrp( data->vt_fd, getpgrp() ); /* fill device info structure */ snprintf( info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "Keyboard" ); snprintf( info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" ); /* claim to be the primary keyboard */ info->prefered_id = DIDID_KEYBOARD; /* classify as a keyboard able to produce key events */ info->desc.type = DIDTF_KEYBOARD; info->desc.caps = DICAPS_KEYS; /* enable translation of raw hardware keycodes */ info->desc.min_keycode = 0; info->desc.max_keycode = 127; /* start input thread */ data->thread = direct_thread_create( DTT_INPUT, keyboardEventThread, data, "Keyboard Input" ); /* set private data pointer */ *driver_data = data; return DFB_OK; }
static DFBResult stmfbdevAllocateBuffer (CoreSurfacePool *pool, void *pool_data, void *pool_local, CoreSurfaceBuffer *buffer, CoreSurfaceAllocation *allocation, void *alloc_data) { CoreSurface *surface; STMfbdevPoolData * const data = pool_data; STMfbdevPoolLocalData * const local = pool_local; STMfbdevPoolAllocationData * const alloc = alloc_data; DFBResult ret; Chunk *chunk; D_DEBUG_AT (STMfbdev_Surfaces, "%s (%p)\n", __FUNCTION__, buffer); D_MAGIC_ASSERT (pool, CoreSurfacePool); D_MAGIC_ASSERT (data, STMfbdevPoolData); D_MAGIC_ASSERT (local, STMfbdevPoolLocalData); D_MAGIC_ASSERT (buffer, CoreSurfaceBuffer); D_MAGIC_ASSERT (allocation, CoreSurfaceAllocation); surface = buffer->surface; D_MAGIC_ASSERT (surface, CoreSurface); ret = dfb_surfacemanager_allocate (local->core, data->manager, buffer, allocation, &chunk); if (ret) return ret; D_MAGIC_ASSERT (chunk, Chunk); alloc->chunk = chunk; D_DEBUG_AT (STMfbdev_Surfaces, " -> offset 0x%.8x (%u), format: %s, pitch %d, size %d\n", chunk->offset, chunk->offset, dfb_pixelformat_name (buffer->format), chunk->pitch, chunk->length); allocation->size = chunk->length; allocation->offset = chunk->offset; #if STGFX_DRIVER == 2 if (unlikely (buffer->format == DSPF_RGB32)) { /* for RGB32, we need to set the alpha to 0xff */ STGFX2DriverData * const stdrv = dfb_gfxcard_get_driver_data (); STGFX2DeviceData * const stdev = dfb_gfxcard_get_device_data (); DFBRectangle rect = { .x = 0, .y = 0, .w = buffer->surface->config.size.w, .h = buffer->surface->config.size.h }; D_WARN ("BDisp/Surfaces: RGB32 support is experimental and slow!"); if (dfb_system_type () != CORE_STMFBDEV) D_WARN ("BDisp/Surfaces: RGB32 is only supported in STMfbdev system!"); D_DEBUG_AT (STMfbdev_Surfaces, " -> rgb32 allocation!\n"); dfb_gfxcard_lock (GDLF_WAIT); _bdisp_aq_RGB32_init (stdrv, stdev, data->physical + chunk->offset, chunk->pitch, &rect); dfb_gfxcard_unlock (); } #endif D_MAGIC_SET (alloc, STMfbdevPoolAllocationData); return DFB_OK; }