From patchwork Sat May 31 22:41:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: GitHub issues - opened X-Patchwork-Id: 893578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00DC0C5B552 for ; Sat, 31 May 2025 22:42:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [45.14.194.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AE9DE6022F; Sun, 1 Jun 2025 00:42:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AE9DE6022F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1748731350; bh=R1lHCGST9MdtteCbLmCHl+L/QVmRvDYrCJqdy0W46Eo=; h=From:To:In-Reply-To:References:Subject:Date:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=cVx3WNlW9oNboXeay2SfbangALiWwL6jZ6q+vP3FW8EPWK0DlwdO9YMGJngNJNA8j QFt6uzl3Q3EoVjxrlH7X/MxaMeTbnPUC5IoaNcpdR/MKhmU6GjRx4SeKeBsR+zqzUG i/FO4jOdzTESLAqs5MaPQgDH+DtMJVxGnNToPDyc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 945E6F805C7; Sun, 1 Jun 2025 00:41:54 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 83A60F805C2; Sun, 1 Jun 2025 00:41:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AA4C8F8013D; Sun, 1 Jun 2025 00:41:51 +0200 (CEST) Received: from webhooks-bot.alsa-project.org (vmi2259423.contaboserver.net [45.14.194.44]) by alsa1.perex.cz (Postfix) with ESMTP id 0478CF8013D for ; Sun, 1 Jun 2025 00:41:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0478CF8013D MIME-Version: 1.0 From: GitHub issues - opened To: alsa-devel@alsa-project.org Message-Id: <1844bddc59f45200-webhooks-bot@alsa-project.org> In-Reply-To: <1844bddc596a4000-webhooks-bot@alsa-project.org> References: <1844bddc596a4000-webhooks-bot@alsa-project.org> Subject: aseqsend silently fails (ENODEV) with hardware port Date: Sun, 1 Jun 2025 00:41:51 +0200 (CEST) Message-ID-Hash: UC6LQBAFDUP3K7XSGBDHYXE3GD5WPDQU X-Message-ID-Hash: UC6LQBAFDUP3K7XSGBDHYXE3GD5WPDQU X-MailFrom: github@alsa-project.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: alsa-project/alsa-utils issue #300 was opened from michaelforney: When I use `aseqsend` to send a sysex message to a device, it doesn't seem to work, though there is no error message. Running with strace, it seems it is failing with ENODEV. ```sh $ strace aseqsend -p 32:0 'F0 43 7D 10 41 30 01 00 00 01 F7' ... open("/dev/snd/seq", O_WRONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 ioctl(3, SNDRV_SEQ_IOCTL_PVERSION, 0x7fffef1ae678) = 0 ioctl(3, SNDRV_SEQ_IOCTL_USER_PVERSION, 0x7fffef1ae67c) = 0 mmap(NULL, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ae25f7000 ioctl(3, SNDRV_SEQ_IOCTL_CLIENT_ID, 0x7fffef1ae67c) = 0 ioctl(3, SNDRV_SEQ_IOCTL_RUNNING_MODE, 0x7fffef1ae680) = 0 ioctl(3, SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, 0x7fffef1ae940) = 0 ioctl(3, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, 0x7fffef1ae940) = 0 ioctl(3, SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, 0x7fffef1ae940) = 0 ioctl(3, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, 0x7fffef1ae940) = 0 ioctl(3, SNDRV_SEQ_IOCTL_CREATE_PORT, 0x7fffef1ae960) = 0 write(3, "\202\4\0\375\0\0\0\0\0\0\0\0\0\0 \0\v\0\0\0\320\212WN\361U\0\0\360C}\20"..., 39) = -1 ENODEV (No such device) nanosleep({tv_sec=0, tv_nsec=1000000}, 0x7fffef1aea20) = 0 close(3) = 0 munmap(0x7f6ae25f7000, 20480) = 0 exit_group(0) = ? +++ exited with 0 +++ $ ``` `amidi -S ...` works as expected. If I modify `aseqsend` to first subscribe to the port, it seems to work: ```diff >From what I've read, I don't think it should be necessary to subscribe to a port to send it messages. However, I did find one sentence in the alsa-lib docs that seem to indicate that it is needed for hardware ports: > There is another subscription type for opposite direction: Suppose a MIDI sequencer program which sends events to a MIDI output device. In ALSA system, MIDI device is not opened until the associated MIDI port is accessed. Thus, in order to activate MIDI device, we have to subscribe to MIDI port for write. After this connection is established, events will be properly sent to MIDI output device. This seems to be a pretty basic use of `aseqsend`, so I am a bit surprised that it wasn't working. Is the subscription the right way to fix the problem, or am I doing something else wrong? Issue URL : https://github.com/alsa-project/alsa-utils/issues/300 Repository URL: https://github.com/alsa-project/alsa-utils diff --git a/seq/aseqsend/aseqsend.c b/seq/aseqsend/aseqsend.c index 92354eb..ad0a636 100644 --- a/seq/aseqsend/aseqsend.c +++ b/seq/aseqsend/aseqsend.c @@ -364,6 +364,7 @@ int main(int argc, char *argv[]) char do_port_list = 0; char verbose = 0; int k; + int err; while ((c = getopt_long(argc, argv, "hi:Vvlp:s:u:", long_options, NULL)) != -1) { switch (c) { @@ -439,6 +440,8 @@ int main(int argc, char *argv[]) error("Unable to parse port name!"); exit(EXIT_FAILURE); } + err = snd_seq_connect_to(seq, 0, addr.client, addr.port); + check_snd("connect to port", err); sent_data_c = 0; //counter of actually sent bytes ```