Lines Matching refs:canusb
49 #include "pcap-canusb-linux.h"
51 #define CANUSB_IFACE "canusb"
101 * saying "no CANUSB devices".
129 snprintf(dev_descr, 50, "CanUSB [%s]", sernum);
213 struct pcap_canusb *canusb;
219 /* Does it begin with "canusb"? */
220 if (strncmp(cp, "canusb", 6) != 0) {
221 /* Nope, doesn't begin with "canusb" */
225 /* Yes - is "canusb" followed by a number? */
246 canusb = p->priv;
247 canusb->ctx = NULL;
248 canusb->dev = NULL;
249 canusb->rdpipe = -1;
250 canusb->wrpipe = -1;
260 struct pcap_canusb *canusb = arg;
267 fcntl(canusb->wrpipe, F_SETFL, O_NONBLOCK);
269 while(canusb->loop)
274 libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
276 libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
280 libusb_bulk_transfer(canusb->dev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100);
281 if(write(canusb->wrpipe, &msg, sizeof(msg)) < 0)
322 struct pcap_canusb *canusb = handle->priv;
324 canusb->loop = 0;
325 pthread_join(canusb->worker, NULL);
327 if (canusb->dev)
329 libusb_close(canusb->dev);
330 canusb->dev = NULL;
332 if (canusb->ctx)
334 libusb_exit(canusb->ctx);
335 canusb->ctx = NULL;
343 struct pcap_canusb *canusb = handle->priv;
346 if (libusb_init(&canusb->ctx) != 0) {
372 canusb->dev = canusb_opendevice(canusb->ctx, serial);
373 if (!canusb->dev)
375 libusb_exit(canusb->ctx);
380 canusb_clearbufs(canusb);
382 handle->fd = canusb_startcapture(canusb);
433 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on canusb devices");