Navigation Menu

Skip to content

Commit

Permalink
Add one more VID:PID for FCUSB
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Nov 23, 2021
1 parent 9b0eab9 commit 061fbdc
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions drivers/focuser/fcusb.cpp
Expand Up @@ -27,6 +27,12 @@
#define FOCUS_SETTINGS_TAB "Settings"

static std::unique_ptr<FCUSB> fcusb(new FCUSB());
static const std::map<uint32_t, uint32_t> USBIDs =
{
{0x134A, 0x9023},
{0x134A, 0x9024},
{0x134A, 0x903F},
};

FCUSB::FCUSB()
{
Expand All @@ -44,18 +50,19 @@ bool FCUSB::Connect()
return true;
}

handle = hid_open(0x134A, 0x9023, nullptr);
// Iterate until the correct VID:PID is found.
for (const auto &oneID : USBIDs)
{
if ( (handle = hid_open(oneID.first, oneID.second, nullptr)) != nullptr)
break;
}

if (handle == nullptr)
{
handle = hid_open(0x134A, 0x9024, nullptr);

if (handle == nullptr)
{
LOG_ERROR("No FCUSB focuser found.");
return false;
}
LOG_ERROR("No FCUSB focuser found.");
return false;
}

else
{
SetTimer(getCurrentPollingPeriod());
Expand Down Expand Up @@ -91,7 +98,8 @@ bool FCUSB::initProperties()
IUFillSwitch(&PWMScalerS[0], "PWM_1_1", "1:1", ISS_ON);
IUFillSwitch(&PWMScalerS[1], "PWM_1_4", "1:4", ISS_OFF);
IUFillSwitch(&PWMScalerS[2], "PWM_1_16", "1:16", ISS_OFF);
IUFillSwitchVector(&PWMScalerSP, PWMScalerS, 3, getDeviceName(), "PWM_SCALER", "PWM Scale", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE);
IUFillSwitchVector(&PWMScalerSP, PWMScalerS, 3, getDeviceName(), "PWM_SCALER", "PWM Scale", OPTIONS_TAB, IP_RW, ISR_1OFMANY,
0, IPS_IDLE);

addSimulationControl();

Expand Down

0 comments on commit 061fbdc

Please sign in to comment.