Skip to content

Commit 5713917

Browse files
committed
Fix bug; the baud rate is now displayed correctly. #102
1 parent feb728e commit 5713917

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/drivers/CANvenient_Ixxat.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,34 @@ int ixxat_set_baudrate(int index, enum can_baudrate baud)
358358
ctx->pChannel = NULL;
359359
}
360360

361+
/* Stop the CAN line before changing baudrate. */
362+
hr = VciGetDeviceManager(&pDevMan);
363+
if (SUCCEEDED(hr) && NULL != pDevMan)
364+
{
365+
hr = pDevMan->lpVtbl->OpenDevice(pDevMan, &ctx->device_id, &pDevice);
366+
if (SUCCEEDED(hr) && NULL != pDevice)
367+
{
368+
hr = pDevice->lpVtbl->OpenComponent(pDevice, &CLSID_VCIBAL, &IID_IBalObject, (PVOID*)&pBal);
369+
if (SUCCEEDED(hr) && NULL != pBal)
370+
{
371+
hr = pBal->lpVtbl->OpenSocket(pBal, ctx->bus_no, &IID_ICanControl, (PVOID*)&pControl);
372+
if (SUCCEEDED(hr) && NULL != pControl)
373+
{
374+
pControl->lpVtbl->StopLine(pControl);
375+
pControl->lpVtbl->ResetLine(pControl);
376+
pControl->lpVtbl->Release(pControl);
377+
pControl = NULL;
378+
}
379+
pBal->lpVtbl->Release(pBal);
380+
pBal = NULL;
381+
}
382+
pDevice->lpVtbl->Release(pDevice);
383+
pDevice = NULL;
384+
}
385+
pDevMan->lpVtbl->Release(pDevMan);
386+
pDevMan = NULL;
387+
}
388+
361389
hr = VciGetDeviceManager(&pDevMan);
362390
if (FAILED(hr) || NULL == pDevMan)
363391
{

0 commit comments

Comments
 (0)