Lines Matching defs:buf

101 static	void usb_find_extra(uchar_t *buf, size_t buflen,
112 static size_t usb_parse_dev_descr(uchar_t *buf, size_t buflen,
114 static size_t usb_parse_cfg_descr(uchar_t *buf, size_t buflen,
117 static size_t usb_parse_if_descr(uchar_t *buf, size_t buflen,
121 static size_t usb_parse_ep_descr(uchar_t *buf, size_t buflen,
678 usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf,
689 if ((dev == NULL) || (buf == NULL) || (buflen == 0)) {
699 langid, buf, (int)buflen, 1000));
709 usb_get_string_simple(usb_dev_handle *dev, int index, char *buf,
718 if ((dev == NULL) || (buf == NULL) || (buflen == 0)) {
725 (void) memset(buf, 0, buflen);
766 buf[di++] = '?';
768 buf[di++] = tbuf[si];
772 buf[di] = 0;
787 uchar_t type, uchar_t index, void *buf, int size)
789 if ((udev == NULL) || (buf == NULL) || (size <= 0)) {
797 (void) memset(buf, 0, size);
801 (type << 8) + index, 0, buf, size, 1000));
806 uchar_t index, void *buf, int size)
808 if ((udev == NULL) || (buf == NULL) || (size <= 0)) {
815 (void) memset(buf, 0, size);
819 (type << 8) + index, 0, buf, size, 1000));
2696 usb_nth_descr(uchar_t *buf, size_t buflen, int descr_type, uint_t n,
2699 uchar_t *bufstart = buf;
2700 uchar_t *bufend = buf + buflen;
2702 if (buf == NULL) {
2707 while (buf + 2 <= bufend) {
2708 if ((buf != bufstart) && ((buf[1] == stop_descr_type1) ||
2709 (buf[1] == stop_descr_type2))) {
2715 (buf[1] == descr_type)) {
2718 return (buf);
2724 * If buf[0] is 0, then this will be an infite loop
2726 INCREMENT_BUF(buf);
2739 usb_parse_dev_descr(uchar_t *buf, size_t buflen,
2742 if ((buf == NULL) || (ret_descr == NULL) ||
2743 (buflen < 2) || (buf[1] != USB_DESCR_TYPE_DEV)) {
2749 buf, buflen, ret_descr, ret_buf_len));
2759 usb_parse_cfg_descr(uchar_t *buf, size_t buflen, usb_cfg_descr_t *ret_descr,
2764 if ((buf == NULL) || (ret_descr == NULL) ||
2765 (buflen < 2) || (buf[1] != USB_DESCR_TYPE_CFG)) {
2771 buf, buflen, ret_descr, ret_buf_len);
2773 usb_find_extra(buf, buflen, extra, extralen);
2785 usb_parse_if_descr(uchar_t *buf, size_t buflen, uint_t if_number,
2789 uchar_t *bufend = buf + buflen;
2792 if ((buf == NULL) || (ret_descr == NULL)) {
2797 while (buf + 4 <= bufend) {
2798 if ((buf[1] == USB_DESCR_TYPE_IF) &&
2799 (buf[2] == if_number) &&
2800 (buf[3] == alt_if_setting)) {
2803 buf, ((uintptr_t)bufend - (uintptr_t)buf),
2806 usb_find_extra(buf,
2807 ((uintptr_t)bufend - (uintptr_t)buf),
2815 * If buf[0] is 0, then this will be an infinite loop
2817 INCREMENT_BUF(buf);
2833 usb_parse_ep_descr(uchar_t *buf, size_t buflen, uint_t if_number,
2837 uchar_t *bufend = buf + buflen;
2840 if ((buf == NULL) || (ret_descr == NULL)) {
2845 while ((buf + 4) <= bufend) {
2846 if (buf[1] == USB_DESCR_TYPE_IF &&
2847 buf[2] == if_number &&
2848 buf[3] == alt_if_setting) {
2849 if ((buf = usb_nth_descr(buf,
2850 (uintptr_t)bufend - (uintptr_t)buf,
2857 rval = usb_parse_data("ccccsccc", buf,
2858 (uintptr_t)bufend - (uintptr_t)buf,
2860 usb_find_extra(buf, (uintptr_t)bufend - (uintptr_t)buf,
2868 * If buf[0] is 0, then this will be an infinite loop
2870 INCREMENT_BUF(buf);
2885 usb_find_extra(uchar_t *buf, size_t buflen,
2888 uchar_t *next = buf + buf[0];
2893 while (((uintptr_t)next - (uintptr_t)buf + 1) < buflen) {
2898 (uintptr_t)buf - buf[0]);
2986 char buf[512];
2990 (void) vsnprintf(buf, sizeof (buf), format, ap);
2992 (void) fprintf(stderr, buf);