How would I get the raw data from a USB device ? (Transmitter USB adapter driver)
Linuxguy123
linuxguy123 at gmail.com
Fri Jun 26 17:20:16 UTC 2009
Nevermind... this works:
/*
============================================================================
Name : TransmitterAdapter.c
Author :
Version :
Copyright :
Description :
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("Transmitter Adapter Tester version 0.1\n");
// open the joystick file
FILE *joystick;
joystick = fopen("/dev/input/js0", "rb");
if (joystick == NULL)
{
printf("Joystick device file could not be opened.\n");
printf("Exiting.\n");
return(-1);
}// if
// now read a bunch of data and display it
int i;
int val;
for (i=0;i<100;i++)
{
val = fgetc(joystick);
printf("%2X\n", val);
}
exit(0);
while (1)
{
for (i=0; i<8;i++)
{
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X ", val);
val = fgetc(joystick);
printf("%2X \r", val);
}//for
}// while(1)
return EXIT_SUCCESS;
}// End of main()
More information about the users
mailing list