src/ftdipp_mpsse: _bus/_addr: change type to uint8_t, default value to 0 and use cable_t bus_addr/device_addr$
This commit is contained in:
parent
9e5fcdbe0d
commit
68e519e4af
|
|
@ -29,7 +29,8 @@ using namespace std;
|
||||||
FTDIpp_MPSSE::FTDIpp_MPSSE(const cable_t &cable, const string &dev,
|
FTDIpp_MPSSE::FTDIpp_MPSSE(const cable_t &cable, const string &dev,
|
||||||
const std::string &serial, uint32_t clkHZ, int8_t verbose):
|
const std::string &serial, uint32_t clkHZ, int8_t verbose):
|
||||||
_verbose(verbose > 2), _cable(cable.config), _vid(0),
|
_verbose(verbose > 2), _cable(cable.config), _vid(0),
|
||||||
_pid(0), _index(0), _bus(-1), _addr(-1),
|
_pid(0), _index(0),
|
||||||
|
_bus(cable.bus_addr), _addr(cable.device_addr),
|
||||||
_interface(cable.config.interface),
|
_interface(cable.config.interface),
|
||||||
_clkHZ(clkHZ), _buffer_size(2*32768), _num(0)
|
_clkHZ(clkHZ), _buffer_size(2*32768), _num(0)
|
||||||
{
|
{
|
||||||
|
|
@ -138,7 +139,7 @@ void FTDIpp_MPSSE::open_device(const std::string &serial, unsigned int baudrate)
|
||||||
throw std::runtime_error(err);
|
throw std::runtime_error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_bus == -1 || _addr == -1)
|
if (_bus == 0 || _addr == 0)
|
||||||
ret = ftdi_usb_open_desc_index(_ftdi, _vid, _pid, NULL, serial.empty() ? NULL : serial.c_str(), _index);
|
ret = ftdi_usb_open_desc_index(_ftdi, _vid, _pid, NULL, serial.empty() ? NULL : serial.c_str(), _index);
|
||||||
else
|
else
|
||||||
#if (FTDI_VERSION < 104)
|
#if (FTDI_VERSION < 104)
|
||||||
|
|
@ -839,10 +840,10 @@ bool FTDIpp_MPSSE::search_with_dev(const string &device)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_bus = udevstufftoint(udev_device_get_sysattr_value(
|
_bus = static_cast<uint8_t>(udevstufftoint(udev_device_get_sysattr_value(
|
||||||
usbdeviceparent, "busnum"), 10);
|
usbdeviceparent, "busnum"), 10));
|
||||||
_addr = udevstufftoint(udev_device_get_sysattr_value(
|
_addr = static_cast<uint8_t>(udevstufftoint(udev_device_get_sysattr_value(
|
||||||
usbdeviceparent, "devnum"), 10);
|
usbdeviceparent, "devnum"), 10));
|
||||||
sprintf(_product, "%s", udev_device_get_sysattr_value(usbdeviceparent, "product"));
|
sprintf(_product, "%s", udev_device_get_sysattr_value(usbdeviceparent, "product"));
|
||||||
_vid = udevstufftoint(
|
_vid = udevstufftoint(
|
||||||
udev_device_get_sysattr_value(usbdeviceparent, "idVendor"), 16);
|
udev_device_get_sysattr_value(usbdeviceparent, "idVendor"), 16);
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ class FTDIpp_MPSSE {
|
||||||
int _pid;
|
int _pid;
|
||||||
int _index;
|
int _index;
|
||||||
private:
|
private:
|
||||||
int _bus;
|
uint8_t _bus;
|
||||||
int _addr;
|
uint8_t _addr;
|
||||||
char _product[64];
|
char _product[64];
|
||||||
unsigned char _interface;
|
unsigned char _interface;
|
||||||
/* gpio */
|
/* gpio */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue