Re: NET_LOCK and pf_consistency_lock removal
On Wed, Jan 25, 2017 at 09:53:34AM +0100, Sebastian Benoit wrote: > this removes the pf_consistency_lock and protects the users with NET_LOCK() > > I ran into a crash when using pfctl -k, and mpi suggested this change (and > likes the diff). > > pf hackers: ok? OK bluhm@ > +pf_purge_expired_src_nodes(void) ... > if (cur->states == 0 && cur->expire <= time_uptime) { > - if (! locked) { > - rw_enter_write(_consistency_lock); > - next = RB_NEXT(pf_src_tree, > - _src_tracking, cur); > - locked = 1; > - } > + next = RB_NEXT(pf_src_tree, > + _src_tracking, cur); This statement fits in a single line now.
Re: usbdevs: logitech: cleanup
New scaled-back diff. cleanup whitespace, s/QUICKCAM/QKCAM/, no new ids. Index: dev/usb/uaudio.c === RCS file: /cvs/src/sys/dev/usb/uaudio.c,v retrieving revision 1.122 diff -u -p -r1.122 uaudio.c --- dev/usb/uaudio.c3 Jan 2017 06:45:58 - 1.122 +++ dev/usb/uaudio.c29 Jan 2017 22:13:04 - @@ -214,13 +214,13 @@ struct uaudio_devs { UAUDIO_FLAG_DEPENDENT }, { { USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502 }, UAUDIO_FLAG_NO_XU | UAUDIO_FLAG_BAD_ADC }, - { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMNBDLX }, + { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QKCAMNBDLX }, UAUDIO_FLAG_BAD_AUDIO }, - { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMPRONB }, + { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QKCAMPRONB }, UAUDIO_FLAG_BAD_AUDIO }, - { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMPRO4K }, + { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QKCAMPRO4K }, UAUDIO_FLAG_BAD_AUDIO }, - { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMZOOM }, + { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QKCAMZOOM }, UAUDIO_FLAG_BAD_AUDIO }, { { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1 }, UAUDIO_FLAG_NO_FRAC } Index: dev/usb/usbdevs === RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.673 diff -u -p -r1.673 usbdevs --- dev/usb/usbdevs 15 Dec 2016 15:42:05 - 1.673 +++ dev/usb/usbdevs 29 Jan 2017 22:13:07 - @@ -2553,37 +2553,37 @@ product LOGITEC LANW300NU2S 0x0169 LAN-W product LOGITECH M2452 0x0203 M2452 keyboard product LOGITECH M4848 0x0301 M4848 mouse product LOGITECH PAGESCAN 0x040f PageScan -product LOGITECH QUICKCAMWEB 0x0801 QuickCam Web +product LOGITECH QKCAMWEB 0x0801 QuickCam Web product LOGITECH WEBCAMC2000x0802 Webcam C200 product LOGITECH WEBCAMC5000x0807 Webcam C500 product LOGITECH QUICKCAMPRO 0x0810 QuickCam Pro product LOGITECH WEBCAMC3100x081b Webcam C310 product LOGITECH HDPROC910 0x0821 HD Pro Webcam C910 -product LOGITECH QUICKCAMEXP 0x0840 QuickCam Express -product LOGITECH QUICKCAM 0x0850 QuickCam -product LOGITECH QUICKCAMNBDLX 0x08a9 QuickCam Notebook Deluxe -product LOGITECH QUICKCAMPRO3K 0x08b0 QuickCam Pro 3000 -product LOGITECH QUICKCAMNBPRO_1 0x08b1QuickCam Notebook Pro -product LOGITECH QUICKCAMPRO4K 0x08b2 QuickCam Pro 4000 -product LOGITECH QUICKCAMZOOM 0x08b3 QuickCam Zoom -product LOGITECH QUICKCAMFUSION_1 0x08c1 QuickCam Fusion -product LOGITECH QUICKCAMORBITMP_1 0x08c2 QuickCam Orbit MP -product LOGITECH QUICKCAMNBPRO 0x08c3 QuickCam Notebook Pro -product LOGITECH QUICKCAMPRO5K_1 0x08c5QuickCam Pro 5000 -product LOGITECH QUICKCAMOEM_1 0x08c6 QuickCam OEM -product LOGITECH QUICKCAMOEM_2 0x08c7 QuickCam OEM -product LOGITECH QUICKCAMULTVIS0x08c9 QuickCam Ultra Vision -product LOGITECH QUICKCAMFUSION_2 0x08ca QuickCam Fusion -product LOGITECH QUICKCAMNBPRO_2 0x08cbQuickCam Notebook Pro -product LOGITECH QUICKCAMORBITMP_2 0x08cc QuickCam Orbit MP -product LOGITECH QUICKCAMPRO5K_2 0x08ceQuickCam Pro 5000 -product LOGITECH QUICKCAMPRO9K 0x0990 QuickCam Pro 9000 -product LOGITECH QUICKCAMPRONB 0x0991 QuickCam Pro Notebook -product LOGITECH QUICKCAMCOMMDLX 0x0992QuickCam Communicate Deluxe -product LOGITECH QUICKCAMORBITAF 0x0994 QuickCam Orbit AF -product LOGITECH QUICKCAMCOMMMP0x09a1 QuickCam Communicate MP -product LOGITECH QUICKCAME3500P0x09a4 QuickCam E 3500 Plus -product LOGITECH QUICKCAMDLXNB 0x09c1 QuickCam Deluxe Notebook +product LOGITECH QKCAMEXP 0x0840 QuickCam Express +product LOGITECH QKCAM 0x0850 QuickCam +product LOGITECH QKCAMNBDLX0x08a9 QuickCam Notebook Deluxe +product LOGITECH QKCAMPRO3K0x08b0 QuickCam Pro 3000 +product LOGITECH QKCAMNBPRO_1 0x08b1 QuickCam Notebook Pro +product LOGITECH QKCAMPRO4K0x08b2 QuickCam Pro 4000 +product LOGITECH QKCAMZOOM 0x08b3 QuickCam Zoom +product LOGITECH QKCAMFUSION_1 0x08c1 QuickCam Fusion +product LOGITECH QKCAMORBMP_1 0x08c2 QuickCam Orbit MP +product LOGITECH QKCAMNBPRO0x08c3 QuickCam Notebook Pro +product LOGITECH QKCAMPRO5K_1 0x08c5 QuickCam Pro 5000 +product LOGITECH QKCAMOEM_10x08c6 QuickCam OEM +product LOGITECH QKCAMOEM_20x08c7 QuickCam OEM +product LOGITECH QKCAMULTVIS 0x08c9 QuickCam Ultra Vision +product LOGITECH QKCAMFUSION_2 0x08ca QuickCam Fusion +product LOGITECH QKCAMNBPRO_2 0x08cb QuickCam Notebook Pro +product LOGITECH QKCAMORBMP_2 0x08cc QuickCam Orbit MP +product LOGITECH QKCAMPRO5K_2 0x08ce QuickCam Pro 5000 +product LOGITECH QKCAMPRO9K0x0990 QuickCam Pro 9000 +product LOGITECH QKCAMPRONB0x0991 QuickCam Pro Notebook
Re: Sync sys/videoio.h with recent Linux kernel
On 2017-01-29, Martin Pieuchotwrote: >> which allows us to fully comply with the V4L2 API. The attached diff >> implements this and syncs with videodev2.h from the Linux kernel version >> 4.10-rc5 at the same time > > This needs to go in a bulk since most users of this API are ports. I have started an amd64 test build with this. -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: Add quirks to support M-Audio FastTrack Pro (uaudio)
On 29/01/17(Sun) 19:33, Christopher Zimmermann wrote: > [...] > Index: uaudio.c > === > RCS file: /cvs/src/sys/dev/usb/uaudio.c,v > retrieving revision 1.122 > diff -u -p -r1.122 uaudio.c > --- uaudio.c 3 Jan 2017 06:45:58 - 1.122 > +++ uaudio.c 29 Jan 2017 17:13:28 - > @@ -172,6 +172,7 @@ struct chan { > #define UAUDIO_FLAG_VENDOR_CLASS 0x0010 /* claims vendor class but > works */ > #define UAUDIO_FLAG_DEPENDENT 0x0020 /* play and record params must > equal */ > #define UAUDIO_FLAG_EMU0202 0x0040 > +#define UAUDIO_FLAG_BE0x0080 > > struct uaudio_devs { > struct usb_devno uv_dev; > @@ -223,7 +224,9 @@ struct uaudio_devs { > { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMZOOM }, > UAUDIO_FLAG_BAD_AUDIO }, > { { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1 }, > - UAUDIO_FLAG_NO_FRAC } > + UAUDIO_FLAG_NO_FRAC }, > + { { USB_VENDOR_MAUDIO, USB_PRODUCT_MAUDIO_FASTTRACKPRO }, > + UAUDIO_FLAG_BE | UAUDIO_FLAG_DEPENDENT } > }; > #define uaudio_lookup(v, p) \ > ((struct uaudio_devs *)usb_lookup(uaudio_devs, v, p)) > @@ -444,6 +447,11 @@ uaudio_match(struct device *parent, void > if (uaa->iface == NULL || uaa->device == NULL) > return (UMATCH_NONE); > > + if (uaa->vendor == USB_VENDOR_MAUDIO && > + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO && > + uaa->configno != 2) > + return UMATCH_NONE; Why to you need this? > + > quirk = uaudio_lookup(uaa->vendor, uaa->product); > if (quirk) > flags = quirk->flags; > @@ -531,8 +539,21 @@ uaudio_attach(struct device *parent, str > found = 1; > } > } > - if (found) > + if (found) { > usbd_claim_iface(sc->sc_udev, i); > + if (uaa->vendor == USB_VENDOR_MAUDIO && > + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO) { > + /* > + * temporarily switch every iface to 24bit. > + * Causes the device to be big endian even > + * for 16bit samples. > + * using 16bits first will cause the device > + * to break when we later switch to 24bit. > + */ > + usbd_set_interface(sc->sc_alts[i].ifaceh, 2); > + usbd_set_interface(sc->sc_alts[i].ifaceh, 0); How did you figure that out? Is this behavior documented somehwere? > + } > + } > } > > for (j = 0; j < sc->sc_nalts; j++) { > @@ -1662,7 +1683,10 @@ uaudio_process_as(struct uaudio_softc *s > } else if (prec == 24) { > sc->sc_altflags |= HAS_24; > } > - enc = AUDIO_ENCODING_SLINEAR_LE; > + if (sc->sc_quirks & UAUDIO_FLAG_BE) > + enc = AUDIO_ENCODING_SLINEAR_BE; > + else > + enc = AUDIO_ENCODING_SLINEAR_LE; > format_str = "pcm"; > break; > case UA_FMT_PCM8: > @@ -1687,9 +1711,13 @@ uaudio_process_as(struct uaudio_softc *s > return (USBD_NORMAL_COMPLETION); > } > #ifdef UAUDIO_DEBUG > - printf("%s: %s: %d-ch %d-bit %d-byte %s,", sc->sc_dev.dv_xname, > + printf("%s: %s: alt %d(%d) for interface %d %d-ch %d-bit %d-byte %s enc > %d,", This line is > 80 chars. > +sc->sc_dev.dv_xname, > dir == UE_DIR_IN ? "recording" : "playback", > -chan, prec, bps, format_str); > +id->bAlternateSetting, > +sc->sc_nalts, > +id->bInterfaceNumber, > +chan, prec, bps, format_str, enc); > if (asf1d->bSamFreqType == UA_SAMP_CONTNUOUS) { > printf(" %d-%dHz\n", UA_SAMP_LO(asf1d), UA_SAMP_HI(asf1d)); > } else { > @@ -3312,6 +3340,9 @@ uaudio_set_params(void *addr, int setmod > } > break; > } > + > + if (sc->sc_quirks & UAUDIO_FLAG_BE) > + p->encoding = AUDIO_ENCODING_SLINEAR_BE; Why do you need this chunk and we don't need to set AUDIO_ENCODING_SLINEAR_SE in the other case? > > i = uaudio_match_alt(sc, p, mode); > if (i < 0) { > Index: umidi.c > === > RCS file: /cvs/src/sys/dev/usb/umidi.c,v > retrieving revision 1.43 > diff -u -p -r1.43 umidi.c > --- umidi.c 7 Jan 2017 06:10:40 - 1.43 > +++ umidi.c 29 Jan 2017 17:13:29 - > @@ -41,6 +41,7 @@ > #include > > #include > +#include > #include > #include > > @@ -152,6 +153,11 @@
Re: Add quirks to support M-Audio FastTrack Pro (uaudio)
On 2017-01-30 Martin Pieuchotwrote: > On 29/01/17(Sun) 14:45, Christopher Zimmermann wrote: > > > You are talking about usb_subr.c? Done. > > No I'm not :) > Yes please, do not touch usb_subr.c. > Also make sure your comment below respect style(9). ok. I got it. I added conditions to uaudio.c and umidi.c to accept the device only in configuration 2. The quirks in uaudio.c stay the same. Christopher Index: uaudio.c === RCS file: /cvs/src/sys/dev/usb/uaudio.c,v retrieving revision 1.122 diff -u -p -r1.122 uaudio.c --- uaudio.c3 Jan 2017 06:45:58 - 1.122 +++ uaudio.c29 Jan 2017 17:13:28 - @@ -172,6 +172,7 @@ struct chan { #define UAUDIO_FLAG_VENDOR_CLASS 0x0010/* claims vendor class but works */ #define UAUDIO_FLAG_DEPENDENT 0x0020 /* play and record params must equal */ #define UAUDIO_FLAG_EMU0202 0x0040 +#define UAUDIO_FLAG_BE 0x0080 struct uaudio_devs { struct usb_devno uv_dev; @@ -223,7 +224,9 @@ struct uaudio_devs { { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMZOOM }, UAUDIO_FLAG_BAD_AUDIO }, { { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1 }, - UAUDIO_FLAG_NO_FRAC } + UAUDIO_FLAG_NO_FRAC }, + { { USB_VENDOR_MAUDIO, USB_PRODUCT_MAUDIO_FASTTRACKPRO }, + UAUDIO_FLAG_BE | UAUDIO_FLAG_DEPENDENT } }; #define uaudio_lookup(v, p) \ ((struct uaudio_devs *)usb_lookup(uaudio_devs, v, p)) @@ -444,6 +447,11 @@ uaudio_match(struct device *parent, void if (uaa->iface == NULL || uaa->device == NULL) return (UMATCH_NONE); + if (uaa->vendor == USB_VENDOR_MAUDIO && + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO && + uaa->configno != 2) + return UMATCH_NONE; + quirk = uaudio_lookup(uaa->vendor, uaa->product); if (quirk) flags = quirk->flags; @@ -531,8 +539,21 @@ uaudio_attach(struct device *parent, str found = 1; } } - if (found) + if (found) { usbd_claim_iface(sc->sc_udev, i); + if (uaa->vendor == USB_VENDOR_MAUDIO && + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO) { + /* +* temporarily switch every iface to 24bit. +* Causes the device to be big endian even +* for 16bit samples. +* using 16bits first will cause the device +* to break when we later switch to 24bit. +*/ + usbd_set_interface(sc->sc_alts[i].ifaceh, 2); + usbd_set_interface(sc->sc_alts[i].ifaceh, 0); + } + } } for (j = 0; j < sc->sc_nalts; j++) { @@ -1662,7 +1683,10 @@ uaudio_process_as(struct uaudio_softc *s } else if (prec == 24) { sc->sc_altflags |= HAS_24; } - enc = AUDIO_ENCODING_SLINEAR_LE; + if (sc->sc_quirks & UAUDIO_FLAG_BE) + enc = AUDIO_ENCODING_SLINEAR_BE; + else + enc = AUDIO_ENCODING_SLINEAR_LE; format_str = "pcm"; break; case UA_FMT_PCM8: @@ -1687,9 +1711,13 @@ uaudio_process_as(struct uaudio_softc *s return (USBD_NORMAL_COMPLETION); } #ifdef UAUDIO_DEBUG - printf("%s: %s: %d-ch %d-bit %d-byte %s,", sc->sc_dev.dv_xname, + printf("%s: %s: alt %d(%d) for interface %d %d-ch %d-bit %d-byte %s enc %d,", + sc->sc_dev.dv_xname, dir == UE_DIR_IN ? "recording" : "playback", - chan, prec, bps, format_str); + id->bAlternateSetting, + sc->sc_nalts, + id->bInterfaceNumber, + chan, prec, bps, format_str, enc); if (asf1d->bSamFreqType == UA_SAMP_CONTNUOUS) { printf(" %d-%dHz\n", UA_SAMP_LO(asf1d), UA_SAMP_HI(asf1d)); } else { @@ -3312,6 +3340,9 @@ uaudio_set_params(void *addr, int setmod } break; } + + if (sc->sc_quirks & UAUDIO_FLAG_BE) + p->encoding = AUDIO_ENCODING_SLINEAR_BE; i = uaudio_match_alt(sc, p, mode); if (i < 0) { Index: umidi.c === RCS file: /cvs/src/sys/dev/usb/umidi.c,v retrieving revision 1.43 diff -u -p -r1.43 umidi.c --- umidi.c 7 Jan 2017 06:10:40 - 1.43 +++ umidi.c 29 Jan 2017 17:13:29 - @@ -41,6 +41,7 @@ #include #include
Re: lib/libc/sys/pledge.2: Fix comment
On Sun, Jan 29, 2017 at 12:40:40PM -0500, Michael Reed wrote: > It seem that sio_open(3) is more relevant to the "audio" pledge > than the "bpf" one, so move the reference accordingly. > fixed, thanks. jmc > > Index: pledge.2 > === > RCS file: /cvs/src/lib/libc/sys/pledge.2,v > retrieving revision 1.39 > diff -u -p -r1.39 pledge.2 > --- pledge.223 Jan 2017 07:19:39 - 1.39 > +++ pledge.229 Jan 2017 17:38:16 - > @@ -528,15 +528,15 @@ devices: > .Dv AUDIO_SETPAR , > .Dv AUDIO_START , > .Dv AUDIO_STOP . > -.It Va bpf > -Allow > -.Dv BIOCGSTATS > -operation for statistics collection from a bpf device. > .Pp > See > .Xr sio_open 3 > for more information on using the sndio API in combination with > .Fn pledge . > +.It Va bpf > +Allow > +.Dv BIOCGSTATS > +operation for statistics collection from a bpf device. > .El > .Pp > A whitelist of permitted paths may be provided in >
lib/libc/sys/pledge.2: Fix comment
It seem that sio_open(3) is more relevant to the "audio" pledge than the "bpf" one, so move the reference accordingly. Index: pledge.2 === RCS file: /cvs/src/lib/libc/sys/pledge.2,v retrieving revision 1.39 diff -u -p -r1.39 pledge.2 --- pledge.223 Jan 2017 07:19:39 - 1.39 +++ pledge.229 Jan 2017 17:38:16 - @@ -528,15 +528,15 @@ devices: .Dv AUDIO_SETPAR , .Dv AUDIO_START , .Dv AUDIO_STOP . -.It Va bpf -Allow -.Dv BIOCGSTATS -operation for statistics collection from a bpf device. .Pp See .Xr sio_open 3 for more information on using the sndio API in combination with .Fn pledge . +.It Va bpf +Allow +.Dv BIOCGSTATS +operation for statistics collection from a bpf device. .El .Pp A whitelist of permitted paths may be provided in
Re: Add quirks to support M-Audio FastTrack Pro (uaudio)
On 29/01/17(Sun) 14:45, Christopher Zimmermann wrote: > On 2017-01-29 Martin Pieuchotwrote: > > On 28/01/17(Sat) 13:02, Christopher Zimmermann wrote: > > > Hi, > > > > > > I needed to add some quirks to support the M-Audio FastTrack Pro USB > > > audio interface. > > > > Since this is just for one device there's no need for a quirk. Simply > > check for the device ID. > > You are talking about usb_subr.c? Done. No I'm not :) > > > * The device needs to be switched to the configuration 2 to show all > > > its capabilities. This is done by a new quirk in usb_subr.c > > > > Then do not match the first configuration in uaudio(4). > > I already tried that. It can be done, but then the umidi driver needs > changes, too, because it would otherwise claim the device in > configuration 0. > Should I do it this way without touching usb_subr.c? Yes please, do not touch usb_subr.c. > Here's an updated diff which changes configuration explicitely in > usb_subr.c and doesn't touch umidi.c. Also make sure your comment below respect style(9). > > > Christopher > > > Index: uaudio.c > === > RCS file: /cvs/src/sys/dev/usb/uaudio.c,v > retrieving revision 1.122 > diff -u -p -r1.122 uaudio.c > --- uaudio.c 3 Jan 2017 06:45:58 - 1.122 > +++ uaudio.c 29 Jan 2017 13:40:36 - > @@ -172,6 +172,7 @@ struct chan { > #define UAUDIO_FLAG_VENDOR_CLASS 0x0010 /* claims vendor class but > works */ > #define UAUDIO_FLAG_DEPENDENT 0x0020 /* play and record params must > equal */ > #define UAUDIO_FLAG_EMU0202 0x0040 > +#define UAUDIO_FLAG_BE0x0080 > > struct uaudio_devs { > struct usb_devno uv_dev; > @@ -223,7 +224,9 @@ struct uaudio_devs { > { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMZOOM }, > UAUDIO_FLAG_BAD_AUDIO }, > { { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1 }, > - UAUDIO_FLAG_NO_FRAC } > + UAUDIO_FLAG_NO_FRAC }, > + { { USB_VENDOR_MAUDIO, USB_PRODUCT_MAUDIO_FASTTRACKPRO }, > + UAUDIO_FLAG_BE | UAUDIO_FLAG_DEPENDENT } > }; > #define uaudio_lookup(v, p) \ > ((struct uaudio_devs *)usb_lookup(uaudio_devs, v, p)) > @@ -531,8 +534,19 @@ uaudio_attach(struct device *parent, str > found = 1; > } > } > - if (found) > + if (found) { > usbd_claim_iface(sc->sc_udev, i); > + if (uaa->vendor == USB_VENDOR_MAUDIO && > + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO) { > + /* temporarily switch every iface to 24bit. > + * Causes the device to be big endian even > + * for 16bit samples. > + * using 16bits first will cause the device > + * to break when we later switch to 24bit. */ > + usbd_set_interface(sc->sc_alts[i].ifaceh, 2); > + usbd_set_interface(sc->sc_alts[i].ifaceh, 0); > + } > + } > } > > for (j = 0; j < sc->sc_nalts; j++) { > @@ -1662,7 +1676,10 @@ uaudio_process_as(struct uaudio_softc *s > } else if (prec == 24) { > sc->sc_altflags |= HAS_24; > } > - enc = AUDIO_ENCODING_SLINEAR_LE; > + if (sc->sc_quirks & UAUDIO_FLAG_BE) > + enc = AUDIO_ENCODING_SLINEAR_BE; > + else > + enc = AUDIO_ENCODING_SLINEAR_LE; > format_str = "pcm"; > break; > case UA_FMT_PCM8: > @@ -1687,9 +1704,13 @@ uaudio_process_as(struct uaudio_softc *s > return (USBD_NORMAL_COMPLETION); > } > #ifdef UAUDIO_DEBUG > - printf("%s: %s: %d-ch %d-bit %d-byte %s,", sc->sc_dev.dv_xname, > + printf("%s: %s: alt %d(%d) for interface %d %d-ch %d-bit %d-byte %s enc > %d,", > +sc->sc_dev.dv_xname, > dir == UE_DIR_IN ? "recording" : "playback", > -chan, prec, bps, format_str); > +id->bAlternateSetting, > +sc->sc_nalts, > +id->bInterfaceNumber, > +chan, prec, bps, format_str, enc); > if (asf1d->bSamFreqType == UA_SAMP_CONTNUOUS) { > printf(" %d-%dHz\n", UA_SAMP_LO(asf1d), UA_SAMP_HI(asf1d)); > } else { > @@ -3312,6 +,9 @@ uaudio_set_params(void *addr, int setmod > } > break; > } > + > + if (sc->sc_quirks & UAUDIO_FLAG_BE) > + p->encoding = AUDIO_ENCODING_SLINEAR_BE; > > i = uaudio_match_alt(sc, p, mode); > if (i < 0) { > Index: usb_subr.c > === > RCS
Re: Sync sys/videoio.h with recent Linux kernel
On 28/01/17(Sat) 11:55, Ingo Feinerer wrote: > Hi, > > in a previous commit > (http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/videoio.h?rev=1.12=text/x-cvsweb-markup) > we updated our V4L2 API. However, one file (v4l2-common.h) could not be > inlined as it was only GPL2 licensed. > > After discussion with the authors they agreed to dual license (GPL + BSD) this > file as well > (https://git.linuxtv.org/media_tree.git/commit/?id=80100fd9ebb9f2414892a1178d26a4253e6c0bcf) > which allows us to fully comply with the V4L2 API. The attached diff > implements this and syncs with videodev2.h from the Linux kernel version > 4.10-rc5 at the same time > (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/videodev2.h?id=refs/tags/v4.10-rc5). > > (The sync with a recent Linux videodev2.h is a prerequisite for updating the > port multimedia/libv4l to 1.12.2.) > > I compiled a current kernel on amd64. My camera still works fine (tested with > luvcview and baresip in combination with libv4l 1.12.2). > > OK? This needs to go in a bulk since most users of this API are ports. > > Best regards, > Ingo > > Index: sys/sys/videoio.h > === > RCS file: /cvs/src/sys/sys/videoio.h,v > retrieving revision 1.14 > diff -u -p -r1.14 videoio.h > --- sys/sys/videoio.h 27 Jan 2016 13:07:09 - 1.14 > +++ sys/sys/videoio.h 28 Jan 2017 10:45:55 - > @@ -3,6 +3,8 @@ > * Video for Linux Two header file > * > * Copyright (C) 1999-2012 the contributors > + * Copyright (C) 2012 Nokia Corporation > + * Contact: Sakari Ailus> * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by > @@ -47,7 +49,7 @@ > * All kernel-specific stuff were moved to media/v4l2-dev.h, so > * no #if __KERNEL tests are allowed here > * > - * See http://linuxtv.org for more info > + * See https://linuxtv.org for more info > * > * Author: Bill Dirks > * Justin Schoeman > @@ -60,8 +62,84 @@ > #include > #include > #include > -/* Ignore #include as it is GPL2. > - * Inline #include > +#ifndef __u8 > +typedef u_int8_t __u8; > +#endif > +#ifndef __u16 > +typedef u_int16_t __u16; > +#endif > +#ifndef __u32 > +typedef u_int32_t __u32; > +#endif > +#ifndef __u64 > +typedef u_int64_t __u64; > +#endif > +#ifndef __s32 > +typedef int32_t __s32; > +#endif > +#ifndef __s64 > +typedef int64_t __s64; > +#endif > +#ifndef __le32 > +typedef __u32 __le32; > +#endif > +/* Inline #include > + * (v4l2-common.h was split off from videodev2.h and has the same BSD > license.) > + * > + * Begin of v4l2-common.h > + */ > +/* > + * > + * Selection interface definitions > + * > + */ > + > +/* Current cropping area */ > +#define V4L2_SEL_TGT_CROP0x > +/* Default cropping area */ > +#define V4L2_SEL_TGT_CROP_DEFAULT0x0001 > +/* Cropping bounds */ > +#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 > +/* Native frame size */ > +#define V4L2_SEL_TGT_NATIVE_SIZE 0x0003 > +/* Current composing area */ > +#define V4L2_SEL_TGT_COMPOSE 0x0100 > +/* Default composing area */ > +#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 > +/* Composing bounds */ > +#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 > +/* Current composing area plus all padding pixels */ > +#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 > + > +/* Backward compatibility target definitions --- to be removed. */ > +#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP > +#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE > +#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP > +#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE > +#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS > +#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS > + > +/* Selection flags */ > +#define V4L2_SEL_FLAG_GE (1 << 0) > +#define V4L2_SEL_FLAG_LE (1 << 1) > +#define V4L2_SEL_FLAG_KEEP_CONFIG(1 << 2) > + > +/* Backward compatibility flag definitions --- to be removed. */ > +#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE > +#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE > +#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG > + > +struct v4l2_edid { > + __u32 pad; > + __u32 start_block; > + __u32 blocks; > + __u32 reserved[5]; > + __u8 *edid; > +}; > +/* > + * End of v4l2-common.h > + */ > +/* Inline #include > * (v4l2-controls.h was split off from videodev2.h and has the same BSD > license.) > * > * Begin of v4l2-controls.h > @@ -175,8 +253,10 @@ enum v4l2_colorfx { > * We reserve 16 controls for this driver. */ > #define V4L2_CID_USER_S2255_BASE (V4L2_CID_USER_BASE + 0x1030) > > -/* The base for the si476x driver controls. See include/media/si476x.h for > the list > -
Re: Add quirks to support M-Audio FastTrack Pro (uaudio)
On 28/01/17(Sat) 13:02, Christopher Zimmermann wrote: > Hi, > > I needed to add some quirks to support the M-Audio FastTrack Pro USB > audio interface. Since this is just for one device there's no need for a quirk. Simply check for the device ID. > > * The device needs to be switched to the configuration 2 to show all > its capabilities. This is done by a new quirk in usb_subr.c Then do not match the first configuration in uaudio(4). > * It claims to consume little-endian samples, but actually expects > big-endian samples. > > > OK? > > Christopher > > > Index: uaudio.c > === > RCS file: /cvs/src/sys/dev/usb/uaudio.c,v > retrieving revision 1.122 > diff -u -p -r1.122 uaudio.c > --- uaudio.c 3 Jan 2017 06:45:58 - 1.122 > +++ uaudio.c 28 Jan 2017 11:53:17 - > @@ -172,6 +172,7 @@ struct chan { > #define UAUDIO_FLAG_VENDOR_CLASS 0x0010 /* claims vendor class but > works */ > #define UAUDIO_FLAG_DEPENDENT 0x0020 /* play and record params must > equal */ > #define UAUDIO_FLAG_EMU0202 0x0040 > +#define UAUDIO_FLAG_FASTTRACKPRO 0x0080 > > struct uaudio_devs { > struct usb_devno uv_dev; > @@ -223,7 +224,9 @@ struct uaudio_devs { > { { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMZOOM }, > UAUDIO_FLAG_BAD_AUDIO }, > { { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1 }, > - UAUDIO_FLAG_NO_FRAC } > + UAUDIO_FLAG_NO_FRAC }, > + { { USB_VENDOR_MIDIMAN, USB_PRODUCT_MIDIMAN_FASTTRACKPRO }, > + UAUDIO_FLAG_FASTTRACKPRO | UAUDIO_FLAG_DEPENDENT } > }; > #define uaudio_lookup(v, p) \ > ((struct uaudio_devs *)usb_lookup(uaudio_devs, v, p)) > @@ -531,8 +534,18 @@ uaudio_attach(struct device *parent, str > found = 1; > } > } > - if (found) > + if (found) { > usbd_claim_iface(sc->sc_udev, i); > + if (sc->sc_quirks & UAUDIO_FLAG_FASTTRACKPRO) { > + /* temporarily switch every iface to 24bit. > + * Causes the device to be big endian even > + * for 16bit samples. > + * using 16bits first will cause the device > + * to break when we later switch to 24bit. */ > + usbd_set_interface(sc->sc_alts[i].ifaceh, 2); > + usbd_set_interface(sc->sc_alts[i].ifaceh, 0); > + } > + } > } > > for (j = 0; j < sc->sc_nalts; j++) { > @@ -1662,7 +1675,10 @@ uaudio_process_as(struct uaudio_softc *s > } else if (prec == 24) { > sc->sc_altflags |= HAS_24; > } > - enc = AUDIO_ENCODING_SLINEAR_LE; > + if (sc->sc_quirks & UAUDIO_FLAG_FASTTRACKPRO) > + enc = AUDIO_ENCODING_SLINEAR_BE; > + else > + enc = AUDIO_ENCODING_SLINEAR_LE; > format_str = "pcm"; > break; > case UA_FMT_PCM8: > @@ -1687,9 +1703,13 @@ uaudio_process_as(struct uaudio_softc *s > return (USBD_NORMAL_COMPLETION); > } > #ifdef UAUDIO_DEBUG > - printf("%s: %s: %d-ch %d-bit %d-byte %s,", sc->sc_dev.dv_xname, > + printf("%s: %s: alt %d(%d) for interface %d %d-ch %d-bit %d-byte %s enc > %d,", > +sc->sc_dev.dv_xname, > dir == UE_DIR_IN ? "recording" : "playback", > -chan, prec, bps, format_str); > +id->bAlternateSetting, > +sc->sc_nalts, > +id->bInterfaceNumber, > +chan, prec, bps, format_str, enc); > if (asf1d->bSamFreqType == UA_SAMP_CONTNUOUS) { > printf(" %d-%dHz\n", UA_SAMP_LO(asf1d), UA_SAMP_HI(asf1d)); > } else { > @@ -3312,6 +3332,9 @@ uaudio_set_params(void *addr, int setmod > } > break; > } > + > + if (sc->sc_quirks & UAUDIO_FLAG_FASTTRACKPRO) > + p->encoding = AUDIO_ENCODING_SLINEAR_BE; > > i = uaudio_match_alt(sc, p, mode); > if (i < 0) { > Index: usb_quirks.c > === > RCS file: /cvs/src/sys/dev/usb/usb_quirks.c,v > retrieving revision 1.74 > diff -u -p -r1.74 usb_quirks.c > --- usb_quirks.c 27 Nov 2015 10:59:32 - 1.74 > +++ usb_quirks.c 28 Jan 2017 11:53:17 - > @@ -67,6 +67,8 @@ const struct usbd_quirk_entry { > 0x001, { UQ_ASSUME_CM_OVER_DATA }}, > { USB_VENDOR_EICON, USB_PRODUCT_EICON_DIVA852, > 0x100, { UQ_ASSUME_CM_OVER_DATA }}, > + { USB_VENDOR_MIDIMAN, USB_PRODUCT_MIDIMAN_FASTTRACKPRO, > + 0x100, { 1 << UQ_CONFIG_SHIFT }}, > /* YAMAHA router's ucdDevice is the version of firmware and often
Re: iwm(4): Update struct iwm_scan_results_notif. Remove a few old defines.
On Mon, Jan 16, 2017 at 05:26:05PM +0100, Imre Vadász wrote: > Hi, > This patch updates the struct iwm_scan_results_notif to FW Api version 3, > and removes the unused enum iwm_scan_complete_status status codes, as well > as the deprecated/unused struct iwm_scan_complete_notif. > > This corresponds to the Linux iwlwifi commits > 1083fd7391e989be52022f0f338e9dadc048b063 and > 75118fdb63496e4611ab50380499ddd62b9de69f. > No functional change, since struct iwm_scan_results_notif isn't accessed > in iwm at the moment. This patch does not apply cleanly. I applied your patches in the order they arrived in my inbox, so perhaps they're out of order. Patching file if_iwmreg.h using Plan A... Hunk #1 succeeded at 4864 with fuzz 2 (offset -137 lines). Hunk #2 failed at 4879. 1 out of 2 hunks failed--saving rejects to if_iwmreg.h.rej Hmm... Ignoring the trailing garbage. Can you make a fresh patch against -current? I have committed all other diffs you sent. Thanks! > Index: sys/dev/pci/if_iwmreg.h > === > RCS file: /cvs/src/sys/dev/pci/if_iwmreg.h,v > retrieving revision 1.21 > diff -u -r1.21 if_iwmreg.h > --- sys/dev/pci/if_iwmreg.h 10 Dec 2016 19:03:53 - 1.21 > +++ sys/dev/pci/if_iwmreg.h 16 Jan 2017 16:23:01 - > @@ -5001,48 +5001,14 @@ > #define IWM_SCAN_PROBE_STATUS_FAIL_TTL (1 << 1) > #define IWM_SCAN_PROBE_STATUS_FAIL_BT(1 << 2) > > -/* How many statistics are gathered for each channel */ > -#define IWM_SCAN_RESULTS_STATISTICS 1 > - > /** > - * status codes for scan complete notifications > - * @IWM_SCAN_COMP_STATUS_OK: scan completed successfully > - * @IWM_SCAN_COMP_STATUS_ABORT: scan was aborted by user > - * @IWM_SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed > - * @IWM_SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready > - * @IWM_SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed > - * @IWM_SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed > - * @IWM_SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan > command > - * @IWM_SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort > - * @IWM_SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax > - * @IWM_SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was > successful > - * (not an error!) > - * @IWM_SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the > driver > - * asked for > - * @IWM_SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events > -*/ > -#define IWM_SCAN_COMP_STATUS_OK 0x1 > -#define IWM_SCAN_COMP_STATUS_ABORT 0x2 > -#define IWM_SCAN_COMP_STATUS_ERR_SLEEP 0x3 > -#define IWM_SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT0x4 > -#define IWM_SCAN_COMP_STATUS_ERR_PROBE 0x5 > -#define IWM_SCAN_COMP_STATUS_ERR_WAKEUP 0x6 > -#define IWM_SCAN_COMP_STATUS_ERR_ANTENNAS0x7 > -#define IWM_SCAN_COMP_STATUS_ERR_INTERNAL0x8 > -#define IWM_SCAN_COMP_STATUS_ERR_COEX0x9 > -#define IWM_SCAN_COMP_STATUS_P2P_ACTION_OK 0xA > -#define IWM_SCAN_COMP_STATUS_ITERATION_END 0x0B > -#define IWM_SCAN_COMP_STATUS_ERR_ALLOC_TE0x0C > - > -/** > - * struct iwm_scan_results_notif - scan results for one channel > - * ( IWM_SCAN_RESULTS_NOTIFICATION = 0x83 ) > + * struct iwm_scan_results_notif - scan results for one channel - > + * SCAN_RESULT_NTF_API_S_VER_3 > * @channel: which channel the results are from > * @band: 0 for 5.2 GHz, 1 for 2.4 GHz > * @probe_status: IWM_SCAN_PROBE_STATUS_*, indicates success of probe request > * @num_probe_not_sent: # of request that weren't sent due to not enough time > * @duration: duration spent in channel, in usecs > - * @statistics: statistics gathered for this channel > */ > struct iwm_scan_results_notif { > uint8_t channel; > @@ -5050,29 +5016,7 @@ > uint8_t probe_status; > uint8_t num_probe_not_sent; > uint32_t duration; > - uint32_t statistics[IWM_SCAN_RESULTS_STATISTICS]; > -} __packed; /* IWM_SCAN_RESULT_NTF_API_S_VER_2 */ > - > -/** > - * struct iwm_scan_complete_notif - notifies end of scanning (all channels) > - * ( IWM_SCAN_COMPLETE_NOTIFICATION = 0x84 ) > - * @scanned_channels: number of channels scanned (and number of valid > results) > - * @status: one of IWM_SCAN_COMP_STATUS_* > - * @bt_status: BT on/off status > - * @last_channel: last channel that was scanned > - * @tsf_low: TSF timer (lower half) in usecs > - * @tsf_high: TSF timer (higher half) in usecs > - * @results: all scan results, only "scanned_channels" of them are valid > - */ > -struct iwm_scan_complete_notif { > - uint8_t scanned_channels; > - uint8_t status; > - uint8_t bt_status; > - uint8_t last_channel; > - uint32_t tsf_low; > - uint32_t tsf_high; > - struct iwm_scan_results_notif results[IWM_MAX_NUM_SCAN_CHANNELS]; > -} __packed; /* IWM_SCAN_COMPLETE_NTF_API_S_VER_2 */ > +}
Re: 11n support for athn(4)
On Sun, Jan 29, 2017 at 07:49:56AM +0200, Timo Myyrä wrote: > Hmm, I've been running the 11n for a while and it seems to be a lot slower > than > 11g for me. Just did quick benchmark using tcpbench between OpenBSD hostAP > (athn) and > laptop (iwn). It looks when my athn is in 11n mode I get around ~3 Mbps: Which direction did you measure? Client->AP or AP->Client? Have you measured both directions? I expect client->AP to be faster if a non-OpenBSD client is used. Such clients will likely use Tx aggregation. But OpenBSD does not (yet). > Quickly looking it seems the 11g is 3x faster than 11n which seems a bit odd. > I'd assume they should be roughly the same. > > Any idea what could explain the difference? It might be due to RTS/CTS. https://en.wikipedia.org/wiki/IEEE_802.11_RTS/CTS Without TX aggregation, RTS/CTS causes up to 77% overhead on a 20MHz channel and a 1500 byte MTU. See Figure 10 in http://www.nle.com/literature/Airmagnet_impact_of_legacy_devices_on_80211n.pdf Perhaps this overhead is making the difference? You could take a look at what is happening at the wifi frame layer and compare 11n and 11g. To do so, get an iwn(4) device and put it in monitor mode on the same channel, and use tcpdump's -y IEEE802_11_RADIO option. This will show control frames such as rts/cts (but only with iwn(4) because most other drivers unfortunately filter these frames). You'll see RTS/CTS being exchanged for every frame with an OpenBSD 11n hostap. This is because OpenBSD 11n hostap forces "HT protection" on. This forces clients (and the AP) to reserve the medium with an RTS frame before sending a data frame to avoid collisions from legacy 11a/b/g clients. This is the simplest way of being standard compliant in any environment. HT protection could be switched off if only 11n clients exist on the channel (not just on the same AP), and with good commercial APs you'll see this behaviour. But OpenBSD's wifi stack does not yet monitor the channel in a way that allows a decision to be made about turning HT protection off. In any case, this will likely get better once OpenBSD supports Tx aggregation. Then it will send multiple frames after reserving the medium with RTS/CTS and the overhead is reduced. > There are 8 other wireless networks in range but all of those are on > different channels. Are they on overlapping channels? See here for a good illustration: https://en.wikipedia.org/wiki/IEEE_802.11#/media/File:2.4_GHz_Wi-Fi_channels_(802.11b,g_WLAN).svg If no other networks overlap, or all other networks use 11n only, then you don't need HT protection. The crude patch below should disable it and might make 11n and 11g perform equally in your environment. Obviously this patch is not a real fix and I don't intend to commit it. Index: ieee80211_node.c === RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v retrieving revision 1.112 diff -u -p -r1.112 ieee80211_node.c --- ieee80211_node.c16 Jan 2017 09:35:43 - 1.112 +++ ieee80211_node.c29 Jan 2017 08:37:47 - @@ -364,8 +364,12 @@ ieee80211_create_ibss(struct ieee80211co * beacons from other networks) which proves that only HT * STAs are on the air. */ +#if 0 ni->ni_htop1 = IEEE80211_HTPROT_NONMEMBER; ic->ic_protmode = IEEE80211_PROT_RTSCTS; +#else + ni->ni_htop1 = IEEE80211_HTPROT_NONE; +#endif /* Configure QoS EDCA parameters. */ for (aci = 0; aci < EDCA_NUM_AC; aci++) { @@ -1476,9 +1480,11 @@ ieee80211_node_join_ht(struct ieee80211c /* Update HT protection setting. */ if ((ni->ni_flags & IEEE80211_NODE_HT) == 0) { ic->ic_nonhtsta++; +#if 0 ic->ic_bss->ni_htop1 = IEEE80211_HTPROT_NONHT_MIXED; if (ic->ic_update_htprot) ic->ic_update_htprot(ic, ic->ic_bss); +#endif } } @@ -1776,9 +1782,11 @@ ieee80211_node_leave(struct ieee80211com panic("bogus non-HT station count %d", ic->ic_nonhtsta); if (--ic->ic_nonhtsta == 0) { /* All associated stations now support HT. */ +#if 0 ic->ic_bss->ni_htop1 = IEEE80211_HTPROT_NONMEMBER; if (ic->ic_update_htprot) ic->ic_update_htprot(ic, ic->ic_bss); +#endif } }