libx52
0.2.3
Saitek X52/X52Pro drivers for Linux/Unix
|
These functions are used to communicate with the X52 daemon. More...
Functions | |
int | x52d_dial_command (const char *sock_path) |
Open a connection to the daemon. More... | |
int | x52d_send_command (int sock_fd, char *buffer, size_t bufin, size_t bufout) |
Send a command to the daemon and retrieve the response. More... | |
These functions are used to communicate with the X52 daemon.
int x52d_dial_command | ( | const char * | sock_path | ) |
Open a connection to the daemon.
This method opens a socket connection to the daemon command socket. This socket allows the client to issue commands and retrieve data. The sock_path
parameter may be NULL, in which case, it will use the default socket path.
The client will need to use the returned descriptor to communicate with the daemon using x52d_send_command. Once finished, the client may use the close(2)
method to close the file descriptor.
[in] | sock_path | Path to the daemon command socket. |
errno
accordingly.E2BIG | returned if the passed socket path is too big |
int x52d_send_command | ( | int | sock_fd, |
char * | buffer, | ||
size_t | bufin, | ||
size_t | bufout | ||
) |
Send a command to the daemon and retrieve the response.
The client sends the command and parameters as a series of NUL terminated strings, and retrieves the response in the same manner. Depending on the result, the return status is either a positive integer or -1, and errno
is set accordingly.
buffer
should contain sufficient space to accomodate the returned response string.
This is a blocking function and will not return until either a response is received from the server, or an exception condition occurs.
[in] | sock_fd | Socket descriptor returned from x52d_dial_command |
[in,out] | buffer | Pointer to the string containing the command and parameters. This is also used to save the returned response. |
[in] | bufin | Length of the command in the input buffer |
[in] | bufout | Maximum length of the response |
errno
is set accordingly.