kopia lustrzana https://github.com/FreeSpacenav/libspnav
implemented spnav_cfg_set_serial/spnav_cfg_get_serial
rodzic
0ce9d83361
commit
75679b07f4
25
spnav.c
25
spnav.c
|
@ -1060,3 +1060,28 @@ int spnav_cfg_get_grab(void)
|
||||||
}
|
}
|
||||||
return rr.data[0];
|
return rr.data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int spnav_cfg_set_serial(const char *devpath)
|
||||||
|
{
|
||||||
|
struct reqresp rr = {0};
|
||||||
|
int i, len = strlen(devpath);
|
||||||
|
|
||||||
|
while(len > 0) {
|
||||||
|
rr.data[0] = len;
|
||||||
|
for(i=0; i<6; i++) {
|
||||||
|
rr.data[i + 1] = *devpath ? *devpath++ : 0;
|
||||||
|
}
|
||||||
|
len -= 6;
|
||||||
|
|
||||||
|
if(request(REQ_SCFG_SERDEV, &rr, TIMEOUT) == -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *spnav_cfg_get_serial(char *buf, int bufsz)
|
||||||
|
{
|
||||||
|
return query_str(buf, bufsz, REQ_GCFG_SERDEV);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
3
spnav.h
3
spnav.h
|
@ -324,6 +324,9 @@ int spnav_cfg_get_led(void); /* returns led setting, -1 on error */
|
||||||
int spnav_cfg_set_grab(int state);
|
int spnav_cfg_set_grab(int state);
|
||||||
int spnav_cfg_get_grab(void); /* returns 0:no-grab/1:grab, or -1 on error */
|
int spnav_cfg_get_grab(void); /* returns 0:no-grab/1:grab, or -1 on error */
|
||||||
|
|
||||||
|
int spnav_cfg_set_serial(const char *devpath);
|
||||||
|
const char *spnav_cfg_get_serial(char *buf, int bufsz);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Ładowanie…
Reference in New Issue