]> git.alsa-project.org Git - alsa-gobject.git/log
alsa-gobject.git
3 years agoctl: elem_info: use an utility macro to declare GObject-derived object
Takashi Sakamoto [Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)]
ctl: elem_info: use an utility macro to declare GObject-derived object

Since gobject v2.44, an utility macro is available to declare
GObject-derived objects.

This commit replaces existent boireplates with it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl: card_info: use an utility macro to declare GObject-derived object
Takashi Sakamoto [Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)]
ctl: card_info: use an utility macro to declare GObject-derived object

Since gobject v2.44, an utility macro is available to declare
GObject-derived objects.

This commit replaces existent boireplates with it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl: card: use an utility macro to declare GObject-derived object
Takashi Sakamoto [Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)]
ctl: card: use an utility macro to declare GObject-derived object

Since gobject v2.44, an utility macro is available to declare
GObject-derived objects.

This commit replaces existent boireplates with it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agotimer: device_params: fix type decration with private data
Takashi Sakamoto [Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)]
timer: device_params: fix type decration with private data

Fixes: 20cb2a1f111 ("timer: device_params: add properties")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoseq: enum: fix tab indentation
Takashi Sakamoto [Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)]
seq: enum: fix tab indentation

Fixes: 9a3d1477403b ("seq: user_client: report error for port access permission")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoall: minor code refactoring for inclusion guard
Takashi Sakamoto [Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)]
all: minor code refactoring for inclusion guard

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoutils: add utility macros to generate GError with file domain
Takashi Sakamoto [Sat, 2 Apr 2022 01:46:22 +0000 (10:46 +0900)]
utils: add utility macros to generate GError with file domain

It's convenient to add macro to generate GError with file domain since
failure of operation over sysfs is reported in the domain.

This commit adds such macro.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoutils: add utilities to request control ioctl
Takashi Sakamoto [Sat, 2 Apr 2022 01:46:22 +0000 (10:46 +0900)]
utils: add utilities to request control ioctl

In ALSA HwDep and RawMidi interface, some functions are implemented via
ALSA control character device.

This commit adds utility to perform ioctl in ALSA control character device
for the purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoutils: add utilitiy to generate list of sysnum by prefix of sysname
Takashi Sakamoto [Sat, 2 Apr 2022 01:46:22 +0000 (10:46 +0900)]
utils: add utilitiy to generate list of sysnum by prefix of sysname

It's typically used to generate the list of sysnum over sysfs by sysname
prefix.

This commit adds utility for it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoutils: add utilities to allocate string information for device
Takashi Sakamoto [Sat, 2 Apr 2022 01:46:22 +0000 (10:46 +0900)]
utils: add utilities to allocate string information for device

It's typically used to look for string information over sysfs according to
sysname.

This commit adds utilities for it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoutils: add utility to compute integer value from string literal
Takashi Sakamoto [Sat, 2 Apr 2022 01:46:22 +0000 (10:46 +0900)]
utils: add utility to compute integer value from string literal

The conversion between string literal and integer is required in some
includes libraries.

This commit adds utility for it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoutils: build internal static library including common utilities
Takashi Sakamoto [Sat, 2 Apr 2022 01:46:22 +0000 (10:46 +0900)]
utils: build internal static library including common utilities

Current implementation of included libraries includes duplicated codes
to operate over sysfs by libudev. It's inconvenient in a point of
maintenance.

This commit adds internal static library for such duplicate codes.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: move path to top header to metadata part
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
meson: move path to top header to metadata part

This commit refactors configuration related to top header for preprocessor
to reduce difference of each meson configuration.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: aggregate and move extra gir to metadata part
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
meson: aggregate and move extra gir to metadata part

This commit refactors duplicated entries for depended gir name to reduce
difference of each meson configuration.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: move pkg-config description to metadata part
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
meson: move pkg-config description to metadata part

This commit refactors description for pkg-config to reduce difference of
each meson configuration.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: fulfil missing sources for gir scanner which are blank
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
meson: fulfil missing sources for gir scanner which are blank

This commit refactors the list of sources for gir scanner to reduce
difference of each meson configuration.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: aggregate module imports
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
meson: aggregate module imports

This commit refactors to unify common module imports.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: aggregate dependency declaration on glib/gobject and libudev
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
meson: aggregate dependency declaration on glib/gobject and libudev

All of included libraries depend on glib, gobject, and libudev. It's
possible to aggregate declaration of the dependency.

This commit refactors according to it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agotimer: code refactoring for search path of alsatimer header
Takashi Sakamoto [Thu, 31 Mar 2022 02:04:40 +0000 (11:04 +0900)]
timer: code refactoring for search path of alsatimer header

Current implementation uses several entries for include_directories
parameter of library function. It's possible to replace it by using
include_directories parameter of declare_dependency function.

This commit refactors meson configuration for alsatimer library according
to it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: fix unintended line break for identifier
Takashi Sakamoto [Thu, 31 Mar 2022 01:58:28 +0000 (10:58 +0900)]
meson: fix unintended line break for identifier

Fixes: ac7c096dae15 ("meson: code refactoring to remove useless assignments for include headers")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agorawmidi: fix argument names with suffix '_id'
Takashi Sakamoto [Thu, 31 Mar 2022 01:58:28 +0000 (10:58 +0900)]
rawmidi: fix argument names with suffix '_id'

According to the convention in this project.

Fixes: 55f796b5ad33 ("rawmidi: add global method to get list of directional subdevices for rawmidi device")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agodoc: install HTML file for index page
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
doc: install HTML file for index page

This commit adds HTML file for index page.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoseq: migrate to gi-docgen from gtk-doc
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
seq: migrate to gi-docgen from gtk-doc

This commit uses gi-docgen and obsolete gtk-doc.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agotimer: migrate to gi-docgen from gtk-doc
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
timer: migrate to gi-docgen from gtk-doc

This commit uses gi-docgen and obsolete gtk-doc.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agorawmidi: migrate to gi-docgen from gtk-doc
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
rawmidi: migrate to gi-docgen from gtk-doc

This commit uses gi-docgen and obsolete gtk-doc.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agohwdep: migrate to gi-docgen from gtk-doc
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
hwdep: migrate to gi-docgen from gtk-doc

This commit uses gi-docgen and obsolete gtk-doc.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl: migrate to gi-docgen from gtk-doc
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
ctl: migrate to gi-docgen from gtk-doc

This commit uses gi-docgen and obsolete gtk-doc.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: minor code refactoring for option of documentation
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
meson: minor code refactoring for option of documentation

This commit arranges subdirectory inclusion for documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoci: update build environment to use gi-docgen
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
ci: update build environment to use gi-docgen

The new dependency on gi-docgen needs specific packages in CI environment.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: rename gtk_doc option
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
meson: rename gtk_doc option

The new dependency of gi-docgen obsoletes usage of gtk-doc, therefore it
is better to rename option for meson configuration.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoci: remove outdated actions
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
ci: remove outdated actions

This commit removes useless entries for workflow in github actions.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoseq: add entry header to aggregate header inclusion
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
seq: add entry header to aggregate header inclusion

It's convenient to add header to include all of headers in regard of
documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agotimer: add entry header to aggregate header inclusion
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
timer: add entry header to aggregate header inclusion

It's convenient to add header to include all of headers in regard of
documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agorawmidi: add entry header to aggregate header inclusion
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
rawmidi: add entry header to aggregate header inclusion

It's convenient to add header to include all of headers in regard of
documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agohwdep: add entry header to aggregate header inclusion
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
hwdep: add entry header to aggregate header inclusion

It's convenient to add header to include all of headers in regard of
documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl: add entry header to aggregate header inclusion
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
ctl: add entry header to aggregate header inclusion

It's convenient to add header to include all of headers in regard of
documentation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: code refactoring to remove useless assignments for include headers
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
meson: code refactoring to remove useless assignments for include headers

In meson build, gnome.mkenums_simple() and gnome.genmarshal()
voluntarily install headers, therefore it's useless to install
them explicitly by install_headers().

This commit removes useless assignments for include headers. I note that
gnome.generate_gir() fails to parse codes when enums are prior to
headers and sources. This commit also reorder entries for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: minor code refactoring for include directories
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
meson: minor code refactoring for include directories

