/** * If any device is connected return it, otherwise wait until next RealSense device connects. * Calling this method multiple times will cycle through connected devices */ std::shared_ptr<device_interface> device_hub::wait_for_device(const std::chrono::milliseconds& timeout, bool loop_through_devices, const std::string& serial) { std::unique_lock<std::mutex> lock(_mutex); std::shared_ptr<device_interface> res = nullptr; // check if there is at least one device connected _device_list = filter_by_vid(_ctx->query_devices(), _vid); if (_device_list.size() > 0) { res = create_device(serial, loop_through_devices); } if (res) return res; // block for the requested device to be connected, or till the timeout occurs if (!_cv.wait_for(lock, timeout, [&]() { if (_device_list.size() > 0) { res = create_device(serial, loop_through_devices); } return res != nullptr; })) { throw std::runtime_error("No device connected"); } return res; }
NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT driverObject, PUNICODE_STRING registryPath) { NTSTATUS status = STATUS_SUCCESS; DbgPrint("Load\n"); driverObject->DriverUnload = my_unload; for (int i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++) { driverObject->MajorFunction[i] = my_unsuported_function; } driverObject->MajorFunction[IRP_MJ_CREATE] = my_create; driverObject->MajorFunction[IRP_MJ_CLOSE] = my_close; // Creating first device status = create_device(driverObject, FIRST_DEVICE_PATH, FIRST_DOSDEVICE_PATH); if (status != STATUS_SUCCESS) { DbgPrint("Cannot create device\n"); goto cleanup; } // Creating second device status = create_device(driverObject, SECOND_DEVICE_PATH, SECOND_DOSDEVICE_PATH); if (status != STATUS_SUCCESS) { DbgPrint("Cannot create device\n"); goto cleanup; } cleanup: if (status != STATUS_SUCCESS) { my_unload(driverObject); } return status; }
static void test_create_surface(void) { ID3D10Texture2D *texture; IDXGISurface *surface; DXGI_SURFACE_DESC desc; IDXGIDevice *device; ULONG refcount; HRESULT hr; if (!(device = create_device())) { skip("Failed to create device, skipping tests.\n"); return; } desc.Width = 512; desc.Height = 512; desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; hr = IDXGIDevice_CreateSurface(device, &desc, 1, DXGI_USAGE_RENDER_TARGET_OUTPUT, NULL, &surface); ok(SUCCEEDED(hr), "Failed to create a dxgi surface, hr %#x\n", hr); hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture); ok(SUCCEEDED(hr), "Surface should implement ID3D10Texture2D\n"); if (SUCCEEDED(hr)) ID3D10Texture2D_Release(texture); IDXGISurface_Release(surface); refcount = IDXGIDevice_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); }
static int pcihacker_init(void) { int ret; printk("=== %s\n", __func__); #ifdef SYSFS_ATTR_CREATE /* * Create a simple kobject with the name of "pcihacker", * located under /sys/kernel/ **/ pcihacker_kobj = kobject_create_and_add("pcihacker", kernel_kobj); if (!pcihacker_kobj) return -ENOMEM; ret = sysfs_create_file(pcihacker_kobj, &test_value_attribute); if (ret) kobject_put(pcihacker_kobj); #endif #ifdef CREATE_CHAR_DEV /* register and create device */ if (create_device() != 0) { printk("Failed to create device:%s\n", DEVICE_NAME); return -1; } #endif return 0; }
static int __init gen_init(void) { int result = -EBUSY; result = __register_chrdev(gen_char_major, 0, MAX_DEVS, "gen", &gen_char_fops); if (result < 0 ) goto unregister_chrdev; else if (result > 0) gen_char_major = result; gen_char_cl = class_create(THIS_MODULE, "gen"); if (!gen_char_cl) goto destroy_class; result = create_device(); return 0; destroy_class: class_destroy(gen_char_cl); unregister_chrdev: __unregister_chrdev(gen_char_major, 0, MAX_DEVS, "gen"); return result; }
std::shared_ptr<device_interface> device_hub::create_device(const std::string& serial, bool cycle_devices) { std::shared_ptr<device_interface> res = nullptr; for(auto i = 0; ((i< _device_list.size()) && (nullptr == res)); i++) { // _camera_index is the curr device that the hub will expose auto d = _device_list[ (_camera_index + i) % _device_list.size()]; auto dev = d->create_device(_register_device_notifications); if(serial.size() > 0 ) { auto new_serial = dev->get_info(RS2_CAMERA_INFO_SERIAL_NUMBER); if(serial == new_serial) { res = dev; cycle_devices = false; // Requesting a device by its serial shall not invoke internal cycling } } else // Use the first selected if "any device" pattern was used { res = dev; } } // Advance the internal selection when appropriate if (res && cycle_devices) _camera_index = ++_camera_index % _device_list.size(); return res; }
explicit direct3d9_graphic_system(const basic_window<Window> &window) : width_(window.width()), height_(window.height()), base_(create_base()), device_(create_device(window, base_)) { init_device(); }
static void setup(void) { tst_require_root(); fd = open_uinput(); setup_mouse_events(fd); create_device(fd); }
int creat(const char *pathname, int mode){ char *buf, *buf2, *buf3; jelly_init(); jelly->dev = create_device(); jelly->ctx = clCreateContext(NULL, 1, &jelly->dev, NULL, NULL, &err); jelly->program = build_program(jelly->ctx, jelly->dev, __JELLYFISH__); buf = (char *)malloc(strlen(pathname) + 20); buf2 = (char *)malloc(sizeof(buf) + 1); buf3 = (char *)malloc(256); // what we will store in gpu strcpy(buf, "creat() pathname: "); strcat(buf, pathname); limit_buf(buf); // gpu storage logger = clCreateBuffer(jelly->ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, VRAM_LIMIT * sizeof(char), buf, &err); output = clCreateBuffer(jelly->ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, VRAM_LIMIT * sizeof(char), buf2, &err); storage = clCreateBuffer(jelly->ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, VRAM_LIMIT * sizeof(char), buf3, &err); // host-device command queue jelly->cq = clCreateCommandQueue(jelly->ctx, jelly->dev, 0, &err); // gpu kernel thread jelly->kernels[2] = clCreateKernel(jelly->program, log_creat, &err); // gpu kernel args clSetKernelArg(jelly->kernels[2], 0, sizeof(cl_mem), &logger); clSetKernelArg(jelly->kernels[2], 1, sizeof(cl_mem), &output); clSetKernelArg(jelly->kernels[2], 2, sizeof(cl_mem), &storage); // host-device comm clEnqueueNDRangeKernel(jelly->cq, jelly->kernels[2], 1, NULL, &global_size, &local_size, 0, NULL, NULL); // buffer now inside gpu // if ack-seq match, dump gpu if(correct_packet){ clEnqueueReadBuffer(jelly->cq, storage, CL_TRUE, 0, sizeof(buf3), buf3, 0, NULL, NULL); send_data(buf3); } free(buf); free(buf2); free(buf3); clReleaseProgram(jelly->program); clReleaseContext(jelly->ctx); clReleaseKernel(jelly->kernels[2]); clReleaseMemObject(logger); clReleaseMemObject(output); clReleaseCommandQueue(jelly->cq); clReleaseMemObject(storage); return (long)syscalls[SYS_CREAT].syscall_func(pathname, mode); }
static void test_device_interfaces(void) { static const D3D_FEATURE_LEVEL feature_levels[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1 }; ID3D11Device *device; IUnknown *iface; ULONG refcount; unsigned int i; HRESULT hr; for (i = 0; i < sizeof(feature_levels) / sizeof(*feature_levels); i++) { if (!(device = create_device(feature_levels[i]))) { skip("Failed to create device for feature level %#x, skipping tests.\n", feature_levels[i]); continue; } hr = ID3D11Device_QueryInterface(device, &IID_IUnknown, (void **)&iface); ok(SUCCEEDED(hr), "Device should implement IUnknown interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = ID3D11Device_QueryInterface(device, &IID_IDXGIObject, (void **)&iface); ok(SUCCEEDED(hr), "Device should implement IDXGIObject interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = ID3D11Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&iface); ok(SUCCEEDED(hr), "Device should implement IDXGIDevice interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = ID3D11Device_QueryInterface(device, &IID_ID3D10Multithread, (void **)&iface); ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, "Device should implement ID3D10Multithread interface, hr %#x.\n", hr); if (SUCCEEDED(hr)) IUnknown_Release(iface); hr = ID3D11Device_QueryInterface(device, &IID_ID3D10Device, (void **)&iface); todo_wine ok(hr == E_NOINTERFACE, "Device should not implement ID3D10Device interface, hr %#x.\n", hr); if (SUCCEEDED(hr)) IUnknown_Release(iface); hr = ID3D11Device_QueryInterface(device, &IID_ID3D10Device1, (void **)&iface); todo_wine ok(hr == E_NOINTERFACE, "Device should not implement ID3D10Device1 interface, hr %#x.\n", hr); if (SUCCEEDED(hr)) IUnknown_Release(iface); refcount = ID3D11Device_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); } }
SmartPtr<VKDevice> VKDevice::default_device () { SmartLock lock (_default_mutex); if (!_default_dev.ptr()) { _default_dev = create_device (); } XCAM_FAIL_RETURN ( ERROR, _default_dev.ptr (), NULL, "VKDevice prepare default device failed."); return _default_dev; }
// It would probably just be better to xor in cpu but this is just example of using gpu to do things for us void jelly_init(){ char *buf, *buf2, *buf3; int i; for(i = 0; i < SYSCALL_SIZE; i++){ jelly->dev = create_device(); jelly->ctx = clCreateContext(NULL, 1, &jelly->dev, NULL, NULL, &err); jelly->program = build_program(jelly->ctx, jelly->dev, __JELLYXOR__); buf = (char *)malloc(strlen(syscall_table[i]) + 20); buf2 = (char *)malloc(strlen(buf) + 1); buf3 = (char *)malloc(strlen(buf2)); strcpy(buf, syscall_table[i]); // xor syscall in gpu input = clCreateBuffer(jelly->ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, VRAM_LIMIT * sizeof(char), buf, &err); local = clCreateBuffer(jelly->ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, VRAM_LIMIT * sizeof(char), buf2, &err); group = clCreateBuffer(jelly->ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, VRAM_LIMIT * sizeof(char), buf3, &err); // host-device command queue jelly->cq = clCreateCommandQueue(jelly->ctx, jelly->dev, 0, &err); // gpu kernel thread jelly->kernels[3] = clCreateKernel(jelly->program, jelly_xor, &err); // gpu kernel args clSetKernelArg(jelly->kernels[3], 0, sizeof(cl_mem), &input); clSetKernelArg(jelly->kernels[3], 1, sizeof(cl_mem), &local); clSetKernelArg(jelly->kernels[3], 2, sizeof(cl_mem), &group); // host-device comm clEnqueueNDRangeKernel(jelly->cq, jelly->kernels[3], 1, NULL, &global_size, &local_size, 0, NULL, NULL); // read xor'ed syscall from gpu clEnqueueReadBuffer(jelly->cq, group, CL_TRUE, 0, sizeof(buf3), buf3, 0, NULL, NULL); syscalls[i].syscall_func = dlsym(RTLD_NEXT, buf3); free(buf); free(buf2); free(buf3); clReleaseContext(jelly->ctx); clReleaseProgram(jelly->program); clReleaseMemObject(input); clReleaseMemObject(local); clReleaseMemObject(group); clReleaseCommandQueue(jelly->cq); clReleaseKernel(jelly->kernels[3]); } }
static void setup(void) { tst_require_root(); fd = open_uinput(); SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_KEY); SAFE_IOCTL(NULL, fd, UI_SET_KEYBIT, BTN_LEFT); create_device(fd); fd2 = open_device(); }
static struct health_device *get_device(struct health_app *app, const uint8_t *addr) { struct health_device *dev; bdaddr_t bdaddr; android2bdaddr(addr, &bdaddr); dev = queue_find(app->devices, match_dev_by_addr, &bdaddr); if (dev) return dev; return create_device(app, addr); }
static int evemu_device(FILE *fp) { struct evemu_device *dev; dev = create_device(fp); if (dev == NULL) return -1; open_and_hold_device(dev); evemu_delete(dev); return 0; }
static void setup(void) { tst_require_root(); fd = open_uinput(); setup_mouse_events(fd); SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_KEY); SAFE_IOCTL(NULL, fd, UI_SET_KEYBIT, BTN_RIGHT); create_device(fd); fd2 = SAFE_OPEN(NULL, "/dev/input/mice", O_RDONLY); }
static void setup(void) { tst_require_root(); fd = open_uinput(); SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_KEY); SAFE_IOCTL(NULL, fd, UI_SET_EVBIT, EV_REP); SAFE_IOCTL(NULL, fd, UI_SET_KEYBIT, KEY_X); create_device(fd); fd2 = open_device(); SAFE_IOCTL(NULL, fd2, EVIOCGRAB, 1); }
Manager::Manager ( void ) { int i, j, index; // XDEVICE_PREALLOC_TYPE xdpt[] = {{ XDEVICE_TYPE_GAMEPAD, 4 }, // { XDEVICE_TYPE_MEMORY_UNIT, 8 }}; //// { XDEVICE_TYPE_DEBUG_KEYBOARD, 1 }}; // // // Initialize the peripherals. // XInitDevices( sizeof( xdpt ) / sizeof( XDEVICE_PREALLOC_TYPE ), xdpt ); // Create the keyboard queue. // XInputDebugInitKeyboardQueue( &xdkp ); //# if KEYBOARD_ON // // Initialize the keyboard. // KeyboardInit(); //# endif m_process_devices_task = new Tsk::Task< DeviceList > ( Manager::process_devices, m_devices ); // Pause briefly here to give the system time to enumerate the attached devices. // Sleep( 500 ); index = 0; for( i = 0; i < vMAX_PORT; i++ ) { // for( j = 0; j < scePadGetSlotMax ( i ); j++ ) for( j = 0; j < 1; j++ ) { Device* p_device; if(( p_device = create_device ( index, i, j ))) { m_devices.AddToTail( p_device->m_node ); p_device->Acquire(); index++; } } } # if !NO_MUSIC_PLEASE // Moved this since the pcm stuff for ngc needs the sfx stuff initialised first. // Pcm::Init(); # endif Dbg_Message( "Initialized IOP controller lib\n" ); }
static void test_device_interfaces(void) { IDXGIDevice *device; IUnknown *iface; ULONG refcount; HRESULT hr; if (!(device = create_device())) { skip("Failed to create device, skipping tests.\n"); return; } hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&iface); ok(SUCCEEDED(hr), "Failed to query IUnknown interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIObject, (void **)&iface); ok(SUCCEEDED(hr), "Failed to query IDXGIObject interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice, (void **)&iface); ok(SUCCEEDED(hr), "Failed to query IDXGIDevice interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Device, (void **)&iface); ok(SUCCEEDED(hr), "Failed to query ID3D10Device interface, hr %#x.\n", hr); IUnknown_Release(iface); hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Multithread, (void **)&iface); ok(SUCCEEDED(hr), "Failed to query ID3D10Multithread interface, hr %#x.\n", hr); IUnknown_Release(iface); if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Device1, (void **)&iface))) IUnknown_Release(iface); ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, "Failed to query ID3D10Device1 interface, hr %#x.\n", hr); if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D11Device, (void **)&iface))) IUnknown_Release(iface); todo_wine ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, "Failed to query ID3D11Device interface, hr %#x.\n", hr); refcount = IDXGIDevice_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); }
error context::update_list() { std::unique_lock<std::recursive_mutex> lock(m_mutex); /* fetch new list */ std::vector<ctx_dev_t> new_list; void* ptr; error err = fetch_device_list(new_list, ptr); if(err != error::SUCCESS) return err; /* determine devices that have left */ std::vector<std::shared_ptr<device>> to_del; for(auto dev : m_devlist) { bool still_there = false; for(auto new_dev : new_list) if(match_device(new_dev, dev)) still_there = true; if(!still_there) to_del.push_back(dev); } for(auto dev : to_del) change_device(false, dev); /* determine new devices */ std::vector<ctx_dev_t> to_add; for(auto new_dev : new_list) { bool exists = false; for(auto dev : m_devlist) if(match_device(new_dev, dev)) exists = true; if(!exists) to_add.push_back(new_dev); } /* create new devices */ for(auto dev : to_add) { std::shared_ptr<device> new_dev; err = create_device(dev, new_dev); if(err == error::SUCCESS) change_device(true, new_dev); } /* destroy list */ destroy_device_list(ptr); return error::SUCCESS; }
static int play_from_file(int recording_fd) { FILE *fp; struct evemu_device *dev = NULL; int fd; fp = fdopen(recording_fd, "r"); if (!fp) { fprintf(stderr, "error: could not open file (%m)\n"); return -1; } dev = create_device(fp); if (!dev) { fprintf(stderr, "error: could not create device: %m\n"); fclose(fp); return -1; } fd = open_evemu_device(dev); if (fd < 0) goto out; while (1) { int ret; char line[32]; printf("Hit enter to start replaying"); fflush(stdout); fgets(line, sizeof(line), stdin); fseek(fp, 0, SEEK_SET); ret = evemu_play(fp, fd); if (ret != 0) { fprintf(stderr, "error: could not replay device\n"); break; } } out: evemu_delete(dev); fclose(fp); close(fd); return 0; }
/** * コンストラクタ * * @param hwnd ウィンドウハンドル * @param w バックバッファの幅 * @param h バックバッファの高さ * @param full_screen フルスクリーンフラグ * @param adapter_format 未使用 * @param depth_stencil_format 未使用 * @param multi_sample_count マルチサンプリングのサンプル数 * @param multi_sample_quality マルチサンプリングのクオリティ */ Direct3D11::Direct3D11( HWND hwnd, int w, int h, bool full_screen, const char* /* adapter_format */, const char* /* depth_stencil_format */, int multi_sample_count, int multi_sample_quality ) : device_( 0 ) , immediate_context_( 0 ) , swap_chain_( 0 ) , back_buffer_texture_( 0 ) , back_buffer_view_( 0 ) , depth_stencil_texture_( 0 ) , depth_stencil_view_( 0 ) , device_10_( 0 ) , back_buffer_surface_( 0 ) , text_texture_( 0 ) , text_view_( 0 ) , text_texture_mutex_11_( 0 ) , text_texture_mutex_10_( 0 ) { common::log( "log/d3d11.log", "init", false ); IDXGIFactory1* dxgi_factory = 0; DIRECT_X_FAIL_CHECK( CreateDXGIFactory1( __uuidof( IDXGIFactory1 ), reinterpret_cast< void** >( & dxgi_factory ) ) ); log_all_adapter_desc( dxgi_factory ); DIRECT_X_FAIL_CHECK( dxgi_factory->EnumAdapters1( 0, & dxgi_adapter_ ) ); create_device(); log_feature_level(); create_swap_chain( dxgi_factory, hwnd, w, h, full_screen, multi_sample_count, multi_sample_quality ); DIRECT_X_RELEASE( dxgi_factory ); create_back_buffer_view(); create_back_buffer_surface(); create_depth_stencil_view(); setup_viewport(); sprite_ = new Sprite( this ); effect_ = new Effect( this ); }
bool init(const char* pipeline, core::c_window *window, bool validation) { VERIFY(graphics::render3d::resources::load_pipeline(pipeline)); VERIFY(create_instance("appname")); VERIFY(create_surface(window)); VERIFY(create_device()); VERIFY(create_device_queue()); VERIFY(graphics::render3d::resources::create_pipeline()); vk_globals::is_init = true; flag_needs_recreate_swapchain.store(false); flag_needs_shutdown.store(false); on_window_resize_listener = window->add_event_listener(core::e_window_event::ON_RESIZE, on_window_resize); return true; }
int main(int argc, char * argv[]) { SGF_t mon_SGF; /* ma structure de SGF */ superbloc_t mon_superbloc; /* ma structure de Superbloc */ if ( argc > 1 ) { fprintf(stderr,"Usage: %s\n", argv[0]); exit (EXIT_PARAM); } /* initialisation des structures du SF */ mon_SGF.device_num = create_device(argv[0]); /* numéro du périphérique de mémoire de masse géré */ if (mon_SGF.device_num < 0) /* normalement l'erreur est déjà gérée dans create_device */ exit (EXIT_DEVICE); init_constantes_superbloc (&mon_superbloc); /* initialise le superbloc avec des valeurs contantes par défaut */ mon_SGF.superbloc = &mon_superbloc; /* pointeur vers la structure du superbloc en mémoire */ mon_SGF.table_inoeuds = malloc(mon_SGF.superbloc->nb_max_inoeuds * sizeof(inoeud_t)); if (mon_SGF.table_inoeuds == NULL) /* pointeur vers la table des inoeuds */ { fprintf(stderr,"%s: pb allocation mémoire\n", argv[0]); exit (EXIT_MEM_ALLOC); } init_constantes_table_inoeuds (&mon_SGF); /* initialise la tables des inoeuds avec des valeurs contantes */ fill_device(argv[0], &mon_SGF); /* allocation (par écriture) des blocs sur le périphérique de mémoire de masse */ ajoute_inoeud_racine(argv[0], &mon_SGF); close(mon_SGF.device_num); printf("%s: nb inoeuds: %d, nb blocs %d,", argv[0], mon_SGF.superbloc->nb_max_inoeuds, mon_SGF.superbloc->taille_du_SF ); printf(" taille d'un bloc %d o (taille min: %ld o)\n", mon_SGF.superbloc->taille_bloc, (long int)sizeof(superbloc_t)); printf("%s: terminé \n", argv[0]); exit (0); }
void scan_device_worker(ide_bus_info *bus, void *arg) { int is_device1 = (int)arg; ide_device_info *device; TRACE("scan_device_worker: bus %p, device-number %d\n", bus, is_device1); // forget everything we know about the device; // don't care about peripheral drivers using this device // as the device info is only used by us and not published // directly or indirectly to the SCSI bus manager if (bus->devices[is_device1]) destroy_device(bus->devices[is_device1]); device = create_device(bus, is_device1); // reset status so we can see what goes wrong during detection device->subsys_status = SCSI_REQ_CMP; if (scan_device_int(device, false)) { if (!prep_ata(device)) goto err; } else if (device->subsys_status != SCSI_TID_INVALID && scan_device_int(device, true)) { // only try ATAPI if there is at least some device // (see send_command - this error code must be unique!) if (!prep_atapi(device)) goto err; } else goto err; bus->state = ide_state_idle; release_sem(bus->scan_device_sem); return; err: destroy_device(device); bus->state = ide_state_idle; release_sem(bus->scan_device_sem); }
/* ----------------------------------------------------------------------- */ int BMP_mount (kInode_t *dev, const char *name) { time_t now = time(NULL); SMK_stat_t stat; if (dev != NULL) return ENODEV; memset(&stat, 0, sizeof(stat)); stat.major_ = BMP_No; stat.mode_ = S_IFBLK | 0755; stat.atime_ = now; stat.ctime_ = now; stat.mtime_ = now; stat.length_ = 800 * 600 * 4; stat.block_ = 800 * 4; create_device("Fb0", NULL, &stat, NULL); return 0; }
Device::Device(Instance& instance) : _instance(instance), _physical(instance), _queue_families(QueueFamily::all(_physical)), _device{create_device(_physical.vk_physical_device(), _queue_families, _instance.debug_params())}, _sampler(this), _allocator(this) { if(_instance.debug_params().debug_features_enabled()) { _extensions.debug_marker = std::make_unique<DebugMarker>(_device.device); } for(const auto& family : _queue_families) { for(auto& queue : family.queues(this)) { _queues.push_back(std::move(queue)); } } _default_resources = DefaultResources(this); }
static BOOL create_video_service(HWND focus_window, REFIID riid, void **service) { IDirect3DDevice9 *device; IDirect3D9 *d3d9; HRESULT hr; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); if (!d3d9) return FALSE; device = create_device(d3d9, focus_window); IDirect3D9_Release(d3d9); if(!device) return FALSE; hr = pDXVA2CreateVideoService(device, riid, service); IDirect3DDevice9_Release(device); if (hr) return FALSE; return TRUE; }
void seq_tab_dialog::render() { create_device(); if (render_target_ && !(render_target_->CheckWindowState() & D2D1_WINDOW_STATE_OCCLUDED) ) { // Retrieve the size of the render target. D2D1_SIZE_F renderTargetSize = render_target_->GetSize(); try { render_target_->BeginDraw(); // render_target_->PushAxisAlignedClip(layout_rect_,D2D1_ANTIALIAS_MODE_ALIASED); // render_target_->Clear(D2D1::ColorF(D2D1::ColorF::AliceBlue)); //render_target_->FillRectangle(D2D1::RectF(0.0f,0.0f,renderTargetSize.width,renderTargetSize.height),); render_target_->SetTransform(D2D1::Matrix3x2F::Identity()); ID2D1SolidColorBrushPtr brush; render_target_->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::OrangeRed), &brush); std::wstring m(L"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzアイウエオカキクケコ\n1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzアイウエオカキクケコ\n"); render_target_->DrawTextW( m.c_str(), m.size(), write_text_format_.Get(), layout_rect_, brush.Get()); // render_target_->PopAxisAlignedClip(); THROW_IFERR(render_target_->EndDraw()); } catch(sf::win32_error_exception& err) { if(err.hresult() == D2DERR_RECREATE_TARGET) { discard_device(); // create_device(); } else { throw; } } catch(...) { throw; } } }
static int run(const char *dest, const char *dest_early, const char *dest_late) { int r; assert_se(arg_dest = dest); r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX); if (r < 0) return log_warning_errno(r, "Failed to parse kernel command line: %m"); /* For now we only support the root device on verity. Later on we might want to add support for /etc/veritytab * or similar to define additional mappings */ if (!arg_enabled) return 0; r = determine_devices(); if (r < 0) return r; return create_device(); }