[alsa-devel] [PATCH 0/4] ALSA: firewire-tascam: add support for FW-1804
Hi,
This patchset adds support for FW-1804. Additionally it fix some bugs. Nothing else ;)
This commit also adds no functionality to control internal multiplexer of supported models, following to basic design of ALSA firewire stack. It should be implemented in userspace. Currently, there's no udev rules for fw character devices corresponding to models supported by this module. Thus, permission of the devices may be 0600. When userspace applications touches the devices, they needs effective UID or GID as 0. This is not better environment for users. Further works are required for related softwares.
Regards
Takashi Sakamoto (4): ALSA: firewire-tascam: fix NULL pointer dereference when model identification fails ALSA: firewire-tascam: add support for FW-1804 ALSA: firewire-tascam: remove a flag for controller ALSA: firewire-tascam: remove needless member for control and status message
sound/firewire/tascam/tascam-transaction.c | 6 ++++++ sound/firewire/tascam/tascam.c | 12 +++++++++--- sound/firewire/tascam/tascam.h | 4 ---- 3 files changed, 15 insertions(+), 7 deletions(-)
When unsupported models are connected, snd-firewire-tascam module causes NULL pointer dereference in fw_core_remove_address_handler() (due to list_del_rcu()).
This commit prevents this bug.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/tascam/tascam-transaction.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c index 904ce03..040a96d 100644 --- a/sound/firewire/tascam/tascam-transaction.c +++ b/sound/firewire/tascam/tascam-transaction.c @@ -230,6 +230,7 @@ int snd_tscm_transaction_register(struct snd_tscm *tscm) return err; error: fw_core_remove_address_handler(&tscm->async_handler); + tscm->async_handler.callback_data = NULL; return err; }
@@ -276,6 +277,9 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm) __be32 reg; unsigned int i;
+ if (tscm->async_handler.callback_data == NULL) + return; + /* Turn off FireWire LED. */ reg = cpu_to_be32(0x0000008e); snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST, @@ -297,6 +301,8 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm) ®, sizeof(reg), 0);
fw_core_remove_address_handler(&tscm->async_handler); + tscm->async_handler.callback_data = NULL; + for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++) snd_fw_async_midi_port_destroy(&tscm->out_ports[i]); }
This model supports: * maximum 12 PCM channels for PCM playback * maximum 18 PCM channels for PCM capture * 4 ports for MIDI playback * 4 ports for MIDI capture * control and status messages in tx isochronous packets * up to 96.0 kHz
This commit adds support for the model. As the other supported models, all of available PCM channels are always enabled.
As I described in commit c0949b278515da94, Ilya Zimnovich had investigated TASCAM FireWire series in 2011 with his FW-1804. In his report, this model has internal multiplexer and any software implementation can control it. Following to the design of ALSA firewire stack, this commit won't implement it. It should be in userspace via Linux fw character device.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/tascam/tascam.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c index ee0bc18..dcb11c2 100644 --- a/sound/firewire/tascam/tascam.c +++ b/sound/firewire/tascam/tascam.c @@ -33,7 +33,16 @@ static struct snd_tscm_spec model_specs[] = { .midi_playback_ports = 2, .is_controller = true, }, - /* FW-1804 may be supported. */ + { + .name = "FW-1804", + .has_adat = true, + .has_spdif = true, + .pcm_capture_analog_channels = 8, + .pcm_playback_analog_channels = 2, + .midi_capture_ports = 2, + .midi_playback_ports = 4, + .is_controller = false, + }, };
static int identify_model(struct snd_tscm *tscm)
Currently, 'struct snd_tscm_spec' has a member named as 'is_controller' to identify MIDI controller. This member was originally added to skip parse control and status messages in isochronous packets for non-controller model.
As long as I investigate, FW-1804 (non-controller) also transfers the control and status message, thus it becomes meaningless.
This commit removes it.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/tascam/tascam.c | 3 --- sound/firewire/tascam/tascam.h | 1 - 2 files changed, 4 deletions(-)
diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c index dcb11c2..e281c33 100644 --- a/sound/firewire/tascam/tascam.c +++ b/sound/firewire/tascam/tascam.c @@ -21,7 +21,6 @@ static struct snd_tscm_spec model_specs[] = { .pcm_playback_analog_channels = 8, .midi_capture_ports = 4, .midi_playback_ports = 4, - .is_controller = true, }, { .name = "FW-1082", @@ -31,7 +30,6 @@ static struct snd_tscm_spec model_specs[] = { .pcm_playback_analog_channels = 2, .midi_capture_ports = 2, .midi_playback_ports = 2, - .is_controller = true, }, { .name = "FW-1804", @@ -41,7 +39,6 @@ static struct snd_tscm_spec model_specs[] = { .pcm_playback_analog_channels = 2, .midi_capture_ports = 2, .midi_playback_ports = 4, - .is_controller = false, }, };
diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h index 2d028d2..6626860 100644 --- a/sound/firewire/tascam/tascam.h +++ b/sound/firewire/tascam/tascam.h @@ -39,7 +39,6 @@ struct snd_tscm_spec { unsigned int pcm_playback_analog_channels; unsigned int midi_capture_ports; unsigned int midi_playback_ports; - bool is_controller; };
#define TSCM_MIDI_IN_PORT_MAX 4
Commit 3beab0f844fa added a member for control and status message, while it's planned and not implemented yet.
This commit removes it.
Fixes: 3beab0f844fa('ALSA: firewire-tascam: add support for outgoing MIDI messages by asynchronous transaction') Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/firewire/tascam/tascam.h | 3 --- 1 file changed, 3 deletions(-)
diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h index 6626860..30ab77e 100644 --- a/sound/firewire/tascam/tascam.h +++ b/sound/firewire/tascam/tascam.h @@ -71,9 +71,6 @@ struct snd_tscm { struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX]; u8 running_status[TSCM_MIDI_OUT_PORT_MAX]; bool on_sysex[TSCM_MIDI_OUT_PORT_MAX]; - - /* For control messages. */ - struct snd_firewire_tascam_status *status; };
#define TSCM_ADDR_BASE 0xffff00000000ull
On Fri, 05 Feb 2016 01:56:04 +0100, Takashi Sakamoto wrote:
Hi,
This patchset adds support for FW-1804. Additionally it fix some bugs. Nothing else ;)
This commit also adds no functionality to control internal multiplexer of supported models, following to basic design of ALSA firewire stack. It should be implemented in userspace. Currently, there's no udev rules for fw character devices corresponding to models supported by this module. Thus, permission of the devices may be 0600. When userspace applications touches the devices, they needs effective UID or GID as 0. This is not better environment for users. Further works are required for related softwares.
Regards
Takashi Sakamoto (4): ALSA: firewire-tascam: fix NULL pointer dereference when model identification fails ALSA: firewire-tascam: add support for FW-1804 ALSA: firewire-tascam: remove a flag for controller ALSA: firewire-tascam: remove needless member for control and status message
Applied all patches now. Thanks.
Takashi
participants (2)
-
Takashi Iwai
-
Takashi Sakamoto