The path to include directory for installation is referred by several
parts. This commit adds local variable for it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: obsolete usage of deprecated meson.build_dir()
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
meson: obsolete usage of deprecated meson.build_dir()

Meson build v0.56 deprecates meson.build_root(). This commit adds
alternative variable for the path to built stuffs.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agomeson: infer library soname for .pc file
Takashi Sakamoto [Wed, 16 Mar 2022 00:03:48 +0000 (09:03 +0900)]
meson: infer library soname for .pc file

In meson build, the pkgconfig module automatically infers soname from
given object. Let's use it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agobump version up to 0.2.2 for maintenance release v0.2.2
Takashi Sakamoto [Tue, 15 Mar 2022 23:58:52 +0000 (08:58 +0900)]
bump version up to 0.2.2 for maintenance release

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl: fix misfunction of alsactl_get_card_id_list()
Takashi Sakamoto [Tue, 15 Mar 2022 23:30:07 +0000 (08:30 +0900)]
ctl: fix misfunction of alsactl_get_card_id_list()

Even if instantiation of libudev enumerator is successful,
alsactl_get_card_id_list() handles the success as failure. As a result,
the function does not work at all.

This commit fixes the bug.

Fixes: bfe4b0589fc6 ("ctl/hwdep/rawmidi: fix uninitialized warning")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl/timer/seq: optimization for GLib v2.68
Takashi Sakamoto [Tue, 15 Mar 2022 23:30:07 +0000 (08:30 +0900)]
ctl/timer/seq: optimization for GLib v2.68

The usage of g_memdup() is deprecated since glib 2.68 because it has
narrow integer conversion from gsize to guint.

This commit replaces the usage with macro for g_memdup2().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 years agoctl/hwdep/rawmidi: fix uninitialized warning
Takashi Sakamoto [Tue, 15 Mar 2022 23:30:07 +0000 (08:30 +0900)]
ctl/hwdep/rawmidi: fix uninitialized warning

This commit fixes uninitialized warnings.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agobump version up to 0.2.1 for maintenance release v0.2.1
Takashi Sakamoto [Sun, 29 Aug 2021 10:07:42 +0000 (19:07 +0900)]
bump version up to 0.2.1 for maintenance release

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: use safer way to copy strings
Takashi Sakamoto [Sat, 28 Aug 2021 02:51:36 +0000 (11:51 +0900)]
seq: use safer way to copy strings

The call of strncpy can results in destination buffer without null as
terminator in the case of truncation. Compiler reports the risk as
warnings, like:

