Tue, 26 Aug 2008 18:45:10 +0100
lpfk_open now calls lpfk_enable.
also made LPFK_CTX the first parameter in all functions (for consistency)
include/liblpfk.h | file | annotate | diff | revisions | |
src/liblpfk.c | file | annotate | diff | revisions |
1.1 --- a/include/liblpfk.h Tue Aug 26 13:18:18 2008 +0100 1.2 +++ b/include/liblpfk.h Tue Aug 26 18:45:10 2008 +0100 1.3 @@ -70,7 +70,7 @@ 1.4 LPFK_E_NOT_PRESENT, ///< LPFK not present on specified port. 1.5 LPFK_E_COMMS, ///< Communication error. 1.6 LPFK_E_PARAM, ///< Invalid function parameter. 1.7 - LPFK_E_NOT_ENABLED ///< Attempt to read key when LPFK disabled 1.8 +LPFK_E_NOT_ENABLED ///< Attempt to read key when LPFK disabled 1.9 }; 1.10 1.11 /** 1.12 @@ -82,7 +82,7 @@ 1.13 * @return LPFK_E_OK on success, LPFK_E_PORT_OPEN if port could not be 1.14 * opened, LPFK_E_NOT_PRESENT if no LPFK present on specified port. 1.15 */ 1.16 -int lpfk_open(const char *port, LPFK_CTX *ctx); 1.17 +int lpfk_open(LPFK_CTX *ctx, const char *port); 1.18 1.19 /** 1.20 * @brief Close the LPFK. 1.21 @@ -97,7 +97,7 @@ 1.22 * @param val true to enable the LPFK's keys, false to disable. 1.23 * @return LPFK_E_OK on success, LPFK_E_COMMS on comms error. 1.24 */ 1.25 -int lpfk_enable(LPFK_CTX *ctx, int val); 1.26 +int lpfk_enable(LPFK_CTX *ctx, const int val); 1.27 1.28 /** 1.29 * @brief Set or clear an LED in the cached LED mask buffer.
2.1 --- a/src/liblpfk.c Tue Aug 26 13:18:18 2008 +0100 2.2 +++ b/src/liblpfk.c Tue Aug 26 18:45:10 2008 +0100 2.3 @@ -57,7 +57,7 @@ 2.4 #include "liblpfk.h" 2.5 2.6 /* lpfk_open {{{ */ 2.7 -int lpfk_open(const char *port, LPFK_CTX *ctx) 2.8 +int lpfk_open(LPFK_CTX *ctx, const char *port) 2.9 { 2.10 struct termios newtio; 2.11 int status; 2.12 @@ -148,9 +148,8 @@ 2.13 ctx->led_mask = 0; 2.14 ctx->fd = fd; 2.15 2.16 - // Enable the LPFK 2.17 - write(fd, "\x08", 1); 2.18 - ctx->enabled = true; 2.19 + // Disable LPFK keyboard scanning 2.20 + lpfk_enable(ctx, false); 2.21 2.22 // Return OK status 2.23 return LPFK_E_OK;