Пример #1
0
int yyyUSB_stop(yContextSt *ctx,char *errmsg)
{
    stopHIDManager(&ctx->hid);

    if(ctx->usb_thread_state == USB_THREAD_RUNNING){
        ctx->usb_thread_state = USB_THREAD_MUST_STOP;
        CFRunLoopStop(ctx->usb_run_loop);
    }
    pthread_join(ctx->usb_thread,NULL);
    YASSERT(ctx->usb_thread_state == USB_THREAD_STOPED);

    yReleaseGlobalAccess(ctx);

    return 0;
}
Пример #2
0
int yUSB_stop(yContextSt *ctx,char *errmsg)
{

    if ( ctx->hidM ) {
        IOHIDManagerUnscheduleFromRunLoop(ctx->hidM, ctx->usb_run_loop, kCFRunLoopDefaultMode);
        CFRelease( ctx->hidM );
        ctx->hidM=NULL;
    }
    
    
    if(ctx->usb_thread_state == USB_THREAD_RUNNING){
        ctx->usb_thread_state = USB_THREAD_MUST_STOP;
        CFRunLoopStop(ctx->usb_run_loop);       
    }
    pthread_join(ctx->usb_thread,NULL); 
    YASSERT(ctx->usb_thread_state == USB_THREAD_STOPED);

    yDeleteCriticalSection(&ctx->hidMCS);
    yReleaseGlobalAccess(ctx);

    return 0;
}
Пример #3
0
int yyyUSB_stop(yContextSt *ctx,char *errmsg)
{
    int i;
    stringCacheSt *c = stringCache;

    if(ctx->usb_thread_state == USB_THREAD_RUNNING){
        ctx->usb_thread_state = USB_THREAD_MUST_STOP;
        pthread_join(ctx->usb_thread,NULL);
    }
    YASSERT(ctx->usb_thread_state == USB_THREAD_STOPED);

    libusb_exit(ctx->libusb);
    yReleaseGlobalAccess(ctx);
    for (i = 0; i < STRING_CACHE_SIZE; i++, c++) {
        if(c->string) {
            yFree(c->string);
        }
    }
    yDeleteCriticalSection(&ctx->string_cache_cs);

    return YAPI_SUCCESS;
}