diff --git a/Makefile b/Makefile index 1e7665c..b180f21 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ obj-m += snd-usb-us144mkii.o -snd-usb-us144mkii-y := us144mkii.o pcm.o playback.o capture.o midi.o controls.o +snd-usb-us144mkii-y := us144mkii.o us144mkii_pcm.o us144mkii_playback.o us144mkii_capture.o us144mkii_midi.o us144mkii_controls.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules diff --git a/us144mkii.c b/us144mkii.c index 7031a9b..e5e8635 100644 --- a/us144mkii.c +++ b/us144mkii.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami /* * ALSA Driver for TASCAM US-144MKII Audio Interface */ #include "us144mkii.h" -MODULE_AUTHOR("serifpersia "); +MODULE_AUTHOR("Šerif Rami "); MODULE_DESCRIPTION("ALSA Driver for TASCAM US-144MKII"); MODULE_LICENSE("GPL v2"); @@ -440,7 +440,11 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id * int err; char *handshake_buf; + if (dev->speed != USB_SPEED_HIGH) + dev_info(&dev->dev, "Device is connected to a USB 1.1 port, this is not supported.\n"); + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { + tascam = usb_get_intfdata(usb_ifnum_to_if(dev, 0)); if (tascam) { usb_set_intfdata(intf, tascam); diff --git a/us144mkii.h b/us144mkii.h index ec2c02b..b77ad18 100644 --- a/us144mkii.h +++ b/us144mkii.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #ifndef __US144MKII_H #define __US144MKII_H @@ -284,10 +284,10 @@ int tascam_alloc_urbs(struct tascam_card *tascam); */ void tascam_stop_work_handler(struct work_struct *work); -/* pcm.h */ -#include "pcm.h" +/* us144mkii_pcm.h */ +#include "us144mkii_pcm.h" -/* midi.c */ +/* us144mkii_midi.c */ /** * tascam_midi_in_urb_complete() - Completion handler for MIDI IN URBs * @urb: The completed URB. @@ -317,7 +317,7 @@ void tascam_midi_out_urb_complete(struct urb *urb); */ int tascam_create_midi(struct tascam_card *tascam); -/* controls.c */ +/* us144mkii_controls.c */ /** * tascam_create_controls() - Creates and adds ALSA mixer controls for the device. * @tascam: The driver instance. diff --git a/capture.c b/us144mkii_capture.c similarity index 98% rename from capture.c rename to us144mkii_capture.c index 865380b..4759a86 100644 --- a/capture.c +++ b/us144mkii_capture.c @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #include "us144mkii.h" -#include "pcm.h" /** * tascam_capture_open() - Opens the PCM capture substream. @@ -96,7 +95,7 @@ static snd_pcm_uframes_t tascam_capture_pointer(struct snd_pcm_substream *substr * including open, close, ioctl, hardware parameters, hardware free, prepare, * trigger, and pointer. */ -struct snd_pcm_ops tascam_capture_ops = { +const struct snd_pcm_ops tascam_capture_ops = { .open = tascam_capture_open, .close = tascam_capture_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/controls.c b/us144mkii_controls.c similarity index 99% rename from controls.c rename to us144mkii_controls.c index f985e4d..897eead 100644 --- a/controls.c +++ b/us144mkii_controls.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #include "us144mkii.h" diff --git a/midi.c b/us144mkii_midi.c similarity index 98% rename from midi.c rename to us144mkii_midi.c index bbaebad..f6a7eda 100644 --- a/midi.c +++ b/us144mkii_midi.c @@ -1,10 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #include "us144mkii.h" - - /** * tascam_midi_in_work_handler() - Deferred work for processing MIDI input. * @work: The work_struct instance. @@ -166,7 +164,7 @@ static void tascam_midi_in_trigger(struct snd_rawmidi_substream *substream, int * This structure defines the callback functions for MIDI input stream operations, * including open, close, and trigger. */ -static struct snd_rawmidi_ops tascam_midi_in_ops = { +static const struct snd_rawmidi_ops tascam_midi_in_ops = { .open = tascam_midi_in_open, .close = tascam_midi_in_close, .trigger = tascam_midi_in_trigger, @@ -365,7 +363,7 @@ static void tascam_midi_out_trigger(struct snd_rawmidi_substream *substream, int * This structure defines the callback functions for MIDI output stream operations, * including open, close, trigger, and drain. */ -static struct snd_rawmidi_ops tascam_midi_out_ops = { +static const struct snd_rawmidi_ops tascam_midi_out_ops = { .open = tascam_midi_out_open, .close = tascam_midi_out_close, .trigger = tascam_midi_out_trigger, diff --git a/pcm.c b/us144mkii_pcm.c similarity index 99% rename from pcm.c rename to us144mkii_pcm.c index 9735e9b..1a99491 100644 --- a/pcm.c +++ b/us144mkii_pcm.c @@ -1,11 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #include "us144mkii.h" -#include "pcm.h" /** - * @brief Rate-to-Packet Fixing Data (Verified) + * @brief Rate-to-Packet Fixing Data * * These static arrays define the number of audio frames per USB isochronous * packet for various sample rates. This data is crucial for maintaining diff --git a/pcm.h b/us144mkii_pcm.h similarity index 97% rename from pcm.h rename to us144mkii_pcm.h index 6467fe7..5082d90 100644 --- a/pcm.h +++ b/us144mkii_pcm.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #ifndef __US144MKII_PCM_H #define __US144MKII_PCM_H @@ -21,7 +21,7 @@ extern const struct snd_pcm_hardware tascam_pcm_hw; * including open, close, ioctl, hardware parameters, hardware free, prepare, * trigger, and pointer. */ -extern struct snd_pcm_ops tascam_playback_ops; +extern const struct snd_pcm_ops tascam_playback_ops; /** * tascam_capture_ops - ALSA PCM operations for capture. @@ -30,7 +30,7 @@ extern struct snd_pcm_ops tascam_playback_ops; * including open, close, ioctl, hardware parameters, hardware free, prepare, * trigger, and pointer. */ -extern struct snd_pcm_ops tascam_capture_ops; +extern const struct snd_pcm_ops tascam_capture_ops; /** * playback_urb_complete() - Completion handler for playback isochronous URBs. diff --git a/playback.c b/us144mkii_playback.c similarity index 99% rename from playback.c rename to us144mkii_playback.c index f663540..9608b0e 100644 --- a/playback.c +++ b/us144mkii_playback.c @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2025 serifpersia +// Copyright (c) 2025 Šerif Rami #include "us144mkii.h" -#include "pcm.h" /** * tascam_playback_open() - Opens the PCM playback substream. @@ -139,7 +138,7 @@ static snd_pcm_uframes_t tascam_playback_pointer(struct snd_pcm_substream *subst * including open, close, ioctl, hardware parameters, hardware free, prepare, * trigger, and pointer. */ -struct snd_pcm_ops tascam_playback_ops = { +const struct snd_pcm_ops tascam_playback_ops = { .open = tascam_playback_open, .close = tascam_playback_close, .ioctl = snd_pcm_lib_ioctl,