Format of /dev/input/js0

Questions and answers about 3Dconnexion devices on UNIX and Linux.

Moderator: Moderators

Post Reply
Posts: 1
Joined: Fri Jan 05, 2018 11:10 am

Format of /dev/input/js0

Post by jakewwilliams » Fri Jan 05, 2018 11:23 am

I've got a quick question about the format of data being sent to /dev/input/js0 by the spacemouse. After some playing around I can get values and type (button vs axes, up, down..) however I cannot get the number or which axes or which button. For reference I am basing my code of off code found here which works great for reading the data of off my ps3 controller. It reads the data sent into a class with

unsigned int time;
short value;
unsigned char type;
unsigned char number;

For the spacemouse the value and type seem to work but number is always empty.

When I use the more generic /dev/input/eventX format of
timeval time;
unsigned short type;
unsigned short code;
int value;
everything seems to work.

If anyone can point me in the direction of where I am going wrong about the format for /dev/input/js0 I would be very appreciative.

Posts: 2836
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Re: Format of /dev/input/js0

Post by jwick » Mon Jan 08, 2018 9:04 am

I don't have experience with js0. It may very well be trying to mangle the data into an expected joystick packet. This may have some assumptions that are not going to work well. Since you are a GitHub user, this post refers to another GitHub project that parses the data directly from the device so you can see the raw data.

Post Reply