Skip to contentSkip to conversation

A FIX FOR alsa-lib emu10k1.h (IT FIXES ld10k1)

DISCUSSION [email protected] 3 participants 9 messages Jan 17, 2007 – Jan 22, 2007

lore
Share & tools
lore
#0 lore raw

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {
		snd_kcontrol_tlv_rw_t *c;
		unsigned int *p;
	} tlv;

was added to struct 'snd_emu10k1_fx8010_control_gpr'.
But alsa-lib/include/sound/emu10k1.h was not changed. So I did this:
...
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int *p; // <----- ADDED THIS <----------------
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
} emu10k1_fx8010_control_gpr_t;

which is in alsa-lib/include/sound/emu10k1.h

For me, it fixes ld10k1. *p acts as a placeholder because it is useless
(at this point) to ld10k1.

----Can you tell me what those changes were for? What are *c and *p ? ---

Thanks. Tim.
terminator356 -> users -> sourceforge -> net (Developer on ld10k1 project).

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#1 lore raw

At Wed, 17 Jan 2007 00:12:07 -0500,

Quoted 17 lines · [email protected] wrote:

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {
		snd_kcontrol_tlv_rw_t *c;
		unsigned int *p;
	} tlv;

was added to struct 'snd_emu10k1_fx8010_control_gpr'.
But alsa-lib/include/sound/emu10k1.h was not changed. So I did this:
...
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int *p; // <----- ADDED THIS <----------------
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
} emu10k1_fx8010_control_gpr_t;

Quoted 6 lines

which is in alsa-lib/include/sound/emu10k1.h

For me, it fixes ld10k1. *p acts as a placeholder because it is useless
(at this point) to ld10k1.

----Can you tell me what those changes were for? What are *c and *p ? ---

Well, this is an ABI breakage by introducing the TLV support. The tlv keeps the additional information such as dB range.

James, do you have already a fix?
I'm afraid that fixing this isn't so obvious and relatively complicated.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#2 lore raw

At Wed, 17 Jan 2007 13:35:10 +0100,

Quoted 25 lines · 私 wrote:

At Wed, 17 Jan 2007 00:12:07 -0500,

Quoted 22 lines · [email protected] wrote:

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {
		snd_kcontrol_tlv_rw_t *c;
		unsigned int *p;
	} tlv;

was added to struct 'snd_emu10k1_fx8010_control_gpr'.
But alsa-lib/include/sound/emu10k1.h was not changed. So I did this:
...
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int *p; // <----- ADDED THIS <----------------
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
} emu10k1_fx8010_control_gpr_t;

which is in alsa-lib/include/sound/emu10k1.h

For me, it fixes ld10k1. *p acts as a placeholder because it is useless
(at this point) to ld10k1.

Quoted 8 lines
Quoted 1 line

----Can you tell me what those changes were for? What are *c and *p ? ---

Well, this is an ABI breakage by introducing the TLV support. The tlv keeps the additional information such as dB range.

James, do you have already a fix?
I'm afraid that fixing this isn't so obvious and relatively complicated.

The patch below changes the driver to accept the old ABI as default, then switch to the new ABI if EMU10K1_PVERSION ioctl is called. Could you give it a try? If it works, I'll post a patch to ld10k1 to switch to the new ABI.

Takashi

