Re: usb/160299: commit references a PR
The following reply was made to PR usb/160299; it has been noted by GNATS. From: dfil...@freebsd.org (dfilter service) To: bug-follo...@freebsd.org Cc: Subject: Re: usb/160299: commit references a PR Date: Sat, 10 Sep 2011 15:55:46 + (UTC) Author: hselasky Date: Sat Sep 10 15:55:36 2011 New Revision: 225469 URL: http://svn.freebsd.org/changeset/base/225469 Log: Refactor auto-quirk solution so that we break as few external drivers as possible. PR: usb/160299 Approved by: re (kib) Suggested by:rwatson MFC after: 0 days Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_dynamic.c head/sys/dev/usb/usb_dynamic.h head/sys/dev/usb/usbdi.h head/sys/sys/param.h Modified: head/sys/dev/usb/quirk/usb_quirk.c == --- head/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 15:55:36 2011 (r225469) @@ -588,7 +588,7 @@ usb_test_quirk_by_info(const struct usbd } mtx_unlock(usb_quirk_mtx); done: - return (usb_test_quirk_w(info, quirk)); + return (0); /* no quirk match */ } static struct usb_quirk_entry * Modified: head/sys/dev/usb/usb_device.c == --- head/sys/dev/usb/usb_device.c Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usb_device.c Sat Sep 10 15:55:36 2011 (r225469) @@ -1239,8 +1239,6 @@ static void usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - uint8_t x; - memset(uaa, 0, sizeof(*uaa)); uaa-device = udev; @@ -1256,9 +1254,6 @@ usb_init_attach_arg(struct usb_device *u uaa-info.bDeviceProtocol = udev-ddesc.bDeviceProtocol; uaa-info.bConfigIndex = udev-curr_config_index; uaa-info.bConfigNum = udev-curr_config_no; - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) - uaa-info.autoQuirk[x] = udev-autoQuirk[x]; } /** @@ -2389,8 +2384,22 @@ uint8_t usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa-device-autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ found = (usb_test_quirk_p) (uaa-info, quirk); + return (found); } @@ -2723,7 +2732,8 @@ usbd_add_dynamic_quirk(struct usb_device uint8_t x; for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (udev-autoQuirk[x] == 0) { + if (udev-autoQuirk[x] == 0 || + udev-autoQuirk[x] == quirk) { udev-autoQuirk[x] = quirk; return (0); /* success */ } Modified: head/sys/dev/usb/usb_dynamic.c == --- head/sys/dev/usb/usb_dynamic.c Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usb_dynamic.c Sat Sep 10 15:55:36 2011 (r225469) @@ -50,12 +50,12 @@ #include dev/usb/usb_process.h #include dev/usb/usb_device.h #include dev/usb/usb_dynamic.h -#include dev/usb/quirk/usb_quirk.h /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; +static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,19 +72,9 @@ usb_temp_setup_by_index_w(struct usb_dev return (USB_ERR_INVAL); } -uint8_t +static uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { - uint8_t x; - - if (quirk == UQ_NONE) - return (0); /* no match */ - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (info-autoQuirk[x] == quirk) - return (1); /* match */ - } - return (0); /* no match */ } Modified: head/sys/dev/usb/usb_dynamic.h == --- head/sys/dev/usb/usb_dynamic.h Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usb_dynamic.h Sat Sep 10 15:55:36 2011 (r225469) @@ -57,6 +57,5 @@ extern devclass_t usb_devclass_ptr; void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); -usb_test_quirk_t
Re: usb/160299: commit references a PR
The following reply was made to PR usb/160299; it has been noted by GNATS. From: dfil...@freebsd.org (dfilter service) To: bug-follo...@freebsd.org Cc: Subject: Re: usb/160299: commit references a PR Date: Sat, 10 Sep 2011 16:52:30 + (UTC) Author: hselasky Date: Sat Sep 10 16:52:15 2011 New Revision: 225470 URL: http://svn.freebsd.org/changeset/base/225470 Log: MFC r225469: Refactor auto-quirk solution so that we break as few external drivers as possible. PR: usb/160299 Suggested by:rwatson Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_dynamic.c stable/8/sys/dev/usb/usb_dynamic.h stable/8/sys/dev/usb/usbdi.h stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c == --- stable/8/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 16:52:15 2011 (r225470) @@ -588,7 +588,7 @@ usb_test_quirk_by_info(const struct usbd } mtx_unlock(usb_quirk_mtx); done: - return (usb_test_quirk_w(info, quirk)); + return (0); /* no quirk match */ } static struct usb_quirk_entry * Modified: stable/8/sys/dev/usb/usb_device.c == --- stable/8/sys/dev/usb/usb_device.c Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_device.c Sat Sep 10 16:52:15 2011 (r225470) @@ -1239,8 +1239,6 @@ static void usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - uint8_t x; - memset(uaa, 0, sizeof(*uaa)); uaa-device = udev; @@ -1256,9 +1254,6 @@ usb_init_attach_arg(struct usb_device *u uaa-info.bDeviceProtocol = udev-ddesc.bDeviceProtocol; uaa-info.bConfigIndex = udev-curr_config_index; uaa-info.bConfigNum = udev-curr_config_no; - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) - uaa-info.autoQuirk[x] = udev-autoQuirk[x]; } /** @@ -2389,8 +2384,22 @@ uint8_t usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa-device-autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ found = (usb_test_quirk_p) (uaa-info, quirk); + return (found); } @@ -2798,7 +2807,8 @@ usbd_add_dynamic_quirk(struct usb_device uint8_t x; for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (udev-autoQuirk[x] == 0) { + if (udev-autoQuirk[x] == 0 || + udev-autoQuirk[x] == quirk) { udev-autoQuirk[x] = quirk; return (0); /* success */ } Modified: stable/8/sys/dev/usb/usb_device.h == --- stable/8/sys/dev/usb/usb_device.h Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_device.h Sat Sep 10 16:52:15 2011 (r225470) @@ -149,7 +149,6 @@ struct usb_device { uint16_t power; /* mA the device uses */ uint16_t langid;/* language for strings */ - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address;/* device addess */ uint8_t device_index; /* device index in bus-devices */ @@ -191,6 +190,8 @@ struct usb_device { #endif uint32_t clear_stall_errors;/* number of clear-stall failures */ + + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ }; /* globals */ Modified: stable/8/sys/dev/usb/usb_dynamic.c == --- stable/8/sys/dev/usb/usb_dynamic.c Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_dynamic.c Sat Sep 10 16:52:15 2011 (r225470) @@ -50,12 +50,12 @@ #include dev/usb/usb_process.h #include dev/usb/usb_device.h #include dev/usb/usb_dynamic.h -#include dev/usb/quirk/usb_quirk.h /* function prototypes */ static usb_handle_req_t
[uaudio] Sound-recording too fast
Hello! I have a Logitech's webcam with built-in microphone. The audio device is recognized by FreeBSD-8-stable as: uaudio0: vendor 0x046d product 0x081b, class 239/2, rev 2.00/0.10, addr 2 on usbus2 uaudio0: No playback! uaudio0: Record: 48000 Hz, 1 ch, 16-bit S-LE PCM format uaudio0: No midi sequencer pcm1: USB audio on uaudio0 mixer(8) reports it a little strangely, depending on which /dev-entry I use: % mixer -f /dev/mixer1 Mixer vol is currently set to 75:75 Mixer pcm is currently set to 75:75 % mixer -f /dev/dsp1 Mixer rec is currently set to 45:45 But recording works. For example, using the rec-utility from the SoX package: % env AUDIODEV=/dev/dsp1 rec /tmp/test.aiff Input File : '/dev/dsp1' (ossdsp) Channels : 2 Sample Rate: 48000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM Well, it almost works, because the recording ends up highly distorted -- much faster, than what I'm really saying into microphone. About three times faster. For example, if I let the above command run for 18 seconds (according to time(1)), the created test.aiff will contain a 6-seconds recording. How do I fix this? Thanks! Yours, -mi ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org