Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2219526rwd; Fri, 19 May 2023 02:39:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65yWVGqD/e5d85gSSdiPHzhf1G4UwlMmL9j9V2sTjqniKqaO0UP2KVIVJ40z44GZjda/Tt X-Received: by 2002:a17:902:f2cc:b0:1aa:fbaa:ee09 with SMTP id h12-20020a170902f2cc00b001aafbaaee09mr1574338plc.49.1684489154455; Fri, 19 May 2023 02:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684489154; cv=none; d=google.com; s=arc-20160816; b=s3Xy4tUB7mFRlUPVdAvc+6W63IqvGDmP/KTZihrFKV+oCKVjI1FTF49RkDknPsyn+X /2pH8MEMrrXOJv7qerDvt32w0UhVeYv9iR0Ch0rE8V+2YysL4xFLm39nhEGh7q5TUzMq TffQgIrVSHCdHHwIU+2uwt/Loorl0w/MOAN2wkWIq3cc1SyVRgGIzVcOYnYELallQEoS /T/+62Lk1M1NLMPQ6pI0NnOyTDWeQNzFGX+9HEHmVs82cdcTHm07AkbDo/4mL//0aX1H R4broiaIJFUWcBKNxcuLnkSXIbCtws+BzvDsnyhk5qjt81JBPUXJtWBd46jRxH5km97f cM9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=dimxiJwwtH3lX8qyHAdRD71WhexQ0+riv3hHhd98nB4=; b=cfxMG01I9juzxhfaPHuVLJRu7z2EoEe5Iz0R4E5ydEwPcLt2uBLT+zN5OixEHXugPi T6EqMuRZ5SD2u9Zrlki+KSmS1MhXFcK7BIkHFNdUbVxwYbqWapdvAK2tZmqJJvFv71uk oUGlWvPPbx/qbzYpINK4I6xDK128TanDBltIVDrlWaWzFALPiQwrIJl1l0X40lpl7CSA EemaopKGPvF599n5L9o4rxIRGHFHncL3bE4eCtNZEdEHDKfbheE8gdkyZOXUE3O4qt7x omm5r8FwrJC+PaXyNvze7f99S7TeD+Q23p2qkjFDoBd9SaWGOulPYtjFSfTZftsLdEzI a4aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vavSz7Dg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=OkI7tgbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz11-20020a170902ef8b00b001a64e7b702fsi2969920plb.447.2023.05.19.02.39.02; Fri, 19 May 2023 02:39:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vavSz7Dg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=OkI7tgbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbjESJcV (ORCPT + 99 others); Fri, 19 May 2023 05:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbjESJbm (ORCPT ); Fri, 19 May 2023 05:31:42 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 967F3E47 for ; Fri, 19 May 2023 02:31:40 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2F5BE222AD; Fri, 19 May 2023 09:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684488699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dimxiJwwtH3lX8qyHAdRD71WhexQ0+riv3hHhd98nB4=; b=vavSz7DgPDBtdH/do9LPB5JxEPPUyZWjMm5xYjkd0AfvZ2v2/2bpVC8ieQOTKwd99jLQBX bdT9J3ph7PpN7FPu+YncrX4VecLspUt7M9Z9x45u9W4mjWodoHvSzykJTbrBSKGbx0x5fh z1QMYzFzLK/9E74OvOdERjr9Ab37SFk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684488699; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dimxiJwwtH3lX8qyHAdRD71WhexQ0+riv3hHhd98nB4=; b=OkI7tgbEDRuHGqE/y5K774J9uPkVDuirJJLXSu2CHCTMEIplOJip1WQQyj0rfkCfdk8kie SaV6ibIy6AnESMDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0FE8513A12; Fri, 19 May 2023 09:31:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sOcPA/tBZ2RXJAAAMHmgww (envelope-from ); Fri, 19 May 2023 09:31:39 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 15/36] ALSA: usb-audio: Inform inconsistent protocols in GTBs Date: Fri, 19 May 2023 11:30:53 +0200 Message-Id: <20230519093114.28813-16-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230519093114.28813-1-tiwai@suse.de> References: <20230519093114.28813-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When parsing Group Terminal Blocks, we overwrote the preferred protocol and the protocol capabilities silently from the last parsed GTB. This patch adds the information print indicating the unexpected overrides instead of silent action. Signed-off-by: Takashi Iwai --- sound/usb/midi2.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c index f005de9f9b8a..14f023b4b414 100644 --- a/sound/usb/midi2.c +++ b/sound/usb/midi2.c @@ -581,6 +581,7 @@ static int parse_group_terminal_block(struct snd_usb_midi2_ump *rmidi, const struct usb_ms20_gr_trm_block_descriptor *desc) { struct snd_ump_endpoint *ump = rmidi->ump; + unsigned int protocol, protocol_caps; /* set default protocol */ switch (desc->bMIDIProtocol) { @@ -588,24 +589,40 @@ static int parse_group_terminal_block(struct snd_usb_midi2_ump *rmidi, case USB_MS_MIDI_PROTO_1_0_64_JRTS: case USB_MS_MIDI_PROTO_1_0_128: case USB_MS_MIDI_PROTO_1_0_128_JRTS: - ump->info.protocol = SNDRV_UMP_EP_INFO_PROTO_MIDI1; + protocol = SNDRV_UMP_EP_INFO_PROTO_MIDI1; break; case USB_MS_MIDI_PROTO_2_0: case USB_MS_MIDI_PROTO_2_0_JRTS: - ump->info.protocol = SNDRV_UMP_EP_INFO_PROTO_MIDI2; + protocol = SNDRV_UMP_EP_INFO_PROTO_MIDI2; break; + default: + return 0; } - ump->info.protocol_caps = ump->info.protocol; + if (ump->info.protocol && ump->info.protocol != protocol) + usb_audio_info(rmidi->umidi->chip, + "Overriding preferred MIDI protocol in GTB %d: %x -> %x\n", + rmidi->usb_block_id, ump->info.protocol, + protocol); + ump->info.protocol = protocol; + + protocol_caps = protocol; switch (desc->bMIDIProtocol) { case USB_MS_MIDI_PROTO_1_0_64_JRTS: case USB_MS_MIDI_PROTO_1_0_128_JRTS: case USB_MS_MIDI_PROTO_2_0_JRTS: - ump->info.protocol_caps |= SNDRV_UMP_EP_INFO_PROTO_JRTS_TX | + protocol_caps |= SNDRV_UMP_EP_INFO_PROTO_JRTS_TX | SNDRV_UMP_EP_INFO_PROTO_JRTS_RX; break; } + if (ump->info.protocol_caps && ump->info.protocol_caps != protocol_caps) + usb_audio_info(rmidi->umidi->chip, + "Overriding MIDI protocol caps in GTB %d: %x -> %x\n", + rmidi->usb_block_id, ump->info.protocol_caps, + protocol_caps); + ump->info.protocol_caps = protocol_caps; + return 0; } -- 2.35.3