Skip to contentSkip to conversation

ice1712 overwrite standard midi port names

PATCH Alan Horstmann 2 participants 7 messages Apr 1, 2006 – Apr 13, 2006

lore
Share & tools
lore
#0 lore raw

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

There are no name entries in _card_info for any card sub-vendors other than DMX6fire. Perhaps others could add these as appropriate?

Alan

ice1712-add-pref-midi-names.patch

Summary: Provides specified midi port names instead of defaults

Patch provides for the ice1712 card driver to overwrite the midi port name string given by default in mpu401_uart, with one specified in snd_ice1712_card_info.

alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c renamed from alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c +2 -0
diff -ru ../alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c ../alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c
@@ -1031,6 +1031,8 @@
 		.model = "dmx6fire",
 		.chip_init = snd_ice1712_ews_init,
 		.build_controls = snd_ice1712_ews_add_controls,
+		.mpu401_1_name = "MIDI-Front DMX6fire",
+		.mpu401_2_name = "Wavetable DMX6fire",
 	},
 	{ } /* terminator */
 };
alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c renamed from alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c +9 -1
diff -ru ../alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c ../alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c
@@ -2725,8 +2743,11 @@
 			snd_card_free(card);
 			return err;
 		}
+		if (c->mpu401_1_name != NULL)   /*  Prefered name available in card_info  */
+			snprintf(ice->rmidi[0]->name, sizeof(ice->rmidi[0]->name),
+						"%s %d-0", c->mpu401_1_name, card->number);
 
-		if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401)
+		if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) {  /*  2nd port used  */
 			if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712,
 						       ICEREG(ice, MPU2_CTRL), 1,
 						       ice->irq, 0,
@@ -2734,6 +2755,11 @@
 				snd_card_free(card);
 				return err;
 			}
+			if (c->mpu401_2_name != NULL)   /*  Prefered name available in card_info  */
+				snprintf(ice->rmidi[1]->name, sizeof(ice->rmidi[1]->name),
+							"%s %d-1", c->mpu401_2_name, card->number);
+
+		}
 	}
 
 	snd_ice1712_set_input_clock_source(ice, 0);
alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h renamed from alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h +2 -0
diff -ru ../alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h ../alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h
@@ -493,6 +494,8 @@
 	int (*chip_init)(struct snd_ice1712 *);
 	int (*build_controls)(struct snd_ice1712 *);
 	unsigned int no_mpu401: 1;
+	char *mpu401_1_name;
+	char *mpu401_2_name;
 	unsigned int eeprom_size;
 	unsigned char *eeprom_data;
 };
#1 lore raw

At Sat, 1 Apr 2006 22:06:27 +0100,

Quoted 6 lines · Alan Horstmann

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

I don't think -0 and -1 suffix are necessary. You give the individual name for each device, so they must be unique as they are.

Also, could fix the following?

- Use const char * for name strings
- Fix spaces / indentation

Quoted 2 lines

There are no name entries in _card_info for any card sub-vendors other than DMX6fire. Perhaps others could add these as appropriate?

Yes. But not mandatory. Can be added later.

thanks,

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#2 lore raw
Quoted 11 lines · you

At Sat, 1 Apr 2006 22:06:27 +0100,

Quoted 5 lines · Alan Horstmann

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

I don't think -0 and -1 suffix are necessary. You give the individual name for each device, so they must be unique as they are.

True, however I included them for the following reasons:-
a) The default name in mpu401...new has the 2 numbers with a hyphen, so
there is consistency making it clearer what they refer to.
b) If only a single number were used, there would need to be some extra
characters to say that it refered to the card number, not device, eg c-1 or card-1. Firstly this doesn't save space, and secondly trips over the problem of whether (to an inexperienced user) the first card is card-1 or card-0. Putting the number pair together seemed to be more likely to be understood as a system-type code, starting at zero.
c) It records somewhere to users (not reading the source-code) which device
is connected to each of the name strings.
d) There seemed to be no overriding reason to leave them out.

Quoted 3 lines

Also, could fix the following?

- Use const char * for name strings

Yes, will do.

Quoted 1 line

- Fix spaces / indentation

Can you be more specific? Do you mean second half of sprintf brackets? I can only see one unneccesary blank line. From the patch lines it is probably not obvious that the second port lines are indented further due to an extra 'if' statement.

Quoted 4 lines
Quoted 2 lines

There are no name entries in _card_info for any card sub-vendors other than DMX6fire. Perhaps others could add these as appropriate?

Yes. But not mandatory. Can be added later.

Fine.

Let me know what you think on these issues and I will fix the patch accordingly.

Alan

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#3 lore raw

At Mon, 3 Apr 2006 22:45:58 +0100,

Quoted 14 lines · Alan Horstmann
Quoted 11 lines · you

At Sat, 1 Apr 2006 22:06:27 +0100,

Quoted 5 lines · Alan Horstmann

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

I don't think -0 and -1 suffix are necessary. You give the individual name for each device, so they must be unique as they are.

