home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- #include "DeviceToolKits/Input.h"
- #ifndef TESTPROTO
- #define NO_PRAGMAS 1
- #endif
- #include "DeviceToolKits/proto/Input.h"
- #include "DeviceToolKits/InputBase.h"
-
- DTInput_t Unit0;
- struct timeval period;
- struct timeval threshold;
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int period_s, period_u;
- int threshold_s, threshold_u;
- long status;
-
- if (argc != 5) {
- fprintf(stderr,"Usage: %s period_s period_u thresh_s thresh_u\n",
- argv[0]);
- fflush(stderr);
- exit(1);
- }
-
- period_s = atoi(argv[1]);
- period_u = atoi(argv[2]);
- period.tv_secs = period_s;
- period.tv_micro = period_u;
-
- threshold_s = atoi(argv[3]);
- threshold_u = atoi(argv[4]);
- threshold.tv_secs = threshold_s;
- threshold.tv_micro = threshold_u;
-
- #ifdef TESTSHARED
- /* Open the Input library */
-
- DTInputOpen(DTINPUTREV);
- #endif
-
- /* Try to initialize unit 0 of the Input */
-
- if ((Unit0 = DTInputCreate(&status)) == NULL) {
- fprintf(stderr,"Error initializing unit 0 = %ld.\n",status);
- fflush(stderr);
- goto cleanup;
- }
-
- fprintf(stderr,"Unit0 = %lX\n",(long) Unit0);
- fflush(stderr);
-
- /* Set the keyboard repeat threshold */
-
- if ((status = DTInputSetThresh(Unit0,&threshold)) != 0) {
- fprintf(stderr,"Error setting unit 0 threshold = %ld,%ld.\n",
- status,Unit0->in_error);
- fflush(stderr);
- goto cleanup;
- }
-
- /* Set the keyboard repeat period */
-
- if ((status = DTInputSetPeriod(Unit0,&period)) != 0) {
- fprintf(stderr,"Error setting unit 0 period = %ld,%ld.\n",
- status,Unit0->in_error);
- fflush(stderr);
- goto cleanup;
- }
-
- /* Free the stuff */
-
- cleanup:
- DTInputFree(Unit0);
- #ifdef TESTSHARED
- DTInputClose();
- #endif
- }
-
-