View | Details | Raw Unified | Return to bug 282790 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/usb/input/uhid.c (+1 lines)
Lines 611-670 uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, Link Here
611
			mtx_unlock(&sc->sc_mtx);
611
			mtx_unlock(&sc->sc_mtx);
612
		}
612
		}
613
		break;
613
		break;
614
614
615
	case USB_GET_REPORT:
615
	case USB_GET_REPORT:
616
		if (!(fflags & FREAD)) {
616
		if (!(fflags & FREAD)) {
617
			error = EPERM;
617
			error = EPERM;
618
			break;
618
			break;
619
		}
619
		}
620
		switch (ugd->ugd_report_type) {
620
		switch (ugd->ugd_report_type) {
621
		case UHID_INPUT_REPORT:
621
		case UHID_INPUT_REPORT:
622
			size = sc->sc_isize;
622
			size = sc->sc_isize;
623
			id = sc->sc_iid;
623
			id = sc->sc_iid;
624
			break;
624
			break;
625
		case UHID_OUTPUT_REPORT:
625
		case UHID_OUTPUT_REPORT:
626
			size = sc->sc_osize;
626
			size = sc->sc_osize;
627
			id = sc->sc_oid;
627
			id = sc->sc_oid;
628
			break;
628
			break;
629
		case UHID_FEATURE_REPORT:
629
		case UHID_FEATURE_REPORT:
630
			size = sc->sc_fsize;
630
			size = sc->sc_fsize;
631
			id = sc->sc_fid;
631
			id = sc->sc_fid;
632
			break;
632
			break;
633
		default:
633
		default:
634
			return (EINVAL);
634
			return (EINVAL);
635
		}
635
		}
636
		if (id != 0)
636
		if (id != 0)
637
			error = copyin(ugd->ugd_data, &id, 1);
637
			error = copyin(ugd->ugd_data, &id, 1);
638
		if (error == 0)
638
		if (error == 0)
639
			error = uhid_get_report(sc, ugd->ugd_report_type, id,
639
			error = uhid_get_report(sc, ugd->ugd_report_type, id,
640
			    NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
640
			    NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
641
		ugd->ugd_actlen = size;
641
		break;
642
		break;
642
643
643
	case USB_SET_REPORT:
644
	case USB_SET_REPORT:
644
		if (!(fflags & FWRITE)) {
645
		if (!(fflags & FWRITE)) {
645
			error = EPERM;
646
			error = EPERM;
646
			break;
647
			break;
647
		}
648
		}
648
		switch (ugd->ugd_report_type) {
649
		switch (ugd->ugd_report_type) {
649
		case UHID_INPUT_REPORT:
650
		case UHID_INPUT_REPORT:
650
			size = sc->sc_isize;
651
			size = sc->sc_isize;
651
			id = sc->sc_iid;
652
			id = sc->sc_iid;
652
			break;
653
			break;
653
		case UHID_OUTPUT_REPORT:
654
		case UHID_OUTPUT_REPORT:
654
			size = sc->sc_osize;
655
			size = sc->sc_osize;
655
			id = sc->sc_oid;
656
			id = sc->sc_oid;
656
			break;
657
			break;
657
		case UHID_FEATURE_REPORT:
658
		case UHID_FEATURE_REPORT:
658
			size = sc->sc_fsize;
659
			size = sc->sc_fsize;
659
			id = sc->sc_fid;
660
			id = sc->sc_fid;
660
			break;
661
			break;
661
		default:
662
		default:
662
			return (EINVAL);
663
			return (EINVAL);
663
		}
664
		}
664
		if (id != 0)
665
		if (id != 0)
665
			error = copyin(ugd->ugd_data, &id, 1);
666
			error = copyin(ugd->ugd_data, &id, 1);
666
		if (error == 0)
667
		if (error == 0)
667
			error = uhid_set_report(sc, ugd->ugd_report_type, id,
668
			error = uhid_set_report(sc, ugd->ugd_report_type, id,
668
			    NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
669
			    NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
669
		break;
670
		break;
670
671

Return to bug 282790