int presto_open(char *req_serial)
{
int i;
- int result;
DWORD numdevs;
DWORD vidpid;
char devname[FT_DEVICE_NAME_LEN];
BYTE presto_data;
unsigned long ftbytes;
- presto->handle=INVALID_HANDLE_VALUE;
+ presto->handle = (FT_HANDLE)INVALID_HANDLE_VALUE;
presto->buff_out_pos=0;
presto->buff_in_pos=0;
if (FT_GetDeviceInfo(presto->handle,&device,&vidpid,presto->serial,devname,NULL)==FT_OK)
{
if (vidpid==PRESTO_VID_PID && (req_serial==NULL || !strcmp(presto->serial,req_serial)))
- break;
+ break;
}
FT_Close(presto->handle);
- presto->handle=INVALID_HANDLE_VALUE;
+ presto->handle = (FT_HANDLE)INVALID_HANDLE_VALUE;
}
- if (presto->handle==INVALID_HANDLE_VALUE) return PRST_ERR;
+ if (presto->handle == (FT_HANDLE)INVALID_HANDLE_VALUE) return PRST_ERR;
if ((presto->status=FT_SetLatencyTimer(presto->handle,1))!=FT_OK) return PRST_ERR;
if ((presto->status=FT_SetTimeouts(presto->handle,100,0))!=FT_OK) return PRST_ERR;
int result=PRST_OK;
- if (presto->handle==INVALID_HANDLE_VALUE) return result;
+ if (presto->handle == (FT_HANDLE)INVALID_HANDLE_VALUE) return result;
presto->status=FT_Write(presto->handle,&presto_init_seq,sizeof(presto_init_seq),&ftbytes);
if (presto->status!=FT_OK) result=PRST_ERR;
if ((presto->status=FT_SetLatencyTimer(presto->handle,16))!=FT_OK) result=PRST_ERR;
if ((presto->status=FT_Close(presto->handle))!=FT_OK) result=PRST_ERR;
- else presto->handle=INVALID_HANDLE_VALUE;
+ else presto->handle = (FT_HANDLE)INVALID_HANDLE_VALUE;
return result;
}