kopia lustrzana https://github.com/FreeSpacenav/libspnav
device type enumeration and queries
rodzic
6c7621ed42
commit
9e6fa203ac
34
proto.h
34
proto.h
|
@ -28,8 +28,10 @@ enum {
|
||||||
REQ_DEV_NAME = 0x2000, /* get device name: R[0] length R[6] status followed
|
REQ_DEV_NAME = 0x2000, /* get device name: R[0] length R[6] status followed
|
||||||
by <length> bytes */
|
by <length> bytes */
|
||||||
REQ_DEV_PATH, /* get device path: same as above */
|
REQ_DEV_PATH, /* get device path: same as above */
|
||||||
REQ_DEV_NAXES, /* get number of axes: R[0] num axes R[6] status */
|
REQ_DEV_NAXES, /* get number of axes: R[0] num axes R[6] status */
|
||||||
REQ_DEV_NBUTTONS, /* get number of buttons: same as above */
|
REQ_DEV_NBUTTONS, /* get number of buttons: same as above */
|
||||||
|
REQ_DEV_USBID, /* get USB id: R[0] vend R[1] prod R[6] status */
|
||||||
|
REQ_DEV_TYPE, /* get device type: R[0] type enum R[6] status */
|
||||||
/* TODO: features like LCD, LEDs ... */
|
/* TODO: features like LCD, LEDs ... */
|
||||||
|
|
||||||
/* configuration settings */
|
/* configuration settings */
|
||||||
|
@ -62,4 +64,34 @@ enum {
|
||||||
REQ_CHANGE_PROTO = 0x5500
|
REQ_CHANGE_PROTO = 0x5500
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* XXX keep in sync with SPNAV_DEV_* in spnav.h (libspnav) */
|
||||||
|
enum {
|
||||||
|
DEV_UNKNOWN,
|
||||||
|
/* serial devices */
|
||||||
|
DEV_SB2003 = 0x100, /* Spaceball 1003/2003/2003C */
|
||||||
|
DEV_SB3003, /* Spaceball 3003/3003C */
|
||||||
|
DEV_SB4000, /* Spaceball 4000FLX/5000FLX */
|
||||||
|
DEV_SM, /* Magellan SpaceMouse */
|
||||||
|
DEV_SM5000, /* Spaceball 5000 (spacemouse protocol) */
|
||||||
|
DEV_SMCADMAN, /* 3Dconnexion CadMan (spacemouse protocol) */
|
||||||
|
/* USB devices */
|
||||||
|
DEV_PLUSXT = 0x200, /* SpaceMouse Plus XT */
|
||||||
|
DEV_CADMAN, /* 3Dconnexion CadMan (USB version) */
|
||||||
|
DEV_SMCLASSIC, /* SpaceMouse Classic */
|
||||||
|
DEV_SB5000, /* Spaceball 5000 (USB version) */
|
||||||
|
DEV_STRAVEL, /* Space Traveller */
|
||||||
|
DEV_SPILOT, /* Space Pilot */
|
||||||
|
DEV_SNAV, /* Space Navigator */
|
||||||
|
DEV_SEXP, /* Space Explorer */
|
||||||
|
DEV_SNAVNB, /* Space Navigator for Notebooks */
|
||||||
|
DEV_SPILOTPRO, /* Space Pilot pro */
|
||||||
|
DEV_SMPRO, /* SpaceMouse Pro */
|
||||||
|
DEV_NULOOQ, /* Nulooq */
|
||||||
|
DEV_SMW, /* SpaceMouse Wireless */
|
||||||
|
DEV_SMPROW, /* SpaceMouse Pro Wireless */
|
||||||
|
DEV_SMENT, /* SpaceMouse Enterprise */
|
||||||
|
DEV_SMCOMP, /* SpaceMouse Compact */
|
||||||
|
DEV_SMMOD /* SpaceMouse Module */
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* PROTO_H_ */
|
#endif /* PROTO_H_ */
|
||||||
|
|
18
spnav.c
18
spnav.c
|
@ -769,7 +769,25 @@ int spnav_dev_axes(void)
|
||||||
return rr.data[0];
|
return rr.data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int spnav_dev_usbid(unsigned int *vend, unsigned int *prod)
|
||||||
|
{
|
||||||
|
struct reqresp rr = {0};
|
||||||
|
if(request(REQ_DEV_USBID, &rr, TIMEOUT) == -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(vend) *vend = rr.data[0];
|
||||||
|
if(prod) *prod = rr.data[1];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int spnav_dev_type(void)
|
||||||
|
{
|
||||||
|
struct reqresp rr = {0};
|
||||||
|
if(request(REQ_DEV_TYPE, &rr, TIMEOUT) == -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return rr.data[0];
|
||||||
|
}
|
||||||
|
|
||||||
int spnav_cfg_set_sens(float s)
|
int spnav_cfg_set_sens(float s)
|
||||||
{
|
{
|
||||||
|
|
37
spnav.h
37
spnav.h
|
@ -168,6 +168,43 @@ int spnav_dev_buttons(void);
|
||||||
/* returns the number of axes (defaults to 6 if unable to query) */
|
/* returns the number of axes (defaults to 6 if unable to query) */
|
||||||
int spnav_dev_axes(void);
|
int spnav_dev_axes(void);
|
||||||
|
|
||||||
|
/* Writes the USB vendor:device ID through the vend/prod pointers.
|
||||||
|
* Returns 0 for success, or -1 on failure (for instance if there is no open
|
||||||
|
* device, or if it's not a USB device).
|
||||||
|
*/
|
||||||
|
int spnav_dev_usbid(unsigned int *vend, unsigned int *prod);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SPNAV_DEV_UNKNOWN,
|
||||||
|
/* serial devices */
|
||||||
|
SPNAV_DEV_SB2003 = 0x100, /* Spaceball 1003/2003/2003C */
|
||||||
|
SPNAV_DEV_SB3003, /* Spaceball 3003/3003C */
|
||||||
|
SPNAV_DEV_SB4000, /* Spaceball 4000FLX/5000FLX */
|
||||||
|
SPNAV_DEV_SM, /* Magellan SpaceMouse */
|
||||||
|
SPNAV_DEV_SM5000, /* Spaceball 5000 (spacemouse protocol) */
|
||||||
|
SPNAV_DEV_SMCADMAN, /* 3Dconnexion CadMan (spacemouse protocol) */
|
||||||
|
/* USB devices */
|
||||||
|
SPNAV_DEV_PLUSXT = 0x200, /* SpaceMouse Plus XT */
|
||||||
|
SPNAV_DEV_CADMAN, /* 3Dconnexion CadMan (USB version) */
|
||||||
|
SPNAV_DEV_SMCLASSIC, /* SpaceMouse Classic */
|
||||||
|
SPNAV_DEV_SB5000, /* Spaceball 5000 (USB version) */
|
||||||
|
SPNAV_DEV_STRAVEL, /* Space Traveller */
|
||||||
|
SPNAV_DEV_SPILOT, /* Space Pilot */
|
||||||
|
SPNAV_DEV_SNAV, /* Space Navigator */
|
||||||
|
SPNAV_DEV_SEXP, /* Space Explorer */
|
||||||
|
SPNAV_DEV_SNAVNB, /* Space Navigator for Notebooks */
|
||||||
|
SPNAV_DEV_SPILOTPRO, /* Space Pilot pro */
|
||||||
|
SPNAV_DEV_SMPRO, /* SpaceMouse Pro */
|
||||||
|
SPNAV_DEV_NULOOQ, /* NuLOOQ */
|
||||||
|
SPNAV_DEV_SMW, /* SpaceMouse Wireless */
|
||||||
|
SPNAV_DEV_SMPROW, /* SpaceMouse Pro Wireless */
|
||||||
|
SPNAV_DEV_SMENT, /* SpaceMouse Enterprise */
|
||||||
|
SPNAV_DEV_SMCOMP, /* SpaceMouse Compact */
|
||||||
|
SPNAV_DEV_SMMOD /* SpaceMouse Module */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Returns the device type (see enumeration above) or -1 on failure */
|
||||||
|
int spnav_dev_type(void);
|
||||||
|
|
||||||
/* configuration API
|
/* configuration API
|
||||||
* -----------------
|
* -----------------
|
||||||
|
|
Ładowanie…
Reference in New Issue