* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
#include "protocol.h"
extern SR_PRIV struct sr_dev_driver p_ols_driver_info;
-static struct sr_dev_driver *di = &p_ols_driver_info;
SR_PRIV int write_shortcommand(struct dev_context *devc, uint8_t command)
{
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
- sdi->driver = di;
+ sdi->driver = &p_ols_driver_info;
sdi->priv = devc;
devname = g_string_new("");
/* what is this for? */
break;
case 0x03:
- /* Maximum sample rate (hz) */
+ /* Maximum sample rate (Hz) */
devc->max_samplerate = tmp_int;
break;
case 0x04:
return SR_OK;
}
-
SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
{
struct dev_context *devc;
}
/* Clear out the most significant bit of the sample */
devc->tmp_sample[devc->num_bytes - 1] &= 0x7f;
- sr_spew("Expanded sample 1: 0x%.8x.", devc->tmp_sample);
+ sr_spew("Expanded sample 1: 0x%.2x%.2x%.2x%.2x.",
+ devc->tmp_sample[3], devc->tmp_sample[2],
+ devc->tmp_sample[1], devc->tmp_sample[0]);
/* expand second sample */
memset(devc->tmp_sample2, 0, 4);
}
/* Clear out the most significant bit of the sample */
devc->tmp_sample2[devc->num_bytes - 1] &= 0x7f;
- sr_spew("Expanded sample 2: 0x%.8x.", devc->tmp_sample2);
+ sr_spew("Expanded sample 2: 0x%.2x%.2x%.2x%.2x.",
+ devc->tmp_sample2[3], devc->tmp_sample2[2],
+ devc->tmp_sample2[1], devc->tmp_sample2[0]);
/*
* OLS sends its sample buffer backwards.
}
return TRUE;
} else {
- do bytes_read = ftdi_read_data(devc->ftdic, devc->ftdi_buf, FTDI_BUF_SIZE);
- while (bytes_read > 0);
+ do {
+ bytes_read = ftdi_read_data(devc->ftdic, devc->ftdi_buf, FTDI_BUF_SIZE);
+ } while (bytes_read > 0);
/*
* We've acquired all the samples we asked for -- we're done.