40 #define __FILE_ID__ "ystream" 61 #ifdef DEBUG_TRACE_FILE 72 int ySetErr(
int code,
char *outmsg,
const char *erreur,
const char *file,u32 line)
96 default: msg=
"Unknown error";
112 int FusionErrmsg(
int code,
char *errmsg,
const char *generr,
const char *detailerr)
115 if(
YISERR(code) && errmsg){
128 #if !defined(_MSC_VER) || (_MSC_VER <= MSC_VS2003) 130 int YFOPEN(FILE** f,
const char *filename,
const char *mode)
132 *f=fopen(filename,mode);
143 #define DBGLOGOUT(str) yContext->log(str,YSTRLEN(str)) 145 static int dayofs[] = { 0,31,59,90,120,151,181,212,243,273,304,334 };
149 u32 year, month, day, h, m,
s;
153 GetLocalTime( &time);
166 secs = (u32)(ltime % 86400);
167 days = (u32)(ltime / 86400);
169 m = (secs % 3600) / 60;
172 if (((y + 1) >> 2) + 365 * (u32)y > days) y--;
173 days -= ((y + 1) >> 2) + 365 * (u32)y;
174 if ((y & 3) == 2 && days == 59) {
177 if((y & 3) == 2 && days >= 59)
179 for (month = 1; month < 12; (month)++)
180 if (
dayofs[month] > (u16)days)
break;
183 day = days -
dayofs[month - 1] + 1;
185 fprintf(f,
"[%04d-%02d-%02d/%02d:%02d:%02d]:",year,month,day,h,m,s);
189 int vdbglogf(
const char *fileid,
int line,
const char *fmt,va_list args)
195 len=
YSPRINTF(buffer,2048,
"[%d]%s:% 4d: ",threadIdx,fileid,line);
196 if(len<0 || len>=2028 || (len =
YVSPRINTF(buffer+len,2048-len,fmt,args))<0){
197 YSTRCPY(buffer,2048,
"dbglogf failed\n");
202 if(yContext && yContext->
log)
203 yContext->
log(buffer,len);
207 printf(
"%s", buffer);
216 fwrite(buffer,1,len,f);
222 int dbglogf(
const char *fileid,
int line,
const char *fmt,...)
227 va_start( args, fmt );
228 len =
vdbglogf(fileid,line,fmt,args);
236 int sprintf_s(
char *buffer,
size_t sizeOfBuffer,
const char *format,...)
239 va_start( args, format);
240 return vsprintf(buffer,format,args);
243 int wcstombs_s(
size_t *pReturnValue,
char *mbstr,
size_t sizeInBytes,
const wchar_t *wcstr,
size_t count)
245 *pReturnValue = wcstombs(mbstr, wcstr, count);
255 void ypUpdateUSB(
const char *serial,
const char *funcid,
const char *funcname,
int funclass,
int funydx,
const char *funcval)
262 funcid_cstr[0] = funcid[0];
263 categ[0] = (funcid[0] & ~0x20);
266 if(!c || (c <= '9' && c >=
'0'))
break;
271 for(; i < YOCTO_FUNCTION_LEN-1; i++) {
316 #ifdef DEBUG_DEVICE_LOCK 317 #define LOCATION int line, 318 #define PUSH_LOCATION __LINE__, 319 #define PUSH_LOCATION __LINE__, 322 #define PUSH_LOCATION 348 switch(dev->rstatus){
360 #ifdef DEBUG_DEVICE_LOCK 361 dbglog(
"start Idle on %s (line %d)\n",dev->infos.serial,line);
365 #ifdef DEBUG_DEVICE_LOCK 366 dbglog(
"doube Idle on %s (line %d)\n",dev->infos.serial,line);
380 switch(dev->rstatus){
387 #ifdef DEBUG_DEVICE_LOCK 388 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
394 #ifdef DEBUG_DEVICE_LOCK 395 dbglog(
"stop Idle on %s (line %d)\n",dev->infos.serial,line);
435 dbglog(
"Error from idle %s(%d) : %s\n",dev->infos.serial,dev->rstatus,error_to_set);
436 switch(dev->rstatus){
443 #ifdef DEBUG_DEVICE_LOCK 444 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
470 switch(dev->rstatus){
484 #ifdef DEBUG_DEVICE_LOCK 485 dbglog(
"start IO on %s (line %d)\n",dev->infos.serial,line);
490 #ifdef DEBUG_DEVICE_LOCK 491 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
507 switch(dev->rstatus){
516 #ifdef DEBUG_DEVICE_LOCK 517 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
524 #ifdef DEBUG_DEVICE_LOCK 525 dbglog(
"pause IO on %s (line %d)\n",dev->infos.serial,line);
533 #ifdef DEBUG_DEVICE_LOCK 534 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
558 switch(dev->rstatus){
570 #ifdef DEBUG_DEVICE_LOCK 571 dbglog(
"restart IO on %s (line %d)\n",dev->infos.serial,line);
583 #ifdef DEBUG_DEVICE_LOCK 584 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
606 switch(dev->rstatus){
614 if (dev->pendingIO.callback == NULL) {
618 #ifdef DEBUG_DEVICE_LOCK 619 dbglog(
"Async IO bg process on %s (line %d)\n",dev->infos.serial,line);
631 #ifdef DEBUG_DEVICE_LOCK 632 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
649 switch(dev->rstatus){
661 #ifdef DEBUG_DEVICE_LOCK 662 dbglog(
"Stop IO on %s (line %d)\n",dev->infos.serial,line);
670 #ifdef DEBUG_DEVICE_LOCK 671 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
687 switch(dev->rstatus){
693 dbglog(
"Error %s(%d) : %s\n",dev->infos.serial,dev->rstatus,error_to_set);
699 #ifdef DEBUG_DEVICE_LOCK 700 dbglog(
"panic on %s (line %d)\n",dev->infos.serial,line);
717 #ifdef DEBUG_DUMP_PKT 719 static void dumpAnyStream(
char *prefix,
int iface,u8 pkt,u8 stream,u8 size,u8 *data,u8 pktno)
726 dbglog(
"%s:%d: head: type=%d stream/cmd=%d size=%d (pktno=%d)\n",
727 prefix,iface ,pkt ,stream,size,pktno);
732 dbglog(
"%s: USB_CONF_RESET\n",prefix);
735 dbglog(
"%s: USB_CONF_START\n",prefix);
738 dbglog(
"%s: CONF PKT INVALID!\n",prefix);
744 dbglog(
"%s: Stream Empty\n",prefix);
749 dbglog(
"%s: TINY FUNCTION VALUE\n",prefix);
751 dbglog(
"%s: SMALL FUNCTION VALUE\n",prefix);
754 dbglog(
"%s: NOTIFY LOGICAL NAME\n",prefix);
757 dbglog(
"%s: NOTIFY PRODNAME\n",prefix);
760 dbglog(
"%s: NOTIFY CHILD\n",prefix);
763 dbglog(
"%s: NOTIFY FIRMWARE\n",prefix);
766 dbglog(
"%s: NOTIFY FUNCTION NAME\n",prefix);
769 dbglog(
"%s: NOTIFY FUNCTION VALUE\n",prefix);
772 dbglog(
"%s: NOTIFY DEVICE READY\n",prefix);
775 dbglog(
"%s: NOTIFY DEVICE LOG\n",prefix);
778 dbglog(
"%s: Unknown NOTIFY\n",prefix);
783 dbglog(
"%s: Stream tcp\n",prefix);
784 for(pos = 0; pos < size; pos += 16) {
785 memset(buff,
'.', 16);
786 for(j = 0; j < 16; j++)
787 if(data[pos+j] >=
' ')
788 buff[j] = data[pos+j];
789 dbglog(
" %02x.%02x.%02x.%02x %02x.%02x.%02x.%02x %02x.%02x.%02x.%02x %02x.%02x.%02x.%02x %s\n",
790 data[pos+0], data[pos+1], data[pos+2], data[pos+3],
791 data[pos+4], data[pos+5], data[pos+6], data[pos+7],
792 data[pos+8], data[pos+9], data[pos+10], data[pos+11],
793 data[pos+12], data[pos+13], data[pos+14], data[pos+15],
798 dbglog(
"%s: Stream tcp close\n",prefix);
799 for(pos = 0; pos < size; pos += 16) {
800 memset(buff,
'.', 16);
801 for(j = 0; j < 16; j++)
802 if(data[pos+j] >=
' ')
803 buff[j] = data[pos+j];
804 dbglog(
" %02x.%02x.%02x.%02x %02x.%02x.%02x.%02x %02x.%02x.%02x.%02x %02x.%02x.%02x.%02x %s\n",
805 data[pos+0], data[pos+1], data[pos+2], data[pos+3],
806 data[pos+4], data[pos+5], data[pos+6], data[pos+7],
807 data[pos+8], data[pos+9], data[pos+10], data[pos+11],
808 data[pos+12], data[pos+13], data[pos+14], data[pos+15],
813 dbglog(
"%s: Stream invalid !\n",prefix);
819 static u32 dumpAnyStreamHead(
char *prefix,
int iface,
YSTREAM_Head *head,
int dumpContent)
826 void dumpAnyPacket(
char *prefix,
int iface,
USB_Packet *pkt)
832 pos+=
sizeof(
YSTREAM_Head)+dumpAnyStreamHead(prefix,iface,head,1);
845 #ifdef DUMP_USB_PKT_SHORT 846 static void dumpPktSummary(
char *prefix,
int iface,
int isInput,
const USB_Packet *pkt)
852 len =
YSPRINTF(buffer,512,
"%s%s:%d",(isInput?
"<-":
"->"),prefix,iface);
909 len +=
YSPRINTF(buffer+len,512-len,
" /ty=%c st=%c sz=%d pno=%d",
960 #ifdef DEBUG_PKT_TIMING 966 if (q->
first == NULL) {
1081 while (pkt != NULL){
1090 if (verifcount != q->
count) {
1091 dbglogf(file, line,
"PKTs: invalid pkt count has %d report %d\n", verifcount, q->
count);
1099 #ifdef DUMP_USB_PKT_SHORT 1102 #ifdef DEBUG_MISSING_PACKET 1163 #ifdef DUMP_USB_PKT_SHORT 1179 #ifdef DUMP_USB_PKT_SHORT 1231 data[1] = pktno & 0xff;
1263 dbglog(
"drop %d pkt on iface %d\n",dropcount, iface->
ifaceno);
1266 #ifdef DEBUG_DUMP_PKT 1268 dumpAnyPacket(
"Drop non-config pkt",(u8)iface->
ifaceno, &tmp->
pkt);
1298 dbglog(
"Yoctopuce library is too old (using 0x%x, need 0x%x) to handle device %s, please upgrade your Yoctopuce library\n",
YPKT_USB_VERSION_BCD,version,serial);
1311 dbglog(
"Device %s is using a newer protocol, consider upgrading your Yoctopuce library\n",serial);
1313 dbglog(
"Device %s is using an older protocol, consider upgrading the device firmware\n",serial);
1407 iface = &dev->
iface;
1410 if (blockUntilTime > now)
1411 wait = blockUntilTime - now;
1432 #ifdef DEBUG_DUMP_PKT 1433 dumpAnyPacket(
"Drop Late config pkt",iface->
ifaceno,&item->
pkt);
1452 #ifdef DEBUG_DUMP_PKT 1453 dumpAnyPacket(
"POP Pkt",iface->
ifaceno,&item->
pkt);
1486 currUtcTime = (u32)time(NULL);
1487 if (currUtcTime > (u32)0x51f151f1){
1494 pktdata[1] = currUtcTime & 0xff;
1495 pktdata[2] = (currUtcTime >> 8) & 0xff;
1496 pktdata[3] = (currUtcTime >> 16) & 0xff;
1497 pktdata[4] = (currUtcTime >> 24) & 0xff;
1530 *stream = yshead->
stream;
1531 *size = yshead->
size;
1590 yshead->
size = size;
1593 dbglog(
"unable to append data proto=%d (%d + %d + %d <= %d) (%s)\n",
1620 u16 vendorid,deviceid;
1634 smallnot->funInfo.v2.isSmall = 1;
1637 #ifndef __BORLANDC__ 1646 smallnot->devydx = 255;
1649 #ifdef DEBUG_NOTIFICATION 1651 dbglog(
"notifysmall %d %d %s\n",smallnot->devydx,smallnot->funInfo.v2.funydx,smallnot->pubval);
1653 u8 *tmpbuff = (u8 *)smallnot->pubval;
1654 dbglog(
"notifysmall %d %d %d:%02x.%02x.%02x.%02x.%02x.%02x\n",smallnot->devydx,smallnot->funInfo.v2.funydx,smallnot->funInfo.v2.typeV2,
1655 tmpbuff[0],tmpbuff[1],tmpbuff[2],tmpbuff[3],tmpbuff[4],tmpbuff[5]);
1659 ypUpdateYdx(smallnot->devydx,smallnot->funInfo,smallnot->pubval);
1673 #ifdef DEBUG_NOTIFICATION 1679 #ifdef DEBUG_NOTIFICATION 1683 #ifdef DEBUG_NOTIFICATION 1697 #ifdef DEBUG_NOTIFICATION 1702 #ifdef DEBUG_NOTIFICATION 1715 #ifdef DEBUG_NOTIFICATION 1732 #ifdef DEBUG_NOTIFICATION 1750 #ifdef DEBUG_NOTIFICATION 1760 #ifdef DEBUG_NOTIFICATION 1761 dbglog(
"notify steam ready (%x)\n",notify->
raw);
1774 #ifdef DEBUG_NOTIFICATION 1778 #ifdef DEBUG_NOTIFICATION 1801 #ifdef DEBUG_NOTIFICATION 1814 while (pktsize > 0) {
1817 if (report->
funYdx == 0xf) {
1818 u32 t = data[1] + 0x100u * data[2] + 0x10000u * data[3] + 0x1000000u * data[4];
1828 data[0] = report->
isAvg ? 1 : 0;
1845 #ifdef DEBUG_NOTIFICATION 1858 while (pktsize > 0) {
1861 if (report->
funYdx == 0xf) {
1862 u32 t = data[1] + 0x100u * data[2] + 0x10000u * data[3] + 0x1000000u * data[4];
1892 #ifdef DEBUG_USB_TRAFIC 1897 pktavail =
yStreamReceived(dev, &stream, &data, &size, blockUntilTime,errmsg);
1902 #ifdef DEBUG_USB_TRAFIC 1904 memcpy(dump,data,size);
1906 dbglog(
"---------------------------\n");
1908 dbglog(
"---------------------------\n");
1921 #ifdef DEBUG_USB_TRAFIC 1923 memcpy(dump,data,size);
1925 dbglog(
"---------------------------\n");
1927 dbglog(
"---------------------------\n");
1969 #ifdef DEBUG_DEV_ENUM 1970 const char *YDEV_STATUS_TXT[] =
1976 "YDEV_NOTRESPONDING" 1987 #ifdef DEBUG_DEV_ENUM_VERBOSE 2004 for(p=yContext->
devs ; p ; p=p->
next ){
2028 yFree(dev->http_raw_buf);
2038 unsigned delay = 10;
2042 for (nb_try = 0; nb_try < 4; nb_try++, delay *= 4,
dbglog(
"retrying StartDevice (%s)\n", errmsg)) {
2092 #ifdef DEBUG_DEV_ENUM 2113 #ifdef DEBUG_DEV_ENUM 2119 #ifdef DEBUG_DEV_ENUM 2136 dbglog(
"Unable to start the device %s correctly (%s). retry later\n", p->
infos.
serial, errmsg);
2137 #ifdef DEBUG_DEV_ENUM 2144 #ifdef DEBUG_DEV_ENUM 2156 #ifdef DEBUG_DEV_ENUM 2170 #ifdef DEBUG_DEV_ENUM_VERBOSE 2203 for (j = 0, iface = runifaces; j < nbifaces; j++, iface++){
2213 ENUMLOG(
"%s was already there but OS handles are no more valid\n",dev->
infos.
serial);
2216 ENUMLOG(
"%s was already there but need to be reset due to runtime error\n",dev->
infos.
serial);
2229 ENUMLOG(
"%s replug of a previously detected device that was not responding\n",dev->
infos.
serial);
2274 for( p=yContext->
devs ; p ; p=p->
next){
2284 for( p=yContext->
devs ; p ; p=p->
next){
2315 for( p=yContext->
devs ; p ; p=p->
next){
2327 for( p=yContext->
devs ; p ; p=p->
next){
2361 #ifdef PERF_YHUB_FUNCTIONS 2376 yUsbPerfMonSt yUsbPerf;
2379 #define YPERF_ENTER(NAME) {yUsbPerf.NAME.count++;yUsbPerf.NAME.tmp=yapiGetTickCount();} 2380 #define YPERF_LEAVE(NAME) {yUsbPerf.NAME.leave++;yUsbPerf.NAME.totaltime += yapiGetTickCount()- yUsbPerf.NAME.tmp;} 2384 void dumpYUSBPerf(
void)
2387 dumpYPerfEntry(&yUsbPerf.yUsbTrafficPending,
"yUsbTrafficPending");
2397 #define YPERF_ENTER(NAME) 2398 #define YPERF_LEAVE(NAME) 2403 #ifdef PERF_YHUB_FUNCTIONS 2404 memset(&yUsbPerf,0,
sizeof(yUsbPerfMonSt));
2415 #ifdef PERF_YHUB_FUNCTIONS 2448 for( p=yContext->
devs ; p ; p=p->
next){
2458 dbglog(
"yPacketDispatchReceive error:%s\n",errmsg);
2462 currUtcTime = (u32)time(NULL);
2463 if(currUtcTime > (u32)0x51f151f1 &&
2464 (!p->lastUtcUpdate || currUtcTime < p->lastUtcUpdate || currUtcTime >= p->lastUtcUpdate+60u)) {
2469 p->lastUtcUpdate = currUtcTime;
2471 pktdata[1] = currUtcTime & 0xff;
2472 pktdata[2] = (currUtcTime>>8) & 0xff;
2473 pktdata[3] = (currUtcTime>>16) & 0xff;
2474 pktdata[4] = (currUtcTime>>24) & 0xff;
2476 dbglog(
"Unable to send UTC timestamp\n");
2478 dbglog(
"Unable to flush UTC timestamp\n");
2485 if (p->httpstate !=
YHTTP_CLOSED && p->pendingIO.callback) {
2491 dbglog(
"yPacketDispatchReceive error:%s\n",errmsg);
2498 dbglog(
"Last async request did not complete (%X:%d)\n",p->pendingIO.hdl,p->httpstate);
2509 dbglog(
"Unable to send async connection close\n");
2511 dbglog(
"Unable to flush async connection close\n");
2515 p->pendingIO.callback(p->pendingIO.context, ptr, len,
YAPI_SUCCESS, NULL);
2522 dbglog(
"Idle : devStopIO err %s : %X:%s\n",p->infos.serial,res,errmsg);
2539 for( p=yContext->
devs ; p ; p=p->
next){
2560 res =
yUsbOpen(ioghdl, serialBuf, errmsg);
2592 memset(&p->pendingIO,0,
sizeof(
USB_HDL));
2618 p->pendingIO.callback = callback;
2619 p->pendingIO.context = context;
2657 u8 pktlen =(maxpktlen < writelen ? maxpktlen: writelen);
2658 memcpy(pktdata,buffer,pktlen);
2666 totalsend += pktlen;
2703 if(p->pendingIO.callback){
2718 readed=
yPopFifo(&p->http_fifo,(u8*)buffer,(u16)len);
2746 if(p->pendingIO.callback){
2762 readed=
yPopFifo(&p->http_fifo,(u8*)buffer,(u16)len);
2788 if(p->pendingIO.callback){
2828 dbglog(
"yUsb double-close");
2837 if(p->pendingIO.callback){
2846 dbglog(
"Unable to flush pending data");
2853 dbglog(
"Unable to send connection close");
2856 dbglog(
"Unable to flush connection close");
2872 dbglog(
"yUSBClose without device ack\n");
2878 memset(&p->pendingIO, 0,
sizeof(
USB_HDL));
#define yMemset(dst, val, size)
int yUsbFree(yContextSt *ctx, char *errmsg)
int YFOPEN(FILE **f, const char *filename, const char *mode)
static YRETCODE yPktQueuePop(pktQueue *q, pktItem **pkt, char *errmsg)
static int devStartIO(LOCATION yPrivDeviceSt *dev, char *errmsg)
#define YPKT_USB_VERSION_NO_RETRY_BCD
static void devStopEnum(LOCATION yPrivDeviceSt *dev)
static int yyWaitOnlyConfPkt(yInterfaceSt *iface, u8 cmdtowait, pktItem **rpkt, u32 s_timeout, char *errmsg)
static int devStopIO(LOCATION yPrivDeviceSt *dev, char *errmsg)
yCRITICAL_SECTION acces_state
int yWaitForEvent(yEvent *ev, int time)
#define YERRMSG(code, message)
static int devCheckAsyncIO(LOCATION yPrivDeviceSt *dev, char *errmsg)
#define HTTP_RAW_BUFF_SIZE
static void devReportErrorFromIdle(LOCATION yPrivDeviceSt *dev, char *error_to_set)
int yUsbReadNonBlock(YIOHDL_internal *ioghdl, char *buffer, int len, char *errmsg)
char funcid[YOCTO_FUNCTION_LEN]
static void devStopIdle(LOCATION yPrivDeviceSt *dev)
Notification_child childserial
u16 yPeekContinuousFifo(yFifoBuf *buf, u8 **ptr, u16 startofs)
char pubval[VARIABLE_SIZE]
#define YPKT_USB_VERSION_BCD
void yInitializeCriticalSection(yCRITICAL_SECTION *cs)
#define ENUMLOG(fmt, args...)
void yFifoCleanup(yFifoBuf *buf)
static int yDispatchReceive(yPrivDeviceSt *dev, u64 blockUntilTime, char *errmsg)
char funcid[YOCTO_FUNCTION_LEN]
int yUsbInit(yContextSt *ctx, char *errmsg)
int yUsbSetIOAsync(YIOHDL_internal *ioghdl, yapiRequestAsyncCallback callback, void *context, char *errmsg)
#define YOCTO_DEVID_BOOTLOADER
#define YOCTO_PRODUCTNAME_LEN
YUSBDEV findDevHdlFromStr(const char *str)
void yFunctionTimedUpdate(YAPI_FUNCTION fundescr, double deviceTime, const u8 *report, u32 len)
static void yPktQueueDup(pktQueue *q, int expected_pkt_no, const char *file, int line)
u16 yPushFifo(yFifoBuf *buf, const u8 *data, u16 datalen)
YRETCODE yPktQueuePopH2D(yInterfaceSt *iface, pktItem **pkt)
YRETCODE yUSBUpdateDeviceList(char *errmsg)
void yHashGetStr(yHash yhash, char *destbuf, u16 bufsize)
int yUsbOpen(YIOHDL_internal *ioghdl, const char *device, char *errmsg)
int ypRegisterByYdx(u8 devYdx, Notification_funydx funInfo, const char *funcVal, YAPI_FUNCTION *fundesc)
static yPrivDeviceSt * enuFindDevSlot(yInterfaceSt *iface)
int yUsbTrafficPending(void)
#define NOTIFY_PKT_FUNCNAME
#define YPKT_VERSION_ORIGINAL_RELEASE
int vdbglogf(const char *fileid, int line, const char *fmt, va_list args)
static void yyFormatConfPkt(pktItem *pkt, u8 conftype)
int yUsbReadBlock(YIOHDL_internal *ioghdl, char *buffer, int len, u64 blockUntil, char *errmsg)
#define YSTRCAT(dst, dstsize, src)
void devHdlInfo(YUSBDEV hdl, yDeviceSt *infos)
static int yGetNextPktEx(yPrivDeviceSt *dev, pktItem **pkt_out, u64 blockUntilTime, char *errmsg)
#define yFifoInit(fifo, buffer, len)
static void enuResetDStatus(void)
YRETCODE yPktQueuePushH2D(yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
static int ySendStart(yPrivDeviceSt *dev, char *errmsg)
struct USB_Conf_Pkt::@8 reset
char errmsg[YOCTO_ERRMSG_LEN]
#define YOCTO_FIRMWARE_LEN
static int devCheckIO(LOCATION yPrivDeviceSt *dev, YIOHDL_internal *iohdl, char *errmsg)
#define DEVGEN_LOG_ACTIVATED
#define NOTIFY_PKT_FUNCVAL
u16 yFifoGetUsed(yFifoBuf *buf)
int yyySetup(yInterfaceSt *iface, char *errmsg)
yRawReportV2Cb rawReportV2Cb
#define NBMAX_INTERFACE_PER_DEV
static YRETCODE yPktQueuePeek(pktQueue *q, pktItem **pkt, char *errmsg)
int yyyUSBGetInterfaces(yInterfaceSt **ifaces, int *nbifaceDetect, char *errmsg)
int wpGetDevYdx(yStrRef serial)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
int dbglogf(const char *fileid, int line, const char *fmt,...)
static yPrivDeviceSt * findDevFromDevHdl(YUSBDEV hdl)
int yUsbWrite(YIOHDL_internal *ioghdl, const char *buffer, int writelen, char *errmsg)
void wpSafeUnregister(yStrRef serialref)
static void yStreamShutdown(yPrivDeviceSt *dev)
#define USB_META_ACK_D2H_PACKET
static int yPktQueueIsEmpty(pktQueue *q, char *errmsg)
int ySetErr(int code, char *outmsg, const char *erreur, const char *file, u32 line)
int yyyUSB_init(yContextSt *ctx, char *errmsg)
YRETCODE yapiPullDeviceLog(const char *serial)
#define YSTREAM_REPORT_V2
yHash yHashTestStr(const char *str)
static int yStreamFlush(yPrivDeviceSt *dev, char *errmsg)
char firmware[YOCTO_FIRMWARE_LEN]
#define NB_MAX_STARTUP_RETRY
struct USB_Packet::@41 confpkt
#define YSTREAM_NOTICE_V2
#define YSTREAM_TCP_CLOSE
int yUsbClose(YIOHDL_internal *ioghdl, char *errmsg)
YRETCODE yPktQueuePushD2H(yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
Notification_product productname
#define Y_DEFAULT_PKT_RESEND_DELAY
YSTREAM_Head first_stream
static int yPktQueueWaitEmptyH2D(yInterfaceSt *iface, int ms, char *errmsg)
static void yDispatchNotice(yPrivDeviceSt *dev, USB_Notify_Pkt *notify, int pktsize, int isV2)
yapiTimedReportCallback timedReportCallback
Notification_funydx funInfo
static void yDispatchReportV2(yPrivDeviceSt *dev, u8 *data, int pktsize)
int yyySignalOutPkt(yInterfaceSt *iface, char *errmsg)
#define TO_SAFE_U16(safe, unsafe)
yUrlRef yHashUrlUSB(yHash serial)
void decodePubVal(Notification_funydx funInfo, const char *funcval, char *buffer)
#define yApproximateSleep(ms)
char funcname[YOCTO_LOGICAL_LEN]
struct Notification_funydx::@10 v2
static int yStreamReceptionDone(yPrivDeviceSt *dev, char *errmsg)
#define YSTRCPY(dst, dstsize, src)
#define YOCTO_PUBVAL_SIZE
int yyyUSB_stop(yContextSt *ctx, char *errmsg)
void yPktQueueFree(pktQueue *q)
#define NOTIFY_1STBYTE_MINSMALL
char pubval[YOCTO_PUBVAL_SIZE]
char logicalname[YOCTO_LOGICAL_LEN]
static int devPauseIO(LOCATION yPrivDeviceSt *dev, char *errmsg)
YRETCODE yPktQueueWaitAndPopD2H(yInterfaceSt *iface, pktItem **pkt, int ms, char *errmsg)
yRawNotificationCb rawNotificationCb
char pubval[VARIABLE_SIZE]
#define YOCTO_FUNCTION_LEN
Notification_funcname funcnamenot
YRETCODE yPktQueuePeekH2D(yInterfaceSt *iface, pktItem **pkt)
static void FreeDevice(yPrivDeviceSt *dev)
void yPktQueueInit(pktQueue *q)
char firmware[YOCTO_FIRMWARE_LEN]
static void devInitAccces(LOCATION yPrivDeviceSt *dev)
#define NOTIFY_V2_FLUSHGROUP
YRETCODE yyySendPacket(yInterfaceSt *iface, const USB_Packet *pkt, char *errmsg)
void wpSafeRegister(HubSt *hub, u8 devYdx, yStrRef serialref, yStrRef lnameref, yStrRef productref, u16 deviceid, yUrlRef devUrl, s8 beacon)
yHash yHashPutStr(const char *str)
#define NOTIFY_PKT_PRODNAME
static void devStartEnum(LOCATION yPrivDeviceSt *dev)
#define YPERF_LEAVE(NAME)
static void devDeleteAccces(LOCATION yPrivDeviceSt *dev)
#define YPERF_ENTER(NAME)
void yFifoEmpty(yFifoBuf *buf)
yPrivDeviceSt * findDevFromIOHdl(YIOHDL_internal *iohdl)
struct USB_Conf_Pkt::@9 start
u16 yFifoGetFree(yFifoBuf *buf)
void yPktQueueSetError(pktQueue *q, YRETCODE code, const char *msg)
void yResetEvent(yEvent *ev)
Notification_funcnameydx funcnameydxnot
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
char childserial[YOCTO_SERIAL_LEN]
char serial[YOCTO_SERIAL_LEN *2]
Notification_firmware firmwarenot
void(* yapiRequestAsyncCallback)(void *context, const u8 *result, u32 resultlen, int retcode, const char *errmsg)
#define NEXT_YPKT_NO(current)
#define NOTIFY_PKT_FIRMWARE
static int CheckVersionCompatibility(u16 version, const char *serial, char *errmsg)
int yUsbOpenDevDescr(YIOHDL_internal *ioghdl, yStrRef devdescr, char *errmsg)
static yPrivDeviceSt * AllocateDevice(void)
Notification_small smallpubvalnot
yGenericDeviceSt generic_infos[ALLOC_YDX_PER_HUB]
#define NOTIFY_PKT_STREAMREADY
char name[YOCTO_LOGICAL_LEN]
static void enuUpdateDStatus(void)
void yDeleteCriticalSection(yCRITICAL_SECTION *cs)
int yTryEnterCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE yAckPkt(yInterfaceSt *iface, int pktno, char *errmsg)
static void yDispatchReportV1(yPrivDeviceSt *dev, u8 *data, int pktsize)
yPrivDeviceSt * findDev(const char *str, u32 flags)
const int Y_RESEND_MISSING_PKT
void ySetEvent(yEvent *ev)
int yUsbEOF(YIOHDL_internal *ioghdl, char *errmsg)
yCRITICAL_SECTION generic_cs
void yFunctionUpdate(YAPI_FUNCTION fundescr, const char *value)
#define NOTIFY_PKT_FUNCNAMEYDX
void wpSafeUpdate(HubSt *hub, u8 devYdx, yStrRef serialref, yStrRef lnameref, yUrlRef devUrl, s8 beacon)
void yCreateManualEvent(yEvent *ev, int initialState)
Notification_name namenot
static int yStreamSetup(yPrivDeviceSt *dev, char *errmsg)
unsigned int nb_startup_retry
u64 YAPI_FUNCTION_EXPORT yapiGetTickCount(void)
Notification_tiny tinypubvalnot
void yyyPacketShutdown(yInterfaceSt *iface)
yCRITICAL_SECTION enum_cs
#define DEVGEN_LOG_PENDING
char serial[YOCTO_SERIAL_LEN]
static void devReportError(LOCATION yPrivDeviceSt *dev, char *error_to_set)
Notification_funcval pubvalnot
static int yStreamReceived(yPrivDeviceSt *dev, u8 *stream, u8 **data, u8 *size, u64 blockUntilTime, char *errmsg)
static int devStartIdle(LOCATION yPrivDeviceSt *dev, char *errmsg)
void yCloseEvent(yEvent *ev)
int ypRegister(yStrRef categ, yStrRef serial, yStrRef funcId, yStrRef funcName, int funClass, int funYdx, const char *funcVal)
void dumpYPerfEntry(yPerfMon *entry, const char *name)
int yyyOShdlCompare(yPrivDeviceSt *dev, yInterfaceSt *newiface)
void yUSBReleaseAllDevices(void)
void ypUpdateYdx(int devydx, Notification_funydx funInfo, const char *funcval)
char productname[YOCTO_PRODUCTNAME_LEN]
static int StopDevice(yPrivDeviceSt *dev, char *errmsg)
#define YIO_DEFAULT_USB_TIMEOUT
static YRETCODE yPktQueuePushEx(pktQueue *q, const USB_Packet *pkt, char *errmsg)
#define ALLOC_YDX_PER_HUB
static int StartDevice(yPrivDeviceSt *dev, char *errmsg)
#define NOTIFY_1STBYTE_MAXTINY
static int yStreamGetTxBuff(yPrivDeviceSt *dev, u8 **data, u8 *maxsize)
int FusionErrmsg(int code, char *errmsg, const char *generr, const char *detailerr)
#define YOCTO_AKA_YFUNCTION
#define YSTRNCAT(dst, dstsize, src, len)
#define YSTRNCPY(dst, dstsize, src, len)
static void WriteTsamp(FILE *f)
struct _yPrivDeviceSt * next
static int yPacketSetup(yPrivDeviceSt *dev, char *errmsg)
u16 yPopFifo(yFifoBuf *buf, u8 *data, u16 datalen)
yapiRequestAsyncCallback callback
#define FROM_SAFE_U16(safe, unsafe)
#define YOCTO_N_BASECLASSES
void ypUpdateHybrid(const char *serial, Notification_funydx funInfo, const char *funcval)
#define YOCTO_LOGICAL_LEN
static int yStreamTransmit(yPrivDeviceSt *dev, u8 proto, u8 size, char *errmsg)
void ypUpdateUSB(const char *serial, const char *funcid, const char *funcname, int funclass, int funydx, const char *funcval)
Notification_funydx funInfo