*** input/kii/kii.c.orig Mon Apr 14 12:34:49 2003 --- input/kii/kii.c Mon Apr 14 12:40:07 2003 *************** *** 33,39 **** kiic_mapper_identify_request_t request; kiic_mapper_identify_result_t result; } identify; ! if (NULL == ctx) { return -KII_ERRNO(LIB, INVAL); --- 33,42 ---- kiic_mapper_identify_request_t request; kiic_mapper_identify_result_t result; } identify; ! union { ! kiic_mapper_attach_request_t request; ! kiic_mapper_attach_result_t result; ! } attach; if (NULL == ctx) { return -KII_ERRNO(LIB, INVAL); *************** *** 52,57 **** --- 55,72 ---- return -KII_ERRNO(LIB, INVAL); } + #ifdef __FreeBSD__ + memset(&attach, 0, sizeof(attach)); + + /* Pass an invalid device id to force auto attachement */ + attach.request.device_id = -1; + if (ioctl((*ctx)->mapper.fd, KIIC_MAPPER_ATTACH, &attach)) { + + perror("failed to attach to device"); + return errno; + } + #endif + memset(&identify, 0, sizeof(identify)); strncpy(identify.request.client, "libkii", sizeof(identify.request.client)); *************** *** 176,182 **** void kiiPrintEvent(kii_context_t *kii, FILE *f, const kii_event_t *e) { fprintf(f, "event: size %i, focus %i, device %i, time %i", ! e->any.size, e->any.focus, e->any.device, e->any.time); switch (e->any.type) { --- 191,197 ---- void kiiPrintEvent(kii_context_t *kii, FILE *f, const kii_event_t *e) { fprintf(f, "event: size %i, focus %i, device %i, time %i", ! e->any.size, e->any.focus, e->any.device, (int)e->any.time); switch (e->any.type) {