]> sigrok.org Git - libsigrok.git/commitdiff
hardware/common: Coding style fixes.
authorUwe Hermann <redacted>
Thu, 15 Apr 2010 18:55:57 +0000 (20:55 +0200)
committerUwe Hermann <redacted>
Thu, 15 Apr 2010 18:55:57 +0000 (20:55 +0200)
hardware/common/ezusb.c
hardware/common/serial.c
hardware/common/skeleton.c

index 68692c3a29fbbabb6f1f87d3fca590d86b0079ba..884ceafdccf9fa693a401aecd0ffa1a170d963e6 100644 (file)
@@ -56,15 +56,14 @@ int ezusb_install_firmware(libusb_device_handle *hdl, const char *filename)
                return 1;
        }
 
-       result = 0;
-       offset = 0;
+       result = offset = 0;
        while (1) {
                chunksize = fread(buf, 1, 4096, fw);
                if (chunksize == 0)
                        break;
                err = libusb_control_transfer(hdl, LIBUSB_REQUEST_TYPE_VENDOR |
-                               LIBUSB_ENDPOINT_OUT, 0xa0, offset, 0x0000,
-                               buf, chunksize, 100);
+                                             LIBUSB_ENDPOINT_OUT, 0xa0, offset,
+                                             0x0000, buf, chunksize, 100);
                if (err < 0) {
                        g_warning("Unable to send firmware to device: %d", err);
                        result = 1;
index dfc6d5578c87b03c998a4b688dd50f99e0025da6..50a884e95c39cc0750c5cbf4d13b0b37ec608579 100644 (file)
 #include <termios.h>
 #include <stdlib.h>
 #include <glib.h>
-
-#include "sigrok.h"
-
-
+#include <sigrok.h>
 
 char *serial_port_glob[] = {
        /* Linux */
@@ -40,10 +37,9 @@ char *serial_port_glob[] = {
        "/dev/ttys*",
        "/dev/tty.USB-*",
        "/dev/tty.Modem-*",
-       NULL
+       NULL,
 };
 
-
 GSList *list_serial_ports(void)
 {
        glob_t g;
@@ -51,12 +47,11 @@ GSList *list_serial_ports(void)
        unsigned int i, j;
 
        ports = NULL;
-       for(i = 0; serial_port_glob[i]; i++)
-       {
-               if(!glob(serial_port_glob[i], 0, NULL, &g))
-               {
-                       for(j = 0; j < g.gl_pathc; j++)
-                               ports = g_slist_append(ports, strdup(g.gl_pathv[j]));
+       for (i = 0; serial_port_glob[i]; i++) {
+               if (!glob(serial_port_glob[i], 0, NULL, &g)) {
+                       for (j = 0; j < g.gl_pathc; j++)
+                               ports = g_slist_append(ports,
+                                                      strdup(g.gl_pathv[j]));
                        globfree(&g);
                }
        }
@@ -64,21 +59,16 @@ GSList *list_serial_ports(void)
        return ports;
 }
 
-
 int serial_open(const char *pathname, int flags)
 {
-
        return open(pathname, flags);
 }
 
-
 int serial_close(int fd)
 {
-
        return close(fd);
 }
 
-
 void *serial_backup_params(int fd)
 {
        struct termios *term;
@@ -89,37 +79,33 @@ void *serial_backup_params(int fd)
        return term;
 }
 
-
 void serial_restore_params(int fd, void *backup)
 {
-
-       tcsetattr(fd, TCSADRAIN, (struct termios *) backup);
-
+       tcsetattr(fd, TCSADRAIN, (struct termios *)backup);
 }
 
-
 /* flowcontrol 1 = rts/cts  2 = xon/xoff */
-int serial_set_params(int fd, int speed, int bits, int parity, int stopbits, int flowcontrol)
+int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
+                     int flowcontrol)
 {
        struct termios term;
 
-       /* only supporting what we need really -- currently just the OLS driver */
-       if(speed != 115200 || bits != 8 || parity != 0 || stopbits != 1 || flowcontrol != 2)
+       /* Only supporting what we need really, currently the OLS driver. */
+       if (speed != 115200 || bits != 8 || parity != 0 || stopbits != 1
+           || flowcontrol != 2)
                return SIGROK_ERR;
 
-       if(tcgetattr(fd, &term) < 0)
+       if (tcgetattr(fd, &term) < 0)
                return SIGROK_ERR;
-       if(cfsetispeed(&term, B115200) < 0)
+       if (cfsetispeed(&term, B115200) < 0)
                return SIGROK_ERR;
        term.c_cflag &= ~CSIZE;
        term.c_cflag |= CS8;
        term.c_cflag &= ~CSTOPB;
        term.c_cflag |= IXON | IXOFF;
        term.c_iflag |= IGNPAR;
-       if(tcsetattr(fd, TCSADRAIN, &term) < 0)
+       if (tcsetattr(fd, TCSADRAIN, &term) < 0)
                return SIGROK_ERR;
 
        return SIGROK_OK;
 }
-
-
index bb8381408109b582b8caa7422b33967cb61d9d2c..d6cbd24c53c714da051bfaabccc1d1e50c4a29a1 100644 (file)
 
 static int hw_init(char *deviceinfo)
 {
-
 }
 
-
 static int hw_opendev(int device_index)
 {
-
 }
 
-
 static void hw_closedev(int device_index)
 {
-
 }
 
-
 static void hw_cleanup(void)
 {
-
 }
 
-
 static char *hw_get_identifier(int device_index)
 {
-
 }
 
-
 static char *hw_get_device_info(int device_index, int device_info_id)
 {
-
 }
 
-
 static int hw_get_status(int device_index)
 {
-
 }
 
-
 static int *hw_get_capabilities(void)
 {
-
 }
 
-
 static int hw_set_configuration(int device_index, int capability, char *value)
 {
-
 }
 
-
 static int hw_start_acquisition(int device_index, gpointer session_device_id)
 {
-
 }
 
-
 static void hw_stop_acquisition(int device_index, gpointer session_device_id)
 {
-
 }
 
-
-
 struct device_plugin skeleton_plugin_info = {
        "skeleton",
        1,
        hw_init,
        hw_cleanup,
-
        hw_opendev,
        hw_closedev,
        hw_get_device_info,
@@ -99,6 +75,5 @@ struct device_plugin skeleton_plugin_info = {
        hw_get_capabilities,
        hw_set_configuration,
        hw_start_acquisition,
-       hw_stop_acquisition
+       hw_stop_acquisition,
 };
-