In function â€˜strncpy’,
    inlined from â€˜alsaseq_get_queue_info_by_name’ at ../src/seq/query.c:670:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: warning: â€˜strncpy’ specified bound 64 equals destination size [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~

This commit uses safer way to copy strings, g_strlcpy(), to fix the bug.

Fixes: 4e8675f631ce ("seq: client_info: add properties and accessor methods")
Fixes: f3457eaf706b ("seq: port_info: add properties")
Fixes: 1eabdf6bc647 ("seq: add global method to get the information of queue")
Fixes: f26342b3ab3d ("seq: queue_info: add properties and constructors")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoctl/rawmidi/hwdep: fix compiler warning due to uninitialized variables
Takashi Sakamoto [Sat, 28 Aug 2021 02:51:36 +0000 (11:51 +0900)]
ctl/rawmidi/hwdep: fix compiler warning due to uninitialized variables

In some libraries, the local variable of udev enumerate is carelessly
uninitialized. As a result, compiler generates warnings, like:

../src/ctl/query.c: In function â€˜alsactl_get_card_id_list’:
../src/ctl/query.c:131:8: warning: â€˜enumerator’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  131 |     if (enumerator == NULL)
      |        ^

This commit fixes the bug.

Fixes: d1936fbbe7e2 ("ctl: add global method to get list of available sound cards")
Fixes: cb128c5b59e0 ("rawmidi; add global method to get list of rawmidi device for sound card")
Fixes: d4a9f6735d05 ("hwdep: add global method to get list of hwdep devices in sound card")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: event_data_ctl: fix getter API for value parameter
Takashi Sakamoto [Fri, 27 Aug 2021 08:37:03 +0000 (17:37 +0900)]
seq: event_data_ctl: fix getter API for value parameter

ALSASeq.EventDataCtl.get_value() is programmed carelessly to return
the value in parameter field instead of value field.

This commit fixes the bug.

Fixes: a8f603eff4f5 ("seq: event_data_ctl: add accessor methods")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoupdate Fedora release for CI environment
Takashi Sakamoto [Fri, 28 May 2021 11:31:19 +0000 (20:31 +0900)]
update Fedora release for CI environment

This commit update Fedora release up to 34.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agofix workflow according to EOF of i386 ubuntu distribution
Takashi Sakamoto [Fri, 28 May 2021 11:14:12 +0000 (20:14 +0900)]
fix workflow according to EOF of i386 ubuntu distribution

Ubuntu 19.10/i386 is EOL and no release is available for i386 architecture
in Ubuntu project.

This commit removes job for i386 architecture from workflow of Github
Actions.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agocorrect install section in README
Takashi Sakamoto [Fri, 28 May 2021 11:13:24 +0000 (20:13 +0900)]
correct install section in README

The command `meson build` is not correct.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agobump version up to 0.2.0 to release v0.2.0
Takashi Sakamoto [Fri, 20 Nov 2020 07:41:36 +0000 (16:41 +0900)]
bump version up to 0.2.0 to release

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoupgrade CI operationg system to Fedora 33
Takashi Sakamoto [Fri, 20 Nov 2020 07:41:36 +0000 (16:41 +0900)]
upgrade CI operationg system to Fedora 33

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoupgrade CI operationg system to Ubuntu 20.04 LTS amd64
Takashi Sakamoto [Fri, 20 Nov 2020 07:41:36 +0000 (16:41 +0900)]
upgrade CI operationg system to Ubuntu 20.04 LTS amd64

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: fix metadata and documentation for the type of interface
Takashi Sakamoto [Fri, 20 Nov 2020 07:41:36 +0000 (16:41 +0900)]
hwdep: fix metadata and documentation for the type of interface

The scanner of g-i and gtk-doc can't handle macro lines in enumeration
lines expectedly.

This commit fixes to generate valid metadata and documentation.

Fixes: 843c9fe68228 ("hwdep: conditional build for Linux kernel 4.12 or later")
Fixes: 45f650bf29e8 ("hwdep: conditional build for Linux kernel v4.9 or later")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: conditional build for Linux kernel 4.12 or later
Takashi Sakamoto [Fri, 20 Nov 2020 05:19:44 +0000 (14:19 +0900)]
hwdep: conditional build for Linux kernel 4.12 or later

The type of interface in ALSA HwDep interface got a new entries in Linux
kernel v4.12.

This commit adds conditional macro to build for Linux kernel v4.12 or later.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: conditional build for Linux kernel v4.9 or later
Takashi Sakamoto [Fri, 20 Nov 2020 05:19:44 +0000 (14:19 +0900)]
hwdep: conditional build for Linux kernel v4.9 or later

The type of interface in ALSA HwDep interface got a new entry in Linux
kernel v4.9.

This commit adds conditional macro to build for Linux kernel v4.9 or later.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: client_info: conditional build for Linux kernel v4.6 or later
Takashi Sakamoto [Fri, 20 Nov 2020 05:19:44 +0000 (14:19 +0900)]
seq: client_info: conditional build for Linux kernel v4.6 or later

Some members were added to snd_seq_client_info strucutre in Linux kernel
v4.6.

This commit adds conditional macro to build for Linux kernel v4.6 or later.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: query: fulfil comment about GError v0.1.99
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
rawmidi: query: fulfil comment about GError

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: query: fulfil comment about GError
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
hwdep: query: fulfil comment about GError

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: query: fulfil comment about GError
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
seq: query: fulfil comment about GError

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agotimer: query: fulfil comment about GError
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
timer: query: fulfil comment about GError

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoctl: query: fulfil comment about GError
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
ctl: query: fulfil comment about GError

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: query: fix usage of uninitialized value
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
rawmidi: query: fix usage of uninitialized value

Fixes: cb128c5b59e0 ("rawmidi; add global method to get list of rawmidi device for sound card")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: query: fix usage of uninitialized value
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
hwdep: query: fix usage of uninitialized value

Fixes: d4a9f6735d05 ("hwdep: add global method to get list of hwdep devices in sound card")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: stream_pair: update function comment for error reporting
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
rawmidi: stream_pair: update function comment for error reporting

This commit updates function comment for error reporting with
alsarawmidi_stream_pair_error_quark() or g_file_error_quark() domains.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agotimer: user_instance: fix function comment
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
timer: user_instance: fix function comment

Fixes: 880be3869d91 ("timer: user_instance: update function comment for error reporting")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agotimer: device_id: fix function comment
Takashi Sakamoto [Tue, 17 Nov 2020 06:44:48 +0000 (15:44 +0900)]
timer: device_id: fix function comment

Fixes: dcd983281ef8 ("timer: device_id: add accessor methods and constructors")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoctl: card: change prototype of function relevant to TLV
Takashi Sakamoto [Mon, 16 Nov 2020 23:52:54 +0000 (08:52 +0900)]
ctl: card: change prototype of function relevant to TLV

In ALSA control interface, the data of TLV (Type-Length-Value) style is
defined as array with unsigned int type of element. However, current
implementation of ALSACtl.Card handles them as signed int type.

This commit fixes the bug. The commit loses backward compatibility to
v0.1.0 release in a point of type of function argument. The exported
symbols relevant to TLV are updated with new version.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: stream_pair: fix to select substream
Takashi Sakamoto [Mon, 16 Nov 2020 13:27:54 +0000 (22:27 +0900)]
rawmidi: stream_pair: fix to select substream

ALSARawmidi.StreamPair.open() has subdevice_id to select one of
substreams supported by the Rawmidi device. However, this parameter is
ignored and the first substream is always selected.

In ALSA rawmidi core, private structure associated to file descriptor
to control character device assists selection of rawmidi substream.
It requires to keep the file descriptor until the selected substream
is actually attached by open rawmidi character device.

Current implementation of libalsarawmidi is to close the file descriptor
before opening rawmidi character device. This is the cause of the issue.

This commit fixes the bug by keeping the file descriptor till opening
rawmidi character device.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: query: allow caller to take ownership of file descriptor for control charact...
Takashi Sakamoto [Mon, 16 Nov 2020 13:27:54 +0000 (22:27 +0900)]
rawmidi: query: allow caller to take ownership of file descriptor for control character device

In design of ALSA rawmidi interface, ALSA control interface has important
function to some operations. The alsarawmidi library has an internal
helper function to operate control character device. The helper function
closes file descriptor to the control character device before returning
to caller, however it's inconvenient to some operations.

This commit allows the caller to take ownership for opened file descriptor
of control character device.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: obsolete library-wide GQuark for error reporting
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: obsolete library-wide GQuark for error reporting

This commit obsoletes library-wide GQuark. This is not exported, thus
it doesn't lose backward compatibility.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: query: use GFileError to report error
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: query: use GFileError to report error

This commit uses GFileError to report errors in library global functions.

It's better to add new GLib enumerations and GQuark for the reporting,
however it's cumbersome to add them just for the global functions.
Thus this commit just uses the existent error in GLib.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: stream_pair: report error about write-only file descriptor
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: stream_pair: report error about write-only file descriptor

In design of ALSA rawmidi interface, one character device can handle
operations for both capture and playback. Applications can indicate
usage of both or either by flags of open system call.

The libalsarawmidi library checks the flag by fcntl(2) system call to
create GSource for capture. When the file descriptor is not configured
for read, the call returns error.

This commit handles the error for local error reporting.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: report error for card disconnection state
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: report error for card disconnection state

When sound card is under disconnection state, operations fail and return
ENODEV error.

This commit handles the situation in local error domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: report open/read/write/fcntl error
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: report open/read/write/fcntl error

The call of open/read/write system call can return several types of error
from VFS. It's hard to dispatch all of the error in local error domain.

This commit uses GFileError to dispatch the most of the error. At
failure of conversion to GFileError, local error domain is used.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: report error for ioctl
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: report error for ioctl

This commit uses class-local error domain to report ioctl failure.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: stream-pair: add GQuark to report error for ALSARawmidi.StreamPair
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: stream-pair: add GQuark to report error for ALSARawmidi.StreamPair

This commit adds new GLib GQuark as a domain of error in instance of
ALSARawmidiStreamPair class.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: add GLib enumerations for error reporting
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: add GLib enumerations for error reporting

This commit adds new GLib enumeration for error reporting in
instance of ALSARawmidiStreamPair class.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: query: simplify count check
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: query: simplify count check

Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.

This commit simplifies the count check.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: stream_pair: just return when character device is not opened
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: stream_pair: just return when character device is not opened

It's programming mistake when operating without opening character device.

This commit uses GLib macro just return in the case with warnings.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: add checks for method arguments
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: add checks for method arguments

In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.

This commit adds the check for method arguments.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: check whether method argument for GError is available
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: check whether method argument for GError is available

In Rules for use of GError, the check of arguments for GError may be
preferable to avoid to unexpected function call.

This commit adds the check.

Reference: https://developer.gnome.org/glib/stable/glib-Error-Reporting.html
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agorawmidi: skip check of return value from g_malloc()
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: skip check of return value from g_malloc()

In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.

On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.

Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.

This commit skips check of return value from g_malloc().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: user_client: fix code for GFileError
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
seq: user_client: fix code for GFileError

Fixes: d662f5702de4 ("seq: user_client: report open/write error")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agotimer: user_instance: fix code for GFileError
Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
timer: user_instance: fix code for GFileError

Fixes: a400f241e9ef ("timer: user_instance: report error due to open system call")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep; obsolete library-wide GQuark for error reporting
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep; obsolete library-wide GQuark for error reporting

This commit obsoletes library-wide GQuark. This is not exported, thus
it doesn't lose backward compatibility.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: query: use GFileError to report error
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: query: use GFileError to report error

This commit uses GFileError to report errors in library global functions.

It's better to add new GLib enumerations and GQuark for the reporting,
however it's cumbersome to add them just for the global functions.
Thus this commit just uses the existent error in GLib.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: query: simplify count check
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: query: simplify count check

Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.

This commit simplifies the count check.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: add checks for method arguments
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: add checks for method arguments

In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.

This commit adds the check for method arguments.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: check whether method argument for GError is available
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: check whether method argument for GError is available

In Rules for use of GError, the check of arguments for GError may be
preferable to avoid to unexpected function call.

This commit adds the check.

Reference: https://developer.gnome.org/glib/stable/glib-Error-Reporting.html
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agohwdep: skip check of return value from g_malloc()
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: skip check of return value from g_malloc()

In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.

On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.

Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.

This commit skips check of return value from g_malloc().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agotimer: instance_param: simplify count check
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
timer: instance_param: simplify count check

Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.

This commit simplifies the count check.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoctl: query: simplify count check
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
ctl: query: simplify count check

Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.

This commit simplifies the count check.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: query: remove duplicated semicolon
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
seq: query: remove duplicated semicolon

Fixes: c5b7c598fde4 ("seq: add global method to get list of client ID in ALSA Sequencer")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: obsolete library-wide error quark
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: obsolete library-wide error quark

This commit obsoletes library-wide GQuark. This is not exported, thus
it doesn't lose backward compatibility.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: query: code refactoring for error path
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: query: code refactoring for error path

This commit uses label to ensure closing file descriptor.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: query: code refactoring to unify code to open file descriptor
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: query: code refactoring to unify code to open file descriptor

Some global functions execute the same sequence of operation to open
sequencer character device.

This commit unifies the sequence into a helper function as code
refactoring.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: query: use GFileError to report error
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: query: use GFileError to report error

In design of ALSA sequencer, sequencer character device is not
corresponding to each substance in ALSA Sequencer. It's a kind of
interface to query and operate. Applications adds user client
and operates it to use its services. Nevertheless, the interface
has some functionality without adding the user instances.

For the functionality, this library has global functions. The functions
are not relevant to the user instance, therefore it's not reasonable to
use error domain specific to the user instance.

This commit uses GFileError to report errors in the global functions.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
4 years agoseq: user_client: update function comment for error reporting
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: user_client: update function comment for error reporting

This commit updates function comment for error reporting with
alsaseq_user_instance_error_quark() or g_file_error_quark() domains.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>