-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add /dev/input/eventN number to event struct #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all this can't possibly be merged due to breaking changes in the protocol. But I don't get what it tries to achieve on a deeper level. Just adding an id to the device and the events, doesn't do anything if spacenavd is only able to use a single device to begin with.
Multi-device support requires pretty much a rewrite of much of spacenavd, and a new more extensive protocol for communication with the clients.
struct { | ||
int type; | ||
int dev; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nameless structs are not valid C89. Also why make a struct here instead of just adding a dev field in the existing struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to be consistent with the spnav_event
union such that both type
and dev
become accessible without using a nested struct.
float motion_mul; | ||
|
||
if(lsock == -1) return; | ||
|
||
switch(ev->type) { | ||
case EVENT_MOTION: | ||
data[0] = UEV_TYPE_MOTION; | ||
data[1] = ev->dev; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't do this. Shuffling the data fields, and increasing the length of the data, breaks the protocol.
@@ -44,6 +56,7 @@ int init_devices(void) | |||
if(!dev_path_in_use(cfg.serial_dev)) { | |||
dev = add_device(); | |||
strcpy(dev->path, cfg.serial_dev); | |||
dev->evt_num = device_evt_num(cfg.serial_dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A serial device will certainly not have a /dev/input/eventN number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there be another identifier, such as /dev/ttyX
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, typically it would be something like /dev/ttySX
or /dev/ttyUSBX
.
@jtsiomb I totally understand that you cannot suddenly break the protocol. Thanks for taking a look anyway.
When connecting multiple devices, |
Nice, I must have added that feature at some point, and forgot about it. So I as long as I include a device identifier in the events of the new protocol, it'll be easy to support multiple devices. I thought I needed to restructure the code to handle input from multiple physical devices, but I guess I've done that already... Edit: Ah that's why I don't remember doing this. I didn't write that code, it was implemented in a patch someone else sent me. |
That's great. It works flawlessly in my situation. Hope you find some time soon to work on a slightly revised protocol, if I can help you out, let me know. |
Fixes #13
Corresponds to
libspnav
PR FreeSpacenav/libspnav#5