include/emu10k1.h +17 -4
diff -r beb52b12c43f include/emu10k1.h
@@ -1449,6 +1449,7 @@ struct snd_emu10k1 {
 	unsigned int tos_link: 1,		/* tos link detected */
 		rear_ac97: 1,			/* rear channels are on AC'97 */
 		enable_ir: 1;
+	unsigned int support_tlv :1;
 	/* Contains profile of card capabilities */
 	const struct snd_emu_chip_details *card_capabilities;
 	unsigned int audigy;			/* is Audigy? */
@@ -1901,11 +1902,20 @@ struct snd_emu10k1_fx8010_control_gpr {
 	unsigned int value[32];		/* initial values */
 	unsigned int min;		/* minimum range */
 	unsigned int max;		/* maximum range */
-	union {
-		snd_kcontrol_tlv_rw_t *c;
-		unsigned int *p;
-	} tlv;
 	unsigned int translation;	/* translation type (EMU10K1_GPR_TRANSLATION*) */
+	unsigned int *tlv;
+};
+
+/* old ABI without TLV support */
+struct snd_emu10k1_fx8010_control_old_gpr {
+	struct snd_ctl_elem_id id;
+	unsigned int vcount;
+	unsigned int count;
+	unsigned short gpr[32];
+	unsigned int value[32];
+	unsigned int min;
+	unsigned int max;
+	unsigned int translation;
 };
 
 struct snd_emu10k1_fx8010_code {
@@ -1956,6 +1966,8 @@ struct snd_emu10k1_fx8010_pcm_rec {
 	unsigned int res2;		/* reserved */
 };
 
+#define SNDRV_EMU10K1_VERSION		SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
 #define SNDRV_EMU10K1_IOCTL_INFO	_IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
 #define SNDRV_EMU10K1_IOCTL_CODE_POKE	_IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
 #define SNDRV_EMU10K1_IOCTL_CODE_PEEK	_IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
@@ -1964,6 +1976,7 @@ struct snd_emu10k1_fx8010_pcm_rec {
 #define SNDRV_EMU10K1_IOCTL_TRAM_PEEK	_IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
 #define SNDRV_EMU10K1_IOCTL_PCM_POKE	_IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
 #define SNDRV_EMU10K1_IOCTL_PCM_PEEK	_IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
+#define SNDRV_EMU10K1_IOCTL_PVERSION	_IOR ('H', 0x40, int)
 #define SNDRV_EMU10K1_IOCTL_STOP	_IO  ('H', 0x80)
 #define SNDRV_EMU10K1_IOCTL_CONTINUE	_IO  ('H', 0x81)
 #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
pci/emu10k1/emufx.c +79 -21

219 lines not on this page · raw message

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#7 lore raw
In reply to Takashi Iwai
Quoted 30 lines · Takashi Iwai

At Wed, 17 Jan 2007 00:12:07 -0500,

Quoted 16 lines · [email protected] wrote:

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {
		snd_kcontrol_tlv_rw_t *c;
		unsigned int *p;
	} tlv;

was added to struct 'snd_emu10k1_fx8010_control_gpr'.
But alsa-lib/include/sound/emu10k1.h was not changed. So I did this:
...
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int *p; // <----- ADDED THIS <----------------
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
} emu10k1_fx8010_control_gpr_t;

Quoted 7 lines

which is in alsa-lib/include/sound/emu10k1.h

For me, it fixes ld10k1. *p acts as a placeholder because it is useless
(at this point) to ld10k1.

----Can you tell me what those changes were for? What are *c and *p ? ---

Well, this is an ABI breakage by introducing the TLV support. The tlv keeps the additional information such as dB range.

Quoted 7 lines

James, do you have already a fix?
I'm afraid that fixing this isn't so obvious and relatively complicated.

Takashi

I am busy at the moment, but I will look into this in a week or so.

James

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#3 lore raw
In reply to Takashi Iwai
Quoted 5 lines · you

At Wed, 17 Jan 2007 13:35:10 +0100,

Quoted 4 lines
Quoted 3 lines · terminator356 -> users.sourceforge.net wrote:

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {

Sorry that should be alsa-kernel/include/sound/emu10k1.h

Quoted 1 line
Quoted 1 line

Well, this is an ABI breakage by introducing the TLV support.

What is ABI? "Always Broken Interface"? He he...

include/emu10k1.h

Quoted 9 lines

The patch below changes the driver to accept the old ABI as default, then switch to the new ABI if EMU10K1_PVERSION ioctl is called. Could you give it a try? If it works, I'll post a patch to ld10k1 to switch to the new ABI.
Takashi

diff -r beb52b12c43f include/emu10k1.h

include/emu10k1.h +0 -0

(Should be include/sound/emu10k1.h)

include/emu10k1.h struct snd_emu10k1 { · line 1450

Quoted 4 lines
include/emu10k1.h +0 -0
@@ -1449,6 +1449,7 @@ struct snd_emu10k1 {
 	unsigned int tos_link: 1,		/* tos link detected */
 		rear_ac97: 1,			/* rear channels are on AC'97 

*/

include/emu10k1.h struct snd_emu10k1 { · line 1452

Quoted 2 lines
include/emu10k1.h +1 -0
 		enable_ir: 1;
+	unsigned int support_tlv :1;

This is what I get, what am I doing wrong?:
[me@localhost sound]# patch -p1 emu10k1.h alsa-driver-tiwai-emu10k1-h-patch patching file emu10k1.h
patch: **** malformed patch at line 5: unsigned int tos_link: 1,/* tos link
detected */

(That line is present in the emu10k1.h file).
Thanks.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#4 lore raw

At Fri, 19 Jan 2007 01:17:38 +0000 (UTC),

Quoted 8 lines · Tim
Quoted 5 lines · you

At Wed, 17 Jan 2007 13:35:10 +0100,

Quoted 4 lines
Quoted 3 lines · terminator356 -> users.sourceforge.net wrote:

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {

Sorry that should be alsa-kernel/include/sound/emu10k1.h

No, it's really alsa-kernel/include/emu10k1.h. It's a fix for the driver, not the library.

Quoted 2 lines
Quoted 1 line
Quoted 1 line

Well, this is an ABI breakage by introducing the TLV support.

What is ABI? "Always Broken Interface"? He he...

Ask google :)

Quoted 15 lines

include/emu10k1.h

Quoted 9 lines

The patch below changes the driver to accept the old ABI as default, then switch to the new ABI if EMU10K1_PVERSION ioctl is called. Could you give it a try? If it works, I'll post a patch to ld10k1 to switch to the new ABI.
Takashi

diff -r beb52b12c43f include/emu10k1.h

include/emu10k1.h +0 -0

(Should be include/sound/emu10k1.h)

include/emu10k1.h struct snd_emu10k1 { · line 1450

Quoted 3 lines
include/emu10k1.h +0 -0
@@ -1449,6 +1449,7 @@ struct snd_emu10k1 {
 	unsigned int tos_link: 1,		/* tos link detected */
 		rear_ac97: 1,			/* rear channels are on AC'97 

*/

Quoted 8 lines

include/emu10k1.h struct snd_emu10k1 { · line 1452

Quoted 2 lines
include/emu10k1.h +1 -0
 		enable_ir: 1;
+	unsigned int support_tlv :1;

This is what I get, what am I doing wrong?:
[me@localhost sound]# patch -p1 emu10k1.h alsa-driver-tiwai-emu10k1-h-patch patching file emu10k1.h
patch: **** malformed patch at line 5: unsigned int tos_link: 1,/* tos link
detected */

You mailer seems not able to handle the embedded patch... I put the patch below as an attachment.

Takashi

include/emu10k1.h +17 -4
diff -r beb52b12c43f include/emu10k1.h
@@ -1449,6 +1449,7 @@ struct snd_emu10k1 {
 	unsigned int tos_link: 1,		/* tos link detected */
 		rear_ac97: 1,			/* rear channels are on AC'97 */
 		enable_ir: 1;
+	unsigned int support_tlv :1;
 	/* Contains profile of card capabilities */
 	const struct snd_emu_chip_details *card_capabilities;
 	unsigned int audigy;			/* is Audigy? */
@@ -1901,11 +1902,20 @@ struct snd_emu10k1_fx8010_control_gpr {
 	unsigned int value[32];		/* initial values */
 	unsigned int min;		/* minimum range */
 	unsigned int max;		/* maximum range */
-	union {
-		snd_kcontrol_tlv_rw_t *c;
-		unsigned int *p;
-	} tlv;
 	unsigned int translation;	/* translation type (EMU10K1_GPR_TRANSLATION*) */
+	unsigned int *tlv;
+};
+
+/* old ABI without TLV support */
+struct snd_emu10k1_fx8010_control_old_gpr {
+	struct snd_ctl_elem_id id;
+	unsigned int vcount;
+	unsigned int count;
+	unsigned short gpr[32];
+	unsigned int value[32];
+	unsigned int min;
+	unsigned int max;
+	unsigned int translation;
 };
 
 struct snd_emu10k1_fx8010_code {
@@ -1956,6 +1966,8 @@ struct snd_emu10k1_fx8010_pcm_rec {
 	unsigned int res2;		/* reserved */
 };
 
+#define SNDRV_EMU10K1_VERSION		SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
 #define SNDRV_EMU10K1_IOCTL_INFO	_IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
 #define SNDRV_EMU10K1_IOCTL_CODE_POKE	_IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
 #define SNDRV_EMU10K1_IOCTL_CODE_PEEK	_IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
@@ -1964,6 +1976,7 @@ struct snd_emu10k1_fx8010_pcm_rec {
 #define SNDRV_EMU10K1_IOCTL_TRAM_PEEK	_IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
 #define SNDRV_EMU10K1_IOCTL_PCM_POKE	_IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
 #define SNDRV_EMU10K1_IOCTL_PCM_PEEK	_IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
+#define SNDRV_EMU10K1_IOCTL_PVERSION	_IOR ('H', 0x40, int)
 #define SNDRV_EMU10K1_IOCTL_STOP	_IO  ('H', 0x80)
 #define SNDRV_EMU10K1_IOCTL_CONTINUE	_IO  ('H', 0x81)
 #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
pci/emu10k1/emufx.c +79 -21

219 lines not on this page · raw message

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#8 lore raw
In reply to James Courtier-Dutton

At Fri, 19 Jan 2007 09:58:17 +1100,

Quoted 32 lines · James Courtier-Dutton
Quoted 30 lines · Takashi Iwai

At Wed, 17 Jan 2007 00:12:07 -0500,

Quoted 16 lines · [email protected] wrote:

Hi, ld10k1 doesn't work, crashes. Lots of people saying it. In the alsa-kernel/include emu10k1.h,

	union {
		snd_kcontrol_tlv_rw_t *c;
		unsigned int *p;
	} tlv;

was added to struct 'snd_emu10k1_fx8010_control_gpr'.
But alsa-lib/include/sound/emu10k1.h was not changed. So I did this:
...
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int *p; // <----- ADDED THIS <----------------
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
} emu10k1_fx8010_control_gpr_t;

Quoted 7 lines

which is in alsa-lib/include/sound/emu10k1.h

For me, it fixes ld10k1. *p acts as a placeholder because it is useless
(at this point) to ld10k1.

----Can you tell me what those changes were for? What are *c and *p ? ---

Well, this is an ABI breakage by introducing the TLV support. The tlv keeps the additional information such as dB range.

Quoted 8 lines
Quoted 7 lines

James, do you have already a fix?
I'm afraid that fixing this isn't so obvious and relatively complicated.

Takashi

I am busy at the moment, but I will look into this in a week or so.

I built up a test machine with sb live now.
Fixed and committed to HG tree.

The driver behaves backward-compatible as default. Once after it gets the new SNDRV_EMU10K1_IOCTL_PVERSION ioctl, it changes to the new ABI.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#5 lore raw
In reply to Takashi Iwai
Quoted 2 lines · Takashi Iwai <tiwai <at> suse.de> writes:

No, it's really alsa-kernel/include/emu10k1.h. It's a fix for the driver, not the library.

Yes, sorry, sometimes I look in my kernel tree, where it's
include/sound/emu10k1.h
and other times I look in the seperate alsa-driver where it's
alsa-kernel/include/emu10k1.h

Quoted 1 line

I put the patch below as an attachment.

OK. I applied the patch, built and installed alsa-driver, rebuilt
and installed alsa-lib (without MY emu10k1.h fix), rebuilt and installed ld10k1. Test OK.
Thanks a bunch!
So this means apps (like ld10k1) could take advantage of the tlv.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#6 lore raw

At Fri, 19 Jan 2007 23:14:59 +0000 (UTC),

Quoted 8 lines · Tim
Quoted 2 lines

I put the patch below as an attachment.

OK. I applied the patch, built and installed alsa-driver, rebuilt
and installed alsa-lib (without MY emu10k1.h fix), rebuilt and installed ld10k1. Test OK.
Thanks a bunch!
So this means apps (like ld10k1) could take advantage of the tlv.

Yes, but currently ld10k1 doesn't support it.
Anyway, the codes in HG tree were already fixed (driver, lib and tools).

Thanks for report and testing.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV