X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=examples%2Fport_info.c;h=8bf6022046a40c35cd4115ee2074faf2bb22ddcc;hb=fd20b0fc5a34cd7f776e4af6c763f59041de223b;hp=2c3fda64648182268d41a34813ab13b4179a4305;hpb=8c1a14e65805727ec63f4c908eb0f253a04a738b;p=libserialport.git diff --git a/examples/port_info.c b/examples/port_info.c index 2c3fda6..8bf6022 100644 --- a/examples/port_info.c +++ b/examples/port_info.c @@ -1,7 +1,9 @@ #include #include -/* Example of how to get information about a serial port. */ +/* Example of how to get information about a serial port. + * + * This example file is released to the public domain. */ int main(int argc, char **argv) { @@ -22,8 +24,7 @@ int main(int argc, char **argv) * pointer will be updated to refer to the port found. */ enum sp_return result = sp_get_port_by_name(port_name, &port); - if (result != SP_OK) - { + if (result != SP_OK) { printf("sp_get_port_by_name() failed!\n"); return -1; } @@ -36,14 +37,11 @@ int main(int argc, char **argv) * e.g. native port, USB or Bluetooth. */ enum sp_transport transport = sp_get_port_transport(port); - if (transport == SP_TRANSPORT_NATIVE) - { + if (transport == SP_TRANSPORT_NATIVE) { /* This is a "native" port, usually directly connected * to the system rather than some external interface. */ printf("Type: Native\n"); - } - else if (transport == SP_TRANSPORT_USB) - { + } else if (transport == SP_TRANSPORT_USB) { /* This is a USB to serial converter of some kind. */ printf("Type: USB\n"); @@ -61,9 +59,7 @@ int main(int argc, char **argv) int usb_bus, usb_address; sp_get_port_usb_bus_address(port, &usb_bus, &usb_address); printf("Bus: %d Address: %d\n", usb_bus, usb_address); - } - else if (transport == SP_TRANSPORT_BLUETOOTH) - { + } else if (transport == SP_TRANSPORT_BLUETOOTH) { /* This is a Bluetooth serial port. */ printf("Type: Bluetooth\n");