mirror of https://github.com/nirenjan/libx52.git
commit
1b9c52ea07
|
@ -333,12 +333,13 @@ static void do_help(const struct command_handler *cmd)
|
||||||
|
|
||||||
printf("\nWARNING: raw command may damage your device\n\n");
|
printf("\nWARNING: raw command may damage your device\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
libx52_device *x52;
|
libx52_device *x52;
|
||||||
int command;
|
|
||||||
struct string_map result;
|
struct string_map result;
|
||||||
const struct command_handler *cmd;
|
const struct command_handler *cmd;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
int libx52_vendor_command(libx52_device *x52, uint16_t index, uint16_t value)
|
int libx52_vendor_command(libx52_device *x52, uint16_t index, uint16_t value)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
int rc;
|
int rc = 0;
|
||||||
|
|
||||||
/* Allow retry in case of failure */
|
/* Allow retry in case of failure */
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
|
@ -110,7 +110,7 @@ static int libx52_write_date(libx52_device *x52)
|
||||||
|
|
||||||
static int libx52_write_time(libx52_device *x52, libx52_clock_id clock)
|
static int libx52_write_time(libx52_device *x52, libx52_clock_id clock)
|
||||||
{
|
{
|
||||||
uint16_t value;
|
uint16_t value = 0;
|
||||||
uint16_t index;
|
uint16_t index;
|
||||||
int offset;
|
int offset;
|
||||||
int negative;
|
int negative;
|
||||||
|
@ -168,7 +168,7 @@ int libx52_update(libx52_device *x52)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint32_t update_mask;
|
uint32_t update_mask;
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
int rc;
|
int rc = 0;
|
||||||
|
|
||||||
/* Save the update mask */
|
/* Save the update mask */
|
||||||
update_mask = x52->update_mask;
|
update_mask = x52->update_mask;
|
||||||
|
|
|
@ -55,7 +55,11 @@ libx52_device* libx52_init(void)
|
||||||
|
|
||||||
rc = libusb_init(&(x52_dev->ctx));
|
rc = libusb_init(&(x52_dev->ctx));
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
#if defined(__linux__)
|
||||||
errno = ELIBACC;
|
errno = ELIBACC;
|
||||||
|
#else
|
||||||
|
errno = ENOENT;
|
||||||
|
#endif
|
||||||
goto err_recovery;
|
goto err_recovery;
|
||||||
}
|
}
|
||||||
libusb_set_debug(x52_dev->ctx, 3);
|
libusb_set_debug(x52_dev->ctx, 3);
|
||||||
|
|
|
@ -39,7 +39,7 @@ int libx52_set_clock(libx52_device *x52, time_t time, int local)
|
||||||
/* timezone from time.h presents the offset in seconds west of GMT.
|
/* timezone from time.h presents the offset in seconds west of GMT.
|
||||||
* Negate and divide by 60 to get the offset in minutes east of GMT.
|
* Negate and divide by 60 to get the offset in minutes east of GMT.
|
||||||
*/
|
*/
|
||||||
local_tz = -timezone / 60;
|
local_tz = (int)(-timezone / 60);
|
||||||
} else {
|
} else {
|
||||||
timeval = *gmtime(&time);
|
timeval = *gmtime(&time);
|
||||||
/* No offset from GMT */
|
/* No offset from GMT */
|
||||||
|
|
|
@ -78,8 +78,6 @@ int test_mfd_text(void)
|
||||||
int test_mfd_display(void)
|
int test_mfd_display(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
|
||||||
int rc;
|
|
||||||
char str[16];
|
char str[16];
|
||||||
|
|
||||||
print_banner("MFD display");
|
print_banner("MFD display");
|
||||||
|
|
Loading…
Reference in New Issue