Getting pointer information...

bridged with qdn.public.ddk.input
Post Reply
Charlie Surface

Getting pointer information...

Post by Charlie Surface » Tue Feb 26, 2002 9:55 pm

Has anyone had any luck using _POINTERGETINFO to dynamically determine the
type (mouse or touch) of an input device? I posted about this awhile back,
but I think the server ate my post (or maybe my newsreader did it). Note
that I'm interested in using a pointer device via the resource manager
interface. Basically my problem is that I tried using this macro, and it
didn't really work. The snippet below is what I tried, using an opened
device. I usually get an "Inappropriate I/O control operation" error.

static int getInfo(int fd) {
struct _pointer_info info;
int buf[100];
int rc;

memset(&info,0,sizeof(info));

rc = devctl(fd,_POINTERGETINFO,&info,sizeof(info),buf);
if (rc != EOK) {
printf("Could not get device info: %s\n",strerror(rc));
return 1;
}

printf("info.type.type 0x%08X\n",info.type.type);

return EOK;
}


Anyone have any clues? Alex, are you still around?

thanks
Charlie

Alex Chapiro

Re: Getting pointer information...

Post by Alex Chapiro » Mon Mar 04, 2002 2:02 pm

You should analize flag field (two possible values are _POINTER_FLAG_TOUCH
and _POINTER_FLAG_MOUSE. (see sys/dcmd_input.h). Field type is always
_INTERACT_TYPE_POINTER whether you use mouse or touchscreen as a pointer
device.

"Charlie Surface" <charlie_surface@oti.com> wrote in message
news:a5gvs6$kq1$1@inn.qnx.com...
Has anyone had any luck using _POINTERGETINFO to dynamically determine the
type (mouse or touch) of an input device? I posted about this awhile
back,
but I think the server ate my post (or maybe my newsreader did it). Note
that I'm interested in using a pointer device via the resource manager
interface. Basically my problem is that I tried using this macro, and it
didn't really work. The snippet below is what I tried, using an opened
device. I usually get an "Inappropriate I/O control operation" error.

static int getInfo(int fd) {
struct _pointer_info info;
int buf[100];
int rc;

memset(&info,0,sizeof(info));

rc = devctl(fd,_POINTERGETINFO,&info,sizeof(info),buf);
if (rc != EOK) {
printf("Could not get device info: %s\n",strerror(rc));
return 1;
}

printf("info.type.type 0x%08X\n",info.type.type);

return EOK;
}


Anyone have any clues? Alex, are you still around?

thanks
Charlie



Guest

Re: Getting pointer information...

Post by Guest » Mon Mar 04, 2002 5:05 pm

Thanks, but I guess I wasn't clear enough in my original post. I am
unable to get anything back from the device I am working with. I am using
/dev/devi/mouse0 on an x86 box running version 6.1. I use the following
command to start the input drivers when I am not in Photon mode:
"/usr/photon/bin/devi-hirun -Pr kbd fd -d /dev/kbd ps2 mousedev rel -y" I
am able to read _mouse_packet structs correctly, but apparently the devctl
interface is broken. Is this a standard interface, or is it device
specific? Since the API for this interaction is available, I don't
understand why it won't work.

thanks
Charlie

Alex Chapiro

Re: Getting pointer information...

Post by Alex Chapiro » Tue Mar 05, 2002 2:38 pm

Unfortunatelly, _POINTERGETINFO in current version is supported only in
Photon mode (_Ph_SERV_POINTER request - see include/photon/PhMsg.h). That is
why you cannot get any replay from devctl function. The request from the
Photon application should look (this is just a rough sample) like the
following snippet:

union {
struct {
io_devctl_t devhdr;
struct _Ph_msg_forward forward;
} send;
struct {
struct _Ph_msg_hdr_reply hdr;
int result;
} reply;
} msg;

struct _pointer_info info;

iov_t smx[2], rmx[2];

msg.send.devhdr.i.type = _IO_DEVCTL;
msg.send.devhdr.i.combine_len = 0;
msg.send.devhdr.i.dcmd = _Ph_SERV_POINTER;
msg.send.devhdr.i.nbytes = sizeof(msg.send.forward)
+ IOCPARM_LEN(_POINTERGETCTRL);
msg.send.devhdr.i.zero = 0;

msg.send.forward.hdr.type = _Ph_SERV_POINTER;
msg.send.forward.hdr.subtype = (short)_POINTERGETINFO;
msg.send.forward.pid = pid; /* region.owner;
*/
msg.send.forward.len =
IOCPARM_LEN(_POINTERGETINFO);

SETIOV(&smx[0], &msg.send, sizeof(msg.send));
SETIOV(&smx[1], &info, IOCPARM_LEN(_POINTERGETINFO));
SETIOV(&rmx[0], &msg.reply, sizeof(msg.reply));
SETIOV(&rmx[1], &info, IOCPARM_LEN(_POINTERGETINFO));

if (MsgSendv( _Ph_->fd, smx, 2, rmx, 2) < 0)
.....



<Charlie_Surface@oti.com> wrote in message news:a609h4$km3$1@inn.qnx.com...
Thanks, but I guess I wasn't clear enough in my original post. I am
unable to get anything back from the device I am working with. I am using
/dev/devi/mouse0 on an x86 box running version 6.1. I use the following
command to start the input drivers when I am not in Photon mode:
"/usr/photon/bin/devi-hirun -Pr kbd fd -d /dev/kbd ps2 mousedev rel -y" I
am able to read _mouse_packet structs correctly, but apparently the devctl
interface is broken. Is this a standard interface, or is it device
specific? Since the API for this interaction is available, I don't
understand why it won't work.

thanks
Charlie

Charlie Surface

Re: Getting pointer information...

Post by Charlie Surface » Tue Mar 05, 2002 3:54 pm

Ok, that it explains it. Thanks Alex.

Charlie


"Alex Chapiro" <achapiro@qnx.com> wrote in message
news:a62keu$bl9$1@inn.qnx.com...
Unfortunatelly, _POINTERGETINFO in current version is supported only in
Photon mode (_Ph_SERV_POINTER request - see include/photon/PhMsg.h). That
is
why you cannot get any replay from devctl function. The request from the
Photon application should look (this is just a rough sample) like the
following snippet:

union {
struct {
io_devctl_t devhdr;
struct _Ph_msg_forward forward;
} send;
struct {
struct _Ph_msg_hdr_reply hdr;
int result;
} reply;
} msg;

struct _pointer_info info;

iov_t smx[2], rmx[2];

msg.send.devhdr.i.type = _IO_DEVCTL;
msg.send.devhdr.i.combine_len = 0;
msg.send.devhdr.i.dcmd = _Ph_SERV_POINTER;
msg.send.devhdr.i.nbytes =
sizeof(msg.send.forward)
+ IOCPARM_LEN(_POINTERGETCTRL);
msg.send.devhdr.i.zero = 0;

msg.send.forward.hdr.type = _Ph_SERV_POINTER;
msg.send.forward.hdr.subtype = (short)_POINTERGETINFO;
msg.send.forward.pid = pid; /*
region.owner;
*/
msg.send.forward.len =
IOCPARM_LEN(_POINTERGETINFO);

SETIOV(&smx[0], &msg.send, sizeof(msg.send));
SETIOV(&smx[1], &info, IOCPARM_LEN(_POINTERGETINFO));
SETIOV(&rmx[0], &msg.reply, sizeof(msg.reply));
SETIOV(&rmx[1], &info, IOCPARM_LEN(_POINTERGETINFO));

if (MsgSendv( _Ph_->fd, smx, 2, rmx, 2) < 0)
.....



Charlie_Surface@oti.com> wrote in message
news:a609h4$km3$1@inn.qnx.com...
Thanks, but I guess I wasn't clear enough in my original post. I am
unable to get anything back from the device I am working with. I am
using
/dev/devi/mouse0 on an x86 box running version 6.1. I use the following
command to start the input drivers when I am not in Photon mode:
"/usr/photon/bin/devi-hirun -Pr kbd fd -d /dev/kbd ps2 mousedev rel -y"
I
am able to read _mouse_packet structs correctly, but apparently the
devctl
interface is broken. Is this a standard interface, or is it device
specific? Since the API for this interaction is available, I don't
understand why it won't work.

thanks
Charlie



Post Reply

Return to “qdn.public.ddk.input”