Quoted 6 lines

True, however I included them for the following reasons:-
a) The default name in mpu401...new has the 2 numbers with a hyphen, so
there is consistency making it clearer what they refer to.
b) If only a single number were used, there would need to be some extra
characters to say that it refered to the card number, not device, eg c-1 or card-1.

There wasn't any assumption about the card/device number appearing in the name, and there won't. The rule is simple: the name should be unique. The current name is generated just to achieve it easily.

Quoted 2 lines

c) It records somewhere to users (not reading the source-code) which device
is connected to each of the name strings.

For users, basically it doesn't matter which device has the device number 0 or 1. User needs to know only what these devices are.

Quoted 1 line

d) There seemed to be no overriding reason to leave them out.

Ugliness.

Quoted 6 lines
Quoted 1 line

- Fix spaces / indentation

Can you be more specific? Do you mean second half of sprintf brackets? I can only see one unneccesary blank line. From the patch lines it is probably not obvious that the second port lines are indented further due to an extra 'if' statement.

The indent level isn't aligned properly. Not a big issue, I can adjust it by myself before merging.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#4 lore raw
Quoted 39 lines · you

At Mon, 3 Apr 2006 22:45:58 +0100,

Quoted 13 lines · Alan Horstmann
Quoted 11 lines · you

At Sat, 1 Apr 2006 22:06:27 +0100,

Quoted 5 lines · Alan Horstmann

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

I don't think -0 and -1 suffix are necessary. You give the individual name for each device, so they must be unique as they are.

Quoted 6 lines

True, however I included them for the following reasons:-
a) The default name in mpu401...new has the 2 numbers with a hyphen,
so there is consistency making it clearer what they refer to.
b) If only a single number were used, there would need to be some
extra characters to say that it refered to the card number, not device, eg c-1 or card-1.

There wasn't any assumption about the card/device number appearing in the name, and there won't. The rule is simple: the name should be unique. The current name is generated just to achieve it easily.

Quoted 2 lines

c) It records somewhere to users (not reading the source-code) which
device is connected to each of the name strings.

For users, basically it doesn't matter which device has the device number 0 or 1. User needs to know only what these devices are.

Quoted 1 line

d) There seemed to be no overriding reason to leave them out.

Ugliness.

Quoted 2 lines
Quoted 1 line

- Fix spaces / indentation

Quoted 7 lines
Quoted 4 lines

Can you be more specific? Do you mean second half of sprintf brackets? I can only see one unneccesary blank line. From the patch lines it is probably not obvious that the second port lines are indented further due to an extra 'if' statement.

The indent level isn't aligned properly. Not a big issue, I can adjust it by myself before merging.

Revised patch is attached which I think is as requested.

Alan

ice1712-add-pref-midi-names-2.patch

Summary: Provides specified midi port names instead of defaults

Patch provides for the ice1712 card driver to overwrite the midi port name string given by default in mpu401_uart, with one specified in snd_ice1712_card_info.

alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c renamed from alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c +2 -0
diff -ru ../alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c ../alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ews.c
@@ -1031,6 +1031,8 @@
 		.model = "dmx6fire",
 		.chip_init = snd_ice1712_ews_init,
 		.build_controls = snd_ice1712_ews_add_controls,
+		.mpu401_1_name = "MIDI-Front DMX6fire",
+		.mpu401_2_name = "Wavetable DMX6fire",
 	},
 	{ } /* terminator */
 };
alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c renamed from alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c +8 -1
diff -ru ../alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c ../alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.c
@@ -2725,8 +2743,11 @@
 			snd_card_free(card);
 			return err;
 		}
+		if (c->mpu401_1_name != NULL)   /*  Prefered name available in card_info  */
+			snprintf(ice->rmidi[0]->name, sizeof(ice->rmidi[0]->name),
+						"%s %d", c->mpu401_1_name, card->number);
 
-		if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401)
+		if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) {  /*  2nd port used  */
 			if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712,
 						       ICEREG(ice, MPU2_CTRL), 1,
 						       ice->irq, 0,
@@ -2734,6 +2755,10 @@
 				snd_card_free(card);
 				return err;
 			}
+			if (c->mpu401_2_name != NULL)   /*  Prefered name available in card_info  */
+				snprintf(ice->rmidi[1]->name, sizeof(ice->rmidi[1]->name),
+							"%s %d", c->mpu401_2_name, card->number);
+		}
 	}
 
 	snd_ice1712_set_input_clock_source(ice, 0);
alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h renamed from alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h +2 -0
diff -ru ../alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h ../alsa-driver-1.0.11rc3/alsa-kernel/pci/ice1712/ice1712.h
@@ -493,6 +494,8 @@
 	int (*chip_init)(struct snd_ice1712 *);
 	int (*build_controls)(struct snd_ice1712 *);
 	unsigned int no_mpu401: 1;
+	const char *mpu401_1_name;
+	const char *mpu401_2_name;
 	unsigned int eeprom_size;
 	unsigned char *eeprom_data;
 };
#5 lore raw

At Wed, 12 Apr 2006 10:48:23 +0100,

Quoted 56 lines · Alan Horstmann

[1 <text/plain; iso-8859-1 (7bit)>]

Quoted 39 lines · you

At Mon, 3 Apr 2006 22:45:58 +0100,

Quoted 13 lines · Alan Horstmann
Quoted 11 lines · you

At Sat, 1 Apr 2006 22:06:27 +0100,

Quoted 5 lines · Alan Horstmann

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

I don't think -0 and -1 suffix are necessary. You give the individual name for each device, so they must be unique as they are.

Quoted 6 lines

True, however I included them for the following reasons:-
a) The default name in mpu401...new has the 2 numbers with a hyphen,
so there is consistency making it clearer what they refer to.
b) If only a single number were used, there would need to be some
extra characters to say that it refered to the card number, not device, eg c-1 or card-1.

There wasn't any assumption about the card/device number appearing in the name, and there won't. The rule is simple: the name should be unique. The current name is generated just to achieve it easily.

Quoted 2 lines

c) It records somewhere to users (not reading the source-code) which
device is connected to each of the name strings.

For users, basically it doesn't matter which device has the device number 0 or 1. User needs to know only what these devices are.

Quoted 1 line

d) There seemed to be no overriding reason to leave them out.

Ugliness.

Quoted 2 lines
Quoted 1 line

- Fix spaces / indentation

Quoted 7 lines
Quoted 4 lines

Can you be more specific? Do you mean second half of sprintf brackets? I can only see one unneccesary blank line. From the patch lines it is probably not obvious that the second port lines are indented further due to an extra 'if' statement.

The indent level isn't aligned properly. Not a big issue, I can adjust it by myself before merging.

Revised patch is attached which I think is as requested.

Alan

ice1712-add-pref-midi-names-2.patch

Quoted 7 lines

Summary: Provides specified midi port names instead of defaults

Patch provides for the ice1712 card driver to overwrite the midi port name string given by default in mpu401_uart, with one specified in snd_ice1712_card_info.

The patch looks fine.

I'll apply it after releasing 1.0.11-final (which should appear soon) since we want only real "fixes" to be merged right now.

Thanks,

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#6 lore raw
Quoted 67 lines · you

At Wed, 12 Apr 2006 10:48:23 +0100,

Quoted 64 lines · Alan Horstmann

[1 <text/plain; iso-8859-1 (7bit)>]

Quoted 41 lines · you

At Mon, 3 Apr 2006 22:45:58 +0100,

Quoted 15 lines · Alan Horstmann
Quoted 10 lines · you

At Sat, 1 Apr 2006 22:06:27 +0100,

Quoted 6 lines · Alan Horstmann

Following our discussions I had time to prepare this patch for ice1712 driver. I figured you prefered the minimum changes to achieve the end result. The replacement names in ews.c are left as I prefer, 'detail, card', but if you choose, just reverse the order, to comply instead with convention. How does this proposal look?

Quoted 3 lines

I don't think -0 and -1 suffix are necessary. You give the individual name for each device, so they must be unique as they are.

Quoted 6 lines

True, however I included them for the following reasons:-
a) The default name in mpu401...new has the 2 numbers with a
hyphen, so there is consistency making it clearer what they refer to.
b) If only a single number were used, there would need to be some extra characters to say that it refered to the card number, not device, eg c-1 or card-1.

There wasn't any assumption about the card/device number appearing in the name, and there won't. The rule is simple: the name should be unique. The current name is generated just to achieve it easily.

Quoted 2 lines

c) It records somewhere to users (not reading the source-code)
which device is connected to each of the name strings.

For users, basically it doesn't matter which device has the device number 0 or 1. User needs to know only what these devices are.

Quoted 1 line

d) There seemed to be no overriding reason to leave them out.

Ugliness.

Quoted 2 lines
Quoted 1 line

- Fix spaces / indentation

Quoted 7 lines
Quoted 4 lines

Can you be more specific? Do you mean second half of sprintf brackets? I can only see one unneccesary blank line. From the patch lines it is probably not obvious that the second port lines are indented further due to an extra 'if' statement.

The indent level isn't aligned properly. Not a big issue, I can adjust it by myself before merging.

Revised patch is attached which I think is as requested.

Alan

ice1712-add-pref-midi-names-2.patch

Summary: Provides specified midi port names instead of defaults

Patch provides for the ice1712 card driver to overwrite the midi port name string given by default in mpu401_uart, with one specified in snd_ice1712_card_info.

Quoted 6 lines
Quoted 1 line

The patch looks fine.

I'll apply it after releasing 1.0.11-final (which should appear soon) since we want only real "fixes" to be merged right now.

Actually I meant to ask whether you wanted to add a 'c' in front of card->number to make eg 'c0' or 'c1',or just leave the digit solitary?

Alan

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642