fix inconsistent indentation and tabbing

parent 54a5d97d
......@@ -48,39 +48,38 @@ int oau_att_open(char *serial)
struct oau_context *ctx = &oau_contexts[ oau_current_handle ];
int fd = oau_current_handle;
oau_current_handle++;
if ((ctx->ftdi = ftdi_new()) == 0) {
return -ENOMEM;
return -ENOMEM;
}
if (serial) {
if (serial) {
ret = ftdi_usb_open_desc(ctx->ftdi,
OAU_VENDOR_ID, OAU_DEVICE_ID, NULL, serial);
if (ret < 0) {
ftdi_free(ctx->ftdi);
return ret;
ftdi_free(ctx->ftdi);
return ret;
}
} else { /* open first, and maybe only, device at hand */
ret = ftdi_usb_open(ctx->ftdi, OAU_VENDOR_ID, OAU_DEVICE_ID);
if (ret < 0) {
ftdi_free(ctx->ftdi);
return ret;
ftdi_free(ctx->ftdi);
return ret;
}
}
if( (ret = ftdi_set_bitmode(ctx->ftdi, 0xff, BITMODE_BITBANG)) < 0 ) {
if( (ret = ftdi_set_bitmode(ctx->ftdi, 0xff, BITMODE_BITBANG)) < 0 ) {
ftdi_usb_close( ctx->ftdi );
ftdi_free(ctx->ftdi);
return ret;
}
return ret;
}
uint8_t pins;
if( (ret = ftdi_read_pins(ctx->ftdi, &pins) ) < 0 )
{
if( (ret = ftdi_read_pins(ctx->ftdi, &pins) ) < 0 ) {
ftdi_usb_close( ctx->ftdi );
ftdi_free(ctx->ftdi);
return ret;
return ret;
}
ctx->relay_state = pins;
......
......@@ -46,7 +46,8 @@ class OauTest(cmd.Cmd):
self.fd = fd
self.nchannels = self.read_nchannels()
print('current device: serial {}, fd {}, {} channels'.format(
serial, fd, self.nchannels))
str(serial, 'utf8') if serial else '??',
fd, self.nchannels))
def do_close(self, arg):
"""close connection to current device."""
......@@ -112,7 +113,7 @@ class OauTest(cmd.Cmd):
print('no active connection')
return
for ch in range(1, self.nchannels+1):
err = self.api.oau_att_set_relay(self.fd, ch, attn_values['-40dB'])
err = self.api.oau_att_set_relay(self.fd, ch, self.attn_values['-40dB'])
if err < 0:
print('error resetting attenuation in channel {}'.format(ch))
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment