Skip to contentSkip to conversation

Add support for new Terratec DVB USB IDs

PATCH In review Jonathan Nieder 6 participants 12 messages Dec 22, 2011 – Mar 10, 2012 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi,

Eduard Bloch wrote[1]:

Quoted 9 lines

current revision of the Cinergy S2 USB box from Terratec seems to use another USB-IDs. The manufacturer provides patches at
http://linux.terratec.de/tv_en.html and it seems like the only difference is really just the new ID and a couple of init flag changes.

Their patch is not exactly for the linux-3.x tree but for the current s2-liplianin drivers, OTOH they still look similar enough and porting the patch was straight-forward. I also added the patch for Terratec S7 which is not tested yet but shouldn't do any harm.

[...]

Eduard, meet the LinuxTV project. linux-media folks, meet Eduard. Patch follows.

Eduard: may we have your sign-off? Please see Documentation/SubmittingPatches, section 12 "Sign your work" for what this means.

My only other hint is that it would be better to add the new device IDs in some logical place in the list near the older ones, instead of at the end where it is more likely to collide with other patches in flight. So if rerolling the patches, it might be useful to do that.

-- >8 --
From: Eduard Bloch <[email protected]>
Date: Thu, 22 Dec 2011 19:46:54 +0100
Subject: new device IDs used by some Terratec USB devices

The changes are extracted from ID patches in tarballs at
http://linux.terratec.de/tv_en.html (for S7 and Cinergy S2 USB HD), and slightly modified to match the state of s2-liplianin tree used in linux-3.x so far.
---
Thanks for your work,
Jonathan

[1] http://bugs.debian.org/653026

drivers/media/dvb/dvb-usb/az6027.c +6 -1
diff -urd linux-2.6-3.1.5.debian/drivers/media/dvb/dvb-usb/az6027.c linux-2.6-3.1.5/drivers/media/dvb/dvb-usb/az6027.c
@@ -1090,6 +1090,7 @@
 	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) },
 	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) },
 	{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) },
+	{ USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V3) },
 	{ },
 };
 
@@ -1135,7 +1136,7 @@
 
 	.i2c_algo         = &az6027_i2c_algo,
 
-	.num_device_descs = 6,
+	.num_device_descs = 7,
 	.devices = {
 		{
 			.name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)",
@@ -1161,6 +1162,10 @@
 			.name = "Elgato EyeTV Sat",
 			.cold_ids = { &az6027_usb_table[5], NULL },
 			.warm_ids = { NULL },
+		}, {
+			.name = "TERRATEC S7 Rev.3",
+			.cold_ids = { &az6027_usb_table[6], NULL },
+			.warm_ids = { NULL },
 		},
 		{ NULL },
 	}
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
diff -urd linux-2.6-3.1.5.debian/drivers/media/dvb/dvb-usb/dvb-usb-ids.h linux-2.6-3.1.5/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -319,6 +319,7 @@
 #define USB_PID_AZUREWAVE_AZ6027			0x3275
 #define USB_PID_TERRATEC_DVBS2CI_V1			0x10a4
 #define USB_PID_TERRATEC_DVBS2CI_V2			0x10ac
+#define USB_PID_TERRATEC_DVBS2CI_V3			0x10b0
 #define USB_PID_TECHNISAT_USB2_HDCI_V1			0x0001
 #define USB_PID_TECHNISAT_USB2_HDCI_V2			0x0002
 #define USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2		0x0004
drivers/media/dvb/dvb-usb/dw2102.c +14 -1
diff -urd linux-2.6-3.1.5.debian/drivers/media/dvb/dvb-usb/dw2102.c linux-2.6-3.1.5/drivers/media/dvb/dvb-usb/dw2102.c
@@ -1181,6 +1181,14 @@
 {
 	u8 obuf[3] = { 0xe, 0x80, 0 };
 	u8 ibuf[] = { 0 };
+	
+	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+		err("command 0x0e transfer failed.");
+
+	//power on su3000
+	obuf[0] = 0xe;
+	obuf[1] = 0x02;
+	obuf[2] = 1;
 
 	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
 		err("command 0x0e transfer failed.");
@@ -1451,6 +1459,7 @@
 	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
 	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
 	{USB_DEVICE(0x1f4d, 0x3100)},
+	{USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
 	{ }
 };
 
@@ -1824,7 +1833,7 @@
 			}
 		}
 	},
-	.num_device_descs = 3,
+	.num_device_descs = 4,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
 			{ &dw2102_table[10], NULL },
@@ -1838,6 +1847,10 @@
 			{ &dw2102_table[14], NULL },
 			{ NULL },
 		},
+		{ "Terratec Cinergy S2 USB HD Rev.2",
+			{ &dw2102_table[15], NULL },
+			{ NULL },
+		},
 	}
 };
 
#3 lore raw

[RFC/PATCH] [media] dw2102: use symbolic names for dw2102_table indices

In reply to Patrick Boettcher

dw2102_properties et al refer to entries in the USB-id table using hard-coded indices, as in "&dw2102_table[6]", which means adding new entries before the end of the list has the potential to introduce bugs in code elsewhere in the file.

Use C99-style initializers with symbolic names for each index to avoid this. This way, other device tables wanting to reuse the USB ids can use expressions like "&dw2102_table[TEVII_S630]" that do not change as the entries in the table are reordered.

---

Quoted 3 lines · Patrick Boettcher

Due to the use of the reference in the USB-id table adding the new set at the end of the list is actually the best way. Adding them in the middle will cause a lot of changes and bugs.

Good catch. That seems like an accident waiting to happen. How about something like this (untested)?

 drivers/media/dvb/dvb-usb/dw2102.c |   78 ++++++++++++++++++++++--------------
 1 files changed, 48 insertions(+), 30 deletions(-)
drivers/media/dvb/dvb-usb/dw2102.c +48 -30
index 64add7cb1fd3..9a1863dc7232 100644
@@ -1435,22 +1435,40 @@ static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 	return 0;
 }
 
+enum dw2102_table_entry {
+	CYPRESS_DW2102,
+	CYPRESS_DW2101,
+	CYPRESS_DW2104,
+	TEVII_S650,
+	TERRATEC_CINERGY_S,
+	CYPRESS_DW3101,
+	TEVII_S630,
+	PROF_1100,
+	TEVII_S660,
+	PROF_7500,
+	GENIATECH_SU3000,
+	TERRATEC_CINERGY_S2,
+	TEVII_S480_1,
+	TEVII_S480_2,
+	X3M_SPC1400HD,
+};
+
 static struct usb_device_id dw2102_table[] = {
-	{USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
-	{USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
-	{USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
-	{USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
-	{USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
-	{USB_DEVICE(0x3011, USB_PID_PROF_1100)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
-	{USB_DEVICE(0x3034, 0x7500)},
-	{USB_DEVICE(0x1f4d, 0x3000)},
-	{USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
-	{USB_DEVICE(0x1f4d, 0x3100)},
+	[CYPRESS_DW2102] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
+	[CYPRESS_DW2101] = {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
+	[CYPRESS_DW2104] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
+	[TEVII_S650] = {USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
+	[TERRATEC_CINERGY_S] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
+	[CYPRESS_DW3101] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
+	[TEVII_S630] = {USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
+	[PROF_1100] = {USB_DEVICE(0x3011, USB_PID_PROF_1100)},
+	[TEVII_S660] = {USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
+	[PROF_7500] = {USB_DEVICE(0x3034, 0x7500)},
+	[GENIATECH_SU3000] = {USB_DEVICE(0x1f4d, 0x3000)},
+	[TERRATEC_CINERGY_S2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
+	[TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
+	[TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
+	[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
 	{ }
 };
 
@@ -1610,15 +1628,15 @@ static struct dvb_usb_device_properties dw2102_properties = {
 	.num_device_descs = 3,
 	.devices = {
 		{"DVBWorld DVB-S 2102 USB2.0",
-			{&dw2102_table[0], NULL},
+			{&dw2102_table[CYPRESS_DW2102], NULL},
 			{NULL},
 		},
 		{"DVBWorld DVB-S 2101 USB2.0",
-			{&dw2102_table[1], NULL},
+			{&dw2102_table[CYPRESS_DW2101], NULL},
 			{NULL},
 		},
 		{"TerraTec Cinergy S USB",
-			{&dw2102_table[4], NULL},
+			{&dw2102_table[TERRATEC_CINERGY_S], NULL},
 			{NULL},
 		},
 	}
@@ -1664,11 +1682,11 @@ static struct dvb_usb_device_properties dw2104_properties = {
 	.num_device_descs = 2,
 	.devices = {
 		{ "DVBWorld DW2104 USB2.0",
-			{&dw2102_table[2], NULL},
+			{&dw2102_table[CYPRESS_DW2104], NULL},
 			{NULL},
 		},
 		{ "TeVii S650 USB2.0",
-			{&dw2102_table[3], NULL},
+			{&dw2102_table[TEVII_S650], NULL},
 			{NULL},
 		},
 	}
@@ -1715,7 +1733,7 @@ static struct dvb_usb_device_properties dw3101_properties = {
 	.num_device_descs = 1,
 	.devices = {
 		{ "DVBWorld DVB-C 3101 USB2.0",
-			{&dw2102_table[5], NULL},
+			{&dw2102_table[CYPRESS_DW3101], NULL},
 			{NULL},
 		},
 	}
@@ -1761,7 +1779,7 @@ static struct dvb_usb_device_properties s6x0_properties = {
 	.num_device_descs = 1,
 	.devices = {
 		{"TeVii S630 USB",
-			{&dw2102_table[6], NULL},
+			{&dw2102_table[TEVII_S630], NULL},
 			{NULL},
 		},
 	}
@@ -1770,33 +1788,33 @@ static struct dvb_usb_device_properties s6x0_properties = {
 struct dvb_usb_device_properties *p1100;
 static struct dvb_usb_device_description d1100 = {
 	"Prof 1100 USB ",
-	{&dw2102_table[7], NULL},
+	{&dw2102_table[PROF_1100], NULL},
 	{NULL},
 };
 
 struct dvb_usb_device_properties *s660;
 static struct dvb_usb_device_description d660 = {
 	"TeVii S660 USB",
-	{&dw2102_table[8], NULL},
+	{&dw2102_table[TEVII_S660], NULL},
 	{NULL},
 };
 
 static struct dvb_usb_device_description d480_1 = {
 	"TeVii S480.1 USB",
-	{&dw2102_table[12], NULL},
+	{&dw2102_table[TEVII_S480_1], NULL},
 	{NULL},
 };
 
 static struct dvb_usb_device_description d480_2 = {
 	"TeVii S480.2 USB",
-	{&dw2102_table[13], NULL},
+	{&dw2102_table[TEVII_S480_2], NULL},
 	{NULL},
 };
 
 struct dvb_usb_device_properties *p7500;
 static struct dvb_usb_device_description d7500 = {
 	"Prof 7500 USB DVB-S2",
-	{&dw2102_table[9], NULL},
+	{&dw2102_table[PROF_7500], NULL},
 	{NULL},
 };
 
@@ -1842,15 +1860,15 @@ static struct dvb_usb_device_properties su3000_properties = {
 	.num_device_descs = 3,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
-			{ &dw2102_table[10], NULL },
+			{ &dw2102_table[GENIATECH_SU3000], NULL },
 			{ NULL },
 		},
 		{ "Terratec Cinergy S2 USB HD",
-			{ &dw2102_table[11], NULL },
+			{ &dw2102_table[TERRATEC_CINERGY_S2], NULL },
 			{ NULL },
 		},
 		{ "X3M TV SPC1400HD PCI",
-			{ &dw2102_table[14], NULL },
+			{ &dw2102_table[X3M_SPC1400HD], NULL },
 			{ NULL },
 		},
 	}
Signature · 1 line
1.7.8
#2 lore raw
In reply to Jonathan Nieder
Quoted 18 lines · Jonathan Nieder

Hi,

Eduard Bloch wrote[1]:

Quoted 9 lines

current revision of the Cinergy S2 USB box from Terratec seems to use another USB-IDs. The manufacturer provides patches at
http://linux.terratec.de/tv_en.html and it seems like the only difference is really just the new ID and a couple of init flag changes.

Their patch is not exactly for the linux-3.x tree but for the current s2-liplianin drivers, OTOH they still look similar enough and porting the patch was straight-forward. I also added the patch for Terratec S7 which is not tested yet but shouldn't do any harm.

[...]

Eduard, meet the LinuxTV project. linux-media folks, meet Eduard. Patch follows.

Quoted 8 lines

Eduard: may we have your sign-off? Please see Documentation/SubmittingPatches, section 12 "Sign your work" for what this means.

My only other hint is that it would be better to add the new device IDs in some logical place in the list near the older ones, instead of at the end where it is more likely to collide with other patches in flight. So if rerolling the patches, it might be useful to do that.

Due to the use of the reference in the USB-id table adding the new set at the end of the list is actually the best way. Adding them in the middle will cause a lot of changes and bugs.

Except the Signed-off-by everything is fine to my eyes.

--
Patrick

#10 lore raw
In reply to Jonathan Nieder
Quoted 13 lines · Jonathan Nieder

Hi,

Eduard Bloch wrote[1]:

Quoted 9 lines

current revision of the Cinergy S2 USB box from Terratec seems to use another USB-IDs. The manufacturer provides patches at
http://linux.terratec.de/tv_en.html and it seems like the only difference is really just the new ID and a couple of init flag changes.

Their patch is not exactly for the linux-3.x tree but for the current s2-liplianin drivers, OTOH they still look similar enough and porting the patch was straight-forward. I also added the patch for Terratec S7 which is not tested yet but shouldn't do any harm.

Quoted 8 lines

[...]

Eduard, meet the LinuxTV project. linux-media folks, meet Eduard. Patch follows.

Eduard: may we have your sign-off? Please see Documentation/SubmittingPatches, section 12 "Sign your work" for what this means.

Eduard/Jonathan,

Please provide your Signed-off-by: your name <your@email>

thanks!
Mauro

Quoted 113 lines

My only other hint is that it would be better to add the new device IDs in some logical place in the list near the older ones, instead of at the end where it is more likely to collide with other patches in flight. So if rerolling the patches, it might be useful to do that.

-- >8 --
From: Eduard Bloch <[email protected]>
Date: Thu, 22 Dec 2011 19:46:54 +0100
Subject: new device IDs used by some Terratec USB devices

The changes are extracted from ID patches in tarballs at
http://linux.terratec.de/tv_en.html (for S7 and Cinergy S2 USB HD), and slightly modified to match the state of s2-liplianin tree used in linux-3.x so far.
---
Thanks for your work,
Jonathan

[1] http://bugs.debian.org/653026

diff -urd linux-2.6-3.1.5.debian/drivers/media/dvb/dvb-usb/az6027.c linux-2.6-3.1.5/drivers/media/dvb/dvb-usb/az6027.c

drivers/media/dvb/dvb-usb/az6027.c +6 -1
@@ -1090,6 +1090,7 @@
 	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) },
 	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) },
 	{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) },
+	{ USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V3) },
 	{ },
 };
 
@@ -1135,7 +1136,7 @@
 
 	.i2c_algo         = &az6027_i2c_algo,
 
-	.num_device_descs = 6,
+	.num_device_descs = 7,
 	.devices = {
 		{
 			.name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)",
@@ -1161,6 +1162,10 @@
 			.name = "Elgato EyeTV Sat",
 			.cold_ids = { &az6027_usb_table[5], NULL },
 			.warm_ids = { NULL },
+		}, {
+			.name = "TERRATEC S7 Rev.3",
+			.cold_ids = { &az6027_usb_table[6], NULL },
+			.warm_ids = { NULL },
 		},
 		{ NULL },
 	}

diff -urd linux-2.6-3.1.5.debian/drivers/media/dvb/dvb-usb/dvb-usb-ids.h linux-2.6-3.1.5/drivers/media/dvb/dvb-usb/dvb-usb-ids.h

drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
@@ -319,6 +319,7 @@
 #define USB_PID_AZUREWAVE_AZ6027			0x3275
 #define USB_PID_TERRATEC_DVBS2CI_V1			0x10a4
 #define USB_PID_TERRATEC_DVBS2CI_V2			0x10ac
+#define USB_PID_TERRATEC_DVBS2CI_V3			0x10b0
 #define USB_PID_TECHNISAT_USB2_HDCI_V1			0x0001
 #define USB_PID_TECHNISAT_USB2_HDCI_V2			0x0002
 #define USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2		0x0004

diff -urd linux-2.6-3.1.5.debian/drivers/media/dvb/dvb-usb/dw2102.c linux-2.6-3.1.5/drivers/media/dvb/dvb-usb/dw2102.c

drivers/media/dvb/dvb-usb/dw2102.c +14 -2
@@ -1181,6 +1181,14 @@
 {
 	u8 obuf[3] = { 0xe, 0x80, 0 };
 	u8 ibuf[] = { 0 };
+	
+	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+		err("command 0x0e transfer failed.");
+
+	//power on su3000
+	obuf[0] = 0xe;
+	obuf[1] = 0x02;
+	obuf[2] = 1;
 
 	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
 		err("command 0x0e transfer failed.");
@@ -1451,6 +1459,7 @@
 	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
 	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
 	{USB_DEVICE(0x1f4d, 0x3100)},
+	{USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
 	{ }
 };
 
@@ -1824,7 +1833,7 @@
 			}
 		}
 	},
-	.num_device_descs = 3,
+	.num_device_descs = 4,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
 			{ &dw2102_table[10], NULL },
@@ -1838,6 +1847,10 @@
 			{ &dw2102_table[14], NULL },
 			{ NULL },
 		},
+		{ "Terratec Cinergy S2 USB HD Rev.2",
+			{ &dw2102_table[15], NULL },
+			{ NULL },
+		},
 	}
 };
 
--

To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [RFC/PATCH] [media] dw2102: use symbolic names for dw2102_table indices

In reply to Jonathan Nieder
Quoted 183 lines · Jonathan Nieder

dw2102_properties et al refer to entries in the USB-id table using hard-coded indices, as in "&dw2102_table[6]", which means adding new entries before the end of the list has the potential to introduce bugs in code elsewhere in the file.

Use C99-style initializers with symbolic names for each index to avoid this. This way, other device tables wanting to reuse the USB ids can use expressions like "&dw2102_table[TEVII_S630]" that do not change as the entries in the table are reordered.

---

Quoted 3 lines · Patrick Boettcher

Due to the use of the reference in the USB-id table adding the new set at the end of the list is actually the best way. Adding them in the middle will cause a lot of changes and bugs.

Good catch. That seems like an accident waiting to happen. How about something like this (untested)?

 drivers/media/dvb/dvb-usb/dw2102.c |   78 ++++++++++++++++++++++--------------
 1 files changed, 48 insertions(+), 30 deletions(-)
drivers/media/dvb/dvb-usb/dw2102.c +46 -28
index 64add7cb1fd3..9a1863dc7232 100644
@@ -1435,22 +1435,40 @@ static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 	return 0;
 }
 
+enum dw2102_table_entry {
+	CYPRESS_DW2102,
+	CYPRESS_DW2101,
+	CYPRESS_DW2104,
+	TEVII_S650,
+	TERRATEC_CINERGY_S,
+	CYPRESS_DW3101,
+	TEVII_S630,
+	PROF_1100,
+	TEVII_S660,
+	PROF_7500,
+	GENIATECH_SU3000,
+	TERRATEC_CINERGY_S2,
+	TEVII_S480_1,
+	TEVII_S480_2,
+	X3M_SPC1400HD,
+};
+
 static struct usb_device_id dw2102_table[] = {
-	{USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
-	{USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
-	{USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
-	{USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
-	{USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
-	{USB_DEVICE(0x3011, USB_PID_PROF_1100)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
-	{USB_DEVICE(0x3034, 0x7500)},
-	{USB_DEVICE(0x1f4d, 0x3000)},
-	{USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
-	{USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
-	{USB_DEVICE(0x1f4d, 0x3100)},
+	[CYPRESS_DW2102] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
+	[CYPRESS_DW2101] = {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
+	[CYPRESS_DW2104] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
+	[TEVII_S650] = {USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
+	[TERRATEC_CINERGY_S] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
+	[CYPRESS_DW3101] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
+	[TEVII_S630] = {USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
+	[PROF_1100] = {USB_DEVICE(0x3011, USB_PID_PROF_1100)},
+	[TEVII_S660] = {USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
+	[PROF_7500] = {USB_DEVICE(0x3034, 0x7500)},
+	[GENIATECH_SU3000] = {USB_DEVICE(0x1f4d, 0x3000)},
+	[TERRATEC_CINERGY_S2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
+	[TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
+	[TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
+	[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
 	{ }
 };
 
@@ -1610,15 +1628,15 @@ static struct dvb_usb_device_properties dw2102_properties = {
 	.num_device_descs = 3,
 	.devices = {
 		{"DVBWorld DVB-S 2102 USB2.0",
-			{&dw2102_table[0], NULL},
+			{&dw2102_table[CYPRESS_DW2102], NULL},
 			{NULL},
 		},
 		{"DVBWorld DVB-S 2101 USB2.0",
-			{&dw2102_table[1], NULL},
+			{&dw2102_table[CYPRESS_DW2101], NULL},
 			{NULL},
 		},
 		{"TerraTec Cinergy S USB",
-			{&dw2102_table[4], NULL},
+			{&dw2102_table[TERRATEC_CINERGY_S], NULL},
 			{NULL},
 		},
 	}
@@ -1664,11 +1682,11 @@ static struct dvb_usb_device_properties dw2104_properties = {
 	.num_device_descs = 2,
 	.devices = {
 		{ "DVBWorld DW2104 USB2.0",
-			{&dw2102_table[2], NULL},
+			{&dw2102_table[CYPRESS_DW2104], NULL},
 			{NULL},
 		},
 		{ "TeVii S650 USB2.0",
-			{&dw2102_table[3], NULL},
+			{&dw2102_table[TEVII_S650], NULL},
 			{NULL},
 		},
 	}
@@ -1715,7 +1733,7 @@ static struct dvb_usb_device_properties dw3101_properties = {
 	.num_device_descs = 1,
 	.devices = {
 		{ "DVBWorld DVB-C 3101 USB2.0",
-			{&dw2102_table[5], NULL},
+			{&dw2102_table[CYPRESS_DW3101], NULL},
 			{NULL},
 		},
 	}
@@ -1761,7 +1779,7 @@ static struct dvb_usb_device_properties s6x0_properties = {
 	.num_device_descs = 1,
 	.devices = {
 		{"TeVii S630 USB",
-			{&dw2102_table[6], NULL},
+			{&dw2102_table[TEVII_S630], NULL},
 			{NULL},
 		},
 	}
@@ -1770,33 +1788,33 @@ static struct dvb_usb_device_properties s6x0_properties = {
 struct dvb_usb_device_properties *p1100;
 static struct dvb_usb_device_description d1100 = {
 	"Prof 1100 USB ",
-	{&dw2102_table[7], NULL},
+	{&dw2102_table[PROF_1100], NULL},
 	{NULL},
 };
 
 struct dvb_usb_device_properties *s660;
 static struct dvb_usb_device_description d660 = {
 	"TeVii S660 USB",
-	{&dw2102_table[8], NULL},
+	{&dw2102_table[TEVII_S660], NULL},
 	{NULL},
 };
 
 static struct dvb_usb_device_description d480_1 = {
 	"TeVii S480.1 USB",
-	{&dw2102_table[12], NULL},
+	{&dw2102_table[TEVII_S480_1], NULL},
 	{NULL},
 };
 
 static struct dvb_usb_device_description d480_2 = {
 	"TeVii S480.2 USB",
-	{&dw2102_table[13], NULL},
+	{&dw2102_table[TEVII_S480_2], NULL},
 	{NULL},
 };
 
 struct dvb_usb_device_properties *p7500;
 static struct dvb_usb_device_description d7500 = {
 	"Prof 7500 USB DVB-S2",
-	{&dw2102_table[9], NULL},
+	{&dw2102_table[PROF_7500], NULL},
 	{NULL},
 };
 
@@ -1842,15 +1860,15 @@ static struct dvb_usb_device_properties su3000_properties = {
 	.num_device_descs = 3,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
-			{ &dw2102_table[10], NULL },
+			{ &dw2102_table[GENIATECH_SU3000], NULL },
 			{ NULL },
 		},
 		{ "Terratec Cinergy S2 USB HD",

drivers/media/dvb/dvb-usb/dw2102.c static struct dvb_usb_device_properties su3000_properties = { · line 1874

Quoted 10 lines
drivers/media/dvb/dvb-usb/dw2102.c +2 -2
-			{ &dw2102_table[11], NULL },
+			{ &dw2102_table[TERRATEC_CINERGY_S2], NULL },
 			{ NULL },
 		},
 		{ "X3M TV SPC1400HD PCI",
-			{ &dw2102_table[14], NULL },
+			{ &dw2102_table[X3M_SPC1400HD], NULL },
 			{ NULL },
 		},
 	}

This looks like a good idea to me. From time to time, when conflict rises, sometimes those dvb-usb tables with the magic numbers got unnoticed conflicts.

So, I'm picking this one.

It should be noticed that this is a common constructor used inside the dvb-usb drivers. IMHO, an approach like that should be extended to the other drivers as well.

Regards,
Mauro

#5 lore raw

[PATCH 0/2] Re: [RFC/PATCH] [media] dw2102: use symbolic names for dw2102_table indices

(-cc: Eduard)

Quoted 5 lines · Mauro Carvalho Chehab

This looks like a good idea to me. From time to time, when conflict rises, sometimes those dvb-usb tables with the magic numbers got unnoticed conflicts.

So, I'm picking this one.

Yay. :)

Quoted 3 lines

It should be noticed that this is a common constructor used inside the dvb-usb drivers. IMHO, an approach like that should be extended to the other drivers as well.

Here's a few. Many more to go.

Jonathan Nieder (2):
[media] a800: use symbolic names for a800_table indices [media] af9005, af9015: use symbolic names for USB id table indices

 drivers/media/dvb/dvb-usb/a800.c   |   21 ++-
 drivers/media/dvb/dvb-usb/af9005.c |   14 ++-
 drivers/media/dvb/dvb-usb/af9015.c |  316 +++++++++++++++++++++++++++---------
 3 files changed, 260 insertions(+), 91 deletions(-)
#6 lore raw

PATCH 1/2 a800: use symbolic names for a800_table indices

The USB id table opens with a comment:

	/* do not change the order of the ID table */

because the dvb_usb_device_properties::devices field makes use of USB ids using hardcoded indices, as in "&a800_table[1]". Inserting new USB ids before the end of the table can cause these indices to go stale and the code to misbehave.

In the spirit of "dw2102: use symbolic names for dw2102_table indices", use symbolic names for the indices and C99-style initializers to ensure they continue to refer to the entries they are supposed to. Now you can reorder entries in the id table without fear.

---
 drivers/media/dvb/dvb-usb/a800.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/media/dvb/dvb-usb/a800.c +14 -7
index 2aef3c89e9fa..3f7ab144218b 100644
@@ -110,11 +110,17 @@ static int a800_probe(struct usb_interface *intf,
 				   THIS_MODULE, NULL, adapter_nr);
 }
 
-/* do not change the order of the ID table */
+enum a800_table_entry {
+	AVERMEDIA_A800_COLD,
+	AVERMEDIA_A800_WARM
+};
+
 static struct usb_device_id a800_table [] = {
-/* 00 */	{ USB_DEVICE(USB_VID_AVERMEDIA,     USB_PID_AVERMEDIA_DVBT_USB2_COLD) },
-/* 01 */	{ USB_DEVICE(USB_VID_AVERMEDIA,     USB_PID_AVERMEDIA_DVBT_USB2_WARM) },
-			{ }		/* Terminating entry */
+	[AVERMEDIA_A800_COLD] = {USB_DEVICE(USB_VID_AVERMEDIA,
+					USB_PID_AVERMEDIA_DVBT_USB2_COLD)},
+	[AVERMEDIA_A800_WARM] = {USB_DEVICE(USB_VID_AVERMEDIA,
+					USB_PID_AVERMEDIA_DVBT_USB2_WARM)},
+	{ }
 };
 MODULE_DEVICE_TABLE (usb, a800_table);
 
@@ -169,9 +175,10 @@ static struct dvb_usb_device_properties a800_properties = {
 	.generic_bulk_ctrl_endpoint = 0x01,
 	.num_device_descs = 1,
 	.devices = {
-		{   "AVerMedia AverTV DVB-T USB 2.0 (A800)",
-			{ &a800_table[0], NULL },
-			{ &a800_table[1], NULL },
+		{
+			.name = "AVerMedia AverTV DVB-T USB 2.0 (A800)",
+			.cold_ids = {&a800_table[AVERMEDIA_A800_COLD], NULL},
+			.warm_ids = {&a800_table[AVERMEDIA_A800_WARM], NULL},
 		},
 	}
 };
Signature · 1 line
1.7.8.3
#7 lore raw

PATCH 2/2 af9005, af9015: use symbolic names for USB id table indices

In reply to Jonathan Nieder

The af9005_properties and af9015_properties tables make use of USB ids from the USB id tables with hardcoded indices, as in "&af9015_usb_table[30]". Adding new entries before the end breaks such references, so everyone has had to carefully tiptoe to only add entries at the end of the list.

In the spirit of "dw2102: use symbolic names for dw2102_table indices", use C99-style initializers with symbolic names for each index to avoid this. In the new regime, properties tables referring to the USB ids have names like "&af9015_usb_table[CINERGY_T_STICK_RC]" that do not change meaning when items in the USB id table are reordered.

---
 drivers/media/dvb/dvb-usb/af9005.c |   23 ++-
 drivers/media/dvb/dvb-usb/af9015.c |  316 +++++++++++++++++++++++++++---------
 2 files changed, 252 insertions(+), 87 deletions(-)
drivers/media/dvb/dvb-usb/af9005.c +16 -7
index bd51a764351b..5d5e32f4e99d 100644
@@ -977,11 +977,20 @@ static int af9005_usb_probe(struct usb_interface *intf,
 				   THIS_MODULE, NULL, adapter_nr);
 }
 
+enum af9005_usb_table_entry {
+	AFATECH_AF9005,
+	TERRATEC_AF9005,
+	ANSONIC_AF9005,
+};
+
 static struct usb_device_id af9005_usb_table[] = {
-	{USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9005)},
-	{USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_USB_XE)},
-	{USB_DEVICE(USB_VID_ANSONIC, USB_PID_ANSONIC_DVBT_USB)},
-	{0},
+	[AFATECH_AF9005] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9005)},
+	[TERRATEC_AF9005] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_USB_XE)},
+	[ANSONIC_AF9005] = {USB_DEVICE(USB_VID_ANSONIC,
+				USB_PID_ANSONIC_DVBT_USB)},
+	{ }
 };
 
 MODULE_DEVICE_TABLE(usb, af9005_usb_table);
@@ -1041,15 +1050,15 @@ static struct dvb_usb_device_properties af9005_properties = {
 	.num_device_descs = 3,
 	.devices = {
 		    {.name = "Afatech DVB-T USB1.1 stick",
-		     .cold_ids = {&af9005_usb_table[0], NULL},
+		     .cold_ids = {&af9005_usb_table[AFATECH_AF9005], NULL},
 		     .warm_ids = {NULL},
 		     },
 		    {.name = "TerraTec Cinergy T USB XE",
-		     .cold_ids = {&af9005_usb_table[1], NULL},
+		     .cold_ids = {&af9005_usb_table[TERRATEC_AF9005], NULL},
 		     .warm_ids = {NULL},
 		     },
 		    {.name = "Ansonic DVB-T USB1.1 stick",
-		     .cold_ids = {&af9005_usb_table[2], NULL},
+		     .cold_ids = {&af9005_usb_table[ANSONIC_AF9005], NULL},
 		     .warm_ids = {NULL},
 		     },
 		    {NULL},
drivers/media/dvb/dvb-usb/af9015.c +236 -80

460 lines not on this page · raw message

Signature · 1 line
1.7.8.3
Acked-by on v1 2/2
#8 lore raw

Re: [PATCH 2/2] [media] af9005, af9015: use symbolic names for USB id table indices

Al 07/01/12 09:11, En/na Jonathan Nieder ha escrit:

Quoted 13 lines

The af9005_properties and af9015_properties tables make use of USB ids from the USB id tables with hardcoded indices, as in "&af9015_usb_table[30]". Adding new entries before the end breaks such references, so everyone has had to carefully tiptoe to only add entries at the end of the list.

In the spirit of "dw2102: use symbolic names for dw2102_table indices", use C99-style initializers with symbolic names for each index to avoid this. In the new regime, properties tables referring to the USB ids have names like "&af9015_usb_table[CINERGY_T_STICK_RC]" that do not change meaning when items in the USB id table are reordered.

Quoted 2 lines

Seems good to me, didn't know you could do that in C.

Bye

Signature · 1 line
Luca
Acked-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] [media] af9005, af9015: use symbolic names for USB id table indices

In reply to Jonathan Nieder

About AF9015

I have already done that for my newer drivers, but not for AF9015 as it was so old and many device IDs...

Antti

Quoted 536 lines · Jonathan Nieder

The af9005_properties and af9015_properties tables make use of USB ids from the USB id tables with hardcoded indices, as in "&af9015_usb_table[30]". Adding new entries before the end breaks such references, so everyone has had to carefully tiptoe to only add entries at the end of the list.

In the spirit of "dw2102: use symbolic names for dw2102_table indices", use C99-style initializers with symbolic names for each index to avoid this. In the new regime, properties tables referring to the USB ids have names like "&af9015_usb_table[CINERGY_T_STICK_RC]" that do not change meaning when items in the USB id table are reordered.

---
  drivers/media/dvb/dvb-usb/af9005.c |   23 ++-
  drivers/media/dvb/dvb-usb/af9015.c |  316 +++++++++++++++++++++++++++---------
  2 files changed, 252 insertions(+), 87 deletions(-)
drivers/media/dvb/dvb-usb/af9005.c +16 -7
index bd51a764351b..5d5e32f4e99d 100644
@@ -977,11 +977,20 @@ static int af9005_usb_probe(struct usb_interface *intf,
  				   THIS_MODULE, NULL, adapter_nr);
  }
 
+enum af9005_usb_table_entry {
+	AFATECH_AF9005,
+	TERRATEC_AF9005,
+	ANSONIC_AF9005,
+};
+
  static struct usb_device_id af9005_usb_table[] = {
-	{USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9005)},
-	{USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_USB_XE)},
-	{USB_DEVICE(USB_VID_ANSONIC, USB_PID_ANSONIC_DVBT_USB)},
-	{0},
+	[AFATECH_AF9005] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9005)},
+	[TERRATEC_AF9005] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_USB_XE)},
+	[ANSONIC_AF9005] = {USB_DEVICE(USB_VID_ANSONIC,
+				USB_PID_ANSONIC_DVBT_USB)},
+	{ }
  };
 
  MODULE_DEVICE_TABLE(usb, af9005_usb_table);
@@ -1041,15 +1050,15 @@ static struct dvb_usb_device_properties af9005_properties = {
  	.num_device_descs = 3,
  	.devices = {
  		    {.name = "Afatech DVB-T USB1.1 stick",
-		     .cold_ids = {&af9005_usb_table[0], NULL},
+		     .cold_ids = {&af9005_usb_table[AFATECH_AF9005], NULL},
  		     .warm_ids = {NULL},
  		     },
  		    {.name = "TerraTec Cinergy T USB XE",
-		     .cold_ids = {&af9005_usb_table[1], NULL},
+		     .cold_ids = {&af9005_usb_table[TERRATEC_AF9005], NULL},
  		     .warm_ids = {NULL},
  		     },
  		    {.name = "Ansonic DVB-T USB1.1 stick",
-		     .cold_ids = {&af9005_usb_table[2], NULL},
+		     .cold_ids = {&af9005_usb_table[ANSONIC_AF9005], NULL},
  		     .warm_ids = {NULL},
  		     },
  		    {NULL},
drivers/media/dvb/dvb-usb/af9015.c +236 -80
index 7959053d54ed..e755d7637c22 100644
@@ -1343,49 +1343,112 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
  	return ret;
  }
 
+enum af9015_usb_table_entry {
+	AFATECH_9015,
+	AFATECH_9016,
+	WINFAST_DTV_GOLD,
+	PINNACLE_PCTV_71E,
+	KWORLD_PLUSTV_399U,
+	TINYTWIN,
+	AZUREWAVE_TU700,
+	TERRATEC_AF9015,
+	KWORLD_PLUSTV_PC160,
+	AVERTV_VOLAR_X,
+	XTENSIONS_380U,
+	MSI_DIGIVOX_DUO,
+	AVERTV_VOLAR_X_REV2,
+	TELESTAR_STARSTICK_2,
+	AVERMEDIA_A309_USB,
+	MSI_DIGIVOX_MINI_III,
+	KWORLD_E396,
+	KWORLD_E39B,
+	KWORLD_E395,
+	TREKSTOR_DVBT,
+	AVERTV_A850,
+	AVERTV_A805,
+	CONCEPTRONIC_CTVDIGRCU,
+	KWORLD_MC810,
+	GENIUS_TVGO_DVB_T03,
+	KWORLD_399U_2,
+	KWORLD_PC160_T,
+	SVEON_STV20,
+	TINYTWIN_2,
+	WINFAST_DTV2000DS,
+	KWORLD_UB383_T,
+	KWORLD_E39A,
+	AVERMEDIA_A815M,
+	CINERGY_T_STICK_RC,
+	CINERGY_T_DUAL_RC,
+	AVERTV_A850T,
+	TINYTWIN_3,
+	SVEON_STV22,
+};
+
  static struct usb_device_id af9015_usb_table[] = {
-/*  0 */{USB_DEVICE(USB_VID_AFATECH,   USB_PID_AFATECH_AF9015_9015)},
-	{USB_DEVICE(USB_VID_AFATECH,   USB_PID_AFATECH_AF9015_9016)},
-	{USB_DEVICE(USB_VID_LEADTEK,   USB_PID_WINFAST_DTV_DONGLE_GOLD)},
-	{USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV71E)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_399U)},
-/*  5 */{USB_DEVICE(USB_VID_VISIONPLUS,
-		USB_PID_TINYTWIN)},
-	{USB_DEVICE(USB_VID_VISIONPLUS,
-		USB_PID_AZUREWAVE_AD_TU700)},
-	{USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_PC160_2T)},
-	{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_X)},
-/* 10 */{USB_DEVICE(USB_VID_XTENSIONS, USB_PID_XTENSIONS_XD_380)},
-	{USB_DEVICE(USB_VID_MSI_2,     USB_PID_MSI_DIGIVOX_DUO)},
-	{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_X_2)},
-	{USB_DEVICE(USB_VID_TELESTAR,  USB_PID_TELESTAR_STARSTICK_2)},
-	{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A309)},
-/* 15 */{USB_DEVICE(USB_VID_MSI_2,     USB_PID_MSI_DIGI_VOX_MINI_III)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_395U)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_395U_2)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_395U_3)},
-	{USB_DEVICE(USB_VID_AFATECH,   USB_PID_TREKSTOR_DVBT)},
-/* 20 */{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A850)},
-	{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A805)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_CONCEPTRONIC_CTVDIGRCU)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_MC810)},
-	{USB_DEVICE(USB_VID_KYE,       USB_PID_GENIUS_TVGO_DVB_T03)},
-/* 25 */{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_399U_2)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_PC160_T)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_SVEON_STV20)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_TINYTWIN_2)},
-	{USB_DEVICE(USB_VID_LEADTEK,   USB_PID_WINFAST_DTV2000DS)},
-/* 30 */{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_UB383_T)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_395U_4)},
-	{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A815M)},
-	{USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_CINERGY_T_STICK_RC)},
-	{USB_DEVICE(USB_VID_TERRATEC,
-		USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC)},
-/* 35 */{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A850T)},
-	{USB_DEVICE(USB_VID_GTEK,      USB_PID_TINYTWIN_3)},
-	{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_SVEON_STV22)},
-	{0},
+	[AFATECH_9015] =
+		{USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9015_9015)},
+	[AFATECH_9016] =
+		{USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9015_9016)},
+	[WINFAST_DTV_GOLD] =
+		{USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_GOLD)},
+	[PINNACLE_PCTV_71E] =
+		{USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV71E)},
+	[KWORLD_PLUSTV_399U] =
+		{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U)},
+	[TINYTWIN] = {USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TINYTWIN)},
+	[AZUREWAVE_TU700] =
+		{USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_AZUREWAVE_AD_TU700)},
+	[TERRATEC_AF9015] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2)},
+	[KWORLD_PLUSTV_PC160] =
+		{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_PC160_2T)},
+	[AVERTV_VOLAR_X] =
+		{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_X)},
+	[XTENSIONS_380U] =
+		{USB_DEVICE(USB_VID_XTENSIONS, USB_PID_XTENSIONS_XD_380)},
+	[MSI_DIGIVOX_DUO] =
+		{USB_DEVICE(USB_VID_MSI_2, USB_PID_MSI_DIGIVOX_DUO)},
+	[AVERTV_VOLAR_X_REV2] =
+		{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_X_2)},
+	[TELESTAR_STARSTICK_2] =
+		{USB_DEVICE(USB_VID_TELESTAR,  USB_PID_TELESTAR_STARSTICK_2)},
+	[AVERMEDIA_A309_USB] =
+		{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A309)},
+	[MSI_DIGIVOX_MINI_III] =
+		{USB_DEVICE(USB_VID_MSI_2, USB_PID_MSI_DIGI_VOX_MINI_III)},
+	[KWORLD_E396] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U)},
+	[KWORLD_E39B] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_2)},
+	[KWORLD_E395] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_3)},
+	[TREKSTOR_DVBT] = {USB_DEVICE(USB_VID_AFATECH, USB_PID_TREKSTOR_DVBT)},
+	[AVERTV_A850] = {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A850)},
+	[AVERTV_A805] = {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A805)},
+	[CONCEPTRONIC_CTVDIGRCU] =
+		{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CONCEPTRONIC_CTVDIGRCU)},
+	[KWORLD_MC810] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_MC810)},
+	[GENIUS_TVGO_DVB_T03] =
+		{USB_DEVICE(USB_VID_KYE, USB_PID_GENIUS_TVGO_DVB_T03)},
+	[KWORLD_399U_2] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U_2)},
+	[KWORLD_PC160_T] =
+		{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_PC160_T)},
+	[SVEON_STV20] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20)},
+	[TINYTWIN_2] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_TINYTWIN_2)},
+	[WINFAST_DTV2000DS] =
+		{USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)},
+	[KWORLD_UB383_T] =
+		{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)},
+	[KWORLD_E39A] =
+		{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)},
+	[AVERMEDIA_A815M] =
+		{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A815M)},
+	[CINERGY_T_STICK_RC] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_STICK_RC)},
+	[CINERGY_T_DUAL_RC] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC)},
+	[AVERTV_A850T] =
+		{USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A850T)},
+	[TINYTWIN_3] = {USB_DEVICE(USB_VID_GTEK, USB_PID_TINYTWIN_3)},
+	[SVEON_STV22] = {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV22)},
+	{ }
  };
  MODULE_DEVICE_TABLE(usb, af9015_usb_table);
 
@@ -1460,68 +1523,104 @@ static struct dvb_usb_device_properties af9015_properties[] = {
  		.devices = {
  			{
  				.name = "Afatech AF9015 DVB-T USB2.0 stick",
-				.cold_ids = {&af9015_usb_table[0],
-					&af9015_usb_table[1], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AFATECH_9015],
+					&af9015_usb_table[AFATECH_9016],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Leadtek WinFast DTV Dongle Gold",
-				.cold_ids = {&af9015_usb_table[2], NULL},
+				.cold_ids = {
+					&af9015_usb_table[WINFAST_DTV_GOLD],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Pinnacle PCTV 71e",
-				.cold_ids = {&af9015_usb_table[3], NULL},
+				.cold_ids = {
+					&af9015_usb_table[PINNACLE_PCTV_71E],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "KWorld PlusTV Dual DVB-T Stick " \
  					"(DVB-T 399U)",
-				.cold_ids = {&af9015_usb_table[4],
-					&af9015_usb_table[25], NULL},
+				.cold_ids = {
+					&af9015_usb_table[KWORLD_PLUSTV_399U],
+					&af9015_usb_table[KWORLD_399U_2],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "DigitalNow TinyTwin DVB-T Receiver",
-				.cold_ids = {&af9015_usb_table[5],
-					&af9015_usb_table[28],
-					&af9015_usb_table[36], NULL},
+				.cold_ids = {
+					&af9015_usb_table[TINYTWIN],
+					&af9015_usb_table[TINYTWIN_2],
+					&af9015_usb_table[TINYTWIN_3],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "TwinHan AzureWave AD-TU700(704J)",
-				.cold_ids = {&af9015_usb_table[6], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AZUREWAVE_TU700],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "TerraTec Cinergy T USB XE",
-				.cold_ids = {&af9015_usb_table[7], NULL},
+				.cold_ids = {
+					&af9015_usb_table[TERRATEC_AF9015],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "KWorld PlusTV Dual DVB-T PCI " \
  					"(DVB-T PC160-2T)",
-				.cold_ids = {&af9015_usb_table[8], NULL},
+				.cold_ids = {
+					&af9015_usb_table[KWORLD_PLUSTV_PC160],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "AVerMedia AVerTV DVB-T Volar X",
-				.cold_ids = {&af9015_usb_table[9], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERTV_VOLAR_X],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "TerraTec Cinergy T Stick RC",
-				.cold_ids = {&af9015_usb_table[33], NULL},
+				.cold_ids = {
+					&af9015_usb_table[CINERGY_T_STICK_RC],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "TerraTec Cinergy T Stick Dual RC",
-				.cold_ids = {&af9015_usb_table[34], NULL},
+				.cold_ids = {
+					&af9015_usb_table[CINERGY_T_DUAL_RC],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "AverMedia AVerTV Red HD+ (A850T)",
-				.cold_ids = {&af9015_usb_table[35], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERTV_A850T],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  		}
@@ -1594,57 +1693,87 @@ static struct dvb_usb_device_properties af9015_properties[] = {
  		.devices = {
  			{
  				.name = "Xtensions XD-380",
-				.cold_ids = {&af9015_usb_table[10], NULL},
+				.cold_ids = {
+					&af9015_usb_table[XTENSIONS_380U],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "MSI DIGIVOX Duo",
-				.cold_ids = {&af9015_usb_table[11], NULL},
+				.cold_ids = {
+					&af9015_usb_table[MSI_DIGIVOX_DUO],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Fujitsu-Siemens Slim Mobile USB DVB-T",
-				.cold_ids = {&af9015_usb_table[12], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERTV_VOLAR_X_REV2],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Telestar Starstick 2",
-				.cold_ids = {&af9015_usb_table[13], NULL},
+				.cold_ids = {
+					&af9015_usb_table[TELESTAR_STARSTICK_2],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "AVerMedia A309",
-				.cold_ids = {&af9015_usb_table[14], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERMEDIA_A309_USB],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "MSI Digi VOX mini III",
-				.cold_ids = {&af9015_usb_table[15], NULL},
+				.cold_ids = {
+					&af9015_usb_table[MSI_DIGIVOX_MINI_III],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "KWorld USB DVB-T TV Stick II " \
  					"(VS-DVB-T 395U)",
-				.cold_ids = {&af9015_usb_table[16],
-					&af9015_usb_table[17],
-					&af9015_usb_table[18],
-					&af9015_usb_table[31], NULL},
+				.cold_ids = {
+					&af9015_usb_table[KWORLD_E396],
+					&af9015_usb_table[KWORLD_E39B],
+					&af9015_usb_table[KWORLD_E395],
+					&af9015_usb_table[KWORLD_E39A],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "TrekStor DVB-T USB Stick",
-				.cold_ids = {&af9015_usb_table[19], NULL},
+				.cold_ids = {
+					&af9015_usb_table[TREKSTOR_DVBT],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "AverMedia AVerTV Volar Black HD " \
  					"(A850)",
-				.cold_ids = {&af9015_usb_table[20], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERTV_A850],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Sveon STV22 Dual USB DVB-T Tuner HDTV",
-				.cold_ids = {&af9015_usb_table[37], NULL},
+				.cold_ids = {
+					&af9015_usb_table[SVEON_STV22],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  		}
@@ -1717,50 +1846,77 @@ static struct dvb_usb_device_properties af9015_properties[] = {
  		.devices = {
  			{
  				.name = "AverMedia AVerTV Volar GPS 805 (A805)",
-				.cold_ids = {&af9015_usb_table[21], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERTV_A805],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Conceptronic USB2.0 DVB-T CTVDIGRCU " \
  					"V3.0",
-				.cold_ids = {&af9015_usb_table[22], NULL},
+				.cold_ids = {
+					&af9015_usb_table[CONCEPTRONIC_CTVDIGRCU],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "KWorld Digial MC-810",
-				.cold_ids = {&af9015_usb_table[23], NULL},
+				.cold_ids = {
+					&af9015_usb_table[KWORLD_MC810],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Genius TVGo DVB-T03",
-				.cold_ids = {&af9015_usb_table[24], NULL},
+				.cold_ids = {
+					&af9015_usb_table[GENIUS_TVGO_DVB_T03],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "KWorld PlusTV DVB-T PCI Pro Card " \
  					"(DVB-T PC160-T)",
-				.cold_ids = {&af9015_usb_table[26], NULL},
+				.cold_ids = {
+					&af9015_usb_table[KWORLD_PC160_T],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Sveon STV20 Tuner USB DVB-T HDTV",
-				.cold_ids = {&af9015_usb_table[27], NULL},
+				.cold_ids = {
+					&af9015_usb_table[SVEON_STV20],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "Leadtek WinFast DTV2000DS",
-				.cold_ids = {&af9015_usb_table[29], NULL},
+				.cold_ids = {
+					&af9015_usb_table[WINFAST_DTV2000DS],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "KWorld USB DVB-T Stick Mobile " \
  					"(UB383-T)",
-				.cold_ids = {&af9015_usb_table[30], NULL},
+				.cold_ids = {
+					&af9015_usb_table[KWORLD_UB383_T],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  			{
  				.name = "AverMedia AVerTV Volar M (A815Mac)",
-				.cold_ids = {&af9015_usb_table[32], NULL},
+				.cold_ids = {
+					&af9015_usb_table[AVERMEDIA_A815M],
+					NULL
+				},
  				.warm_ids = {NULL},
  			},
  		}
Signature · 1 line
http://palosaari.fi/
#11 lore raw

[RFC/PATCH] New Terratec DVB USB IDs, symbolic names in az6027_usb_table

In reply to Jonathan Nieder

Hello Jonathan, hello LinuxTV,

Quoted 2 lines · Jonathan Nieder

Eduard, meet the LinuxTV project. linux-media folks, meet Eduard. Patch follows.

Hello guys and sorry for the delay.

Quoted 3 lines

Eduard: may we have your sign-off? Please see Documentation/SubmittingPatches, section 12 "Sign your work" for what this means.

Originally I hesitated to consider this changes trivial enough, but after adopting/rewriting many parts of it, I think we can go along with that. I also modified az6027.c to the symbolic name structure suggested by Jonathan for dw2102.c which is AFAICS already accepted in mainline kernel.

Btw, there is a little potential flaw with symbolic names: an array entry without position id impilicitly goes to the position after the last used symbolic name, which might overwrite data on another position instead of adding it where it's supposed to be (like null terminator in our case). In dw2102.c that didn't matter yet because the order of enum entries matches the device id array order, but for az6027.c I added a max-value enum entry and used the reference for the null terminator.

IMO it's subject for discussion whether this is needed/allowed/acceptable.

And there is another fix from LKML for a regression affecting several drivers including dw2102, and AFAICS it is not fixed neither in linux-3.3-rc* nor in linux-media branch yet.

Regards,
Eduard.

Quoted 1 line

From 650ff9ccd82ef11a4b87feaff9c619e562ab898a Mon Sep 17 00:00:00 2001

From: Eduard Bloch <[email protected]>
Date: Sat, 10 Mar 2012 16:13:51 +0100
Subject: [PATCH] Squashed commit of the following:

az6027.c: Use C99 style array initialization with position identifiers az6027.c: Added USB ID of latest TERRATEC S7 revision
dw2102.c: Added USB ID of latest TERRATEC Cinergy S2 USB HD dvb_frontend.c: From LKML, Signed-off-by: Simon Arlott <[email protected]>,
fixes regression from 7e0722215a510921cbb73ab4c37477d4dcb91bf8

---
 drivers/media/dvb/dvb-core/dvb_frontend.c |    2 +
 drivers/media/dvb/dvb-usb/az6027.c        |   45 ++++++++++++++++++++---------
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h   |    1 +
 drivers/media/dvb/dvb-usb/dw2102.c        |   16 +++++++++-
 4 files changed, 49 insertions(+), 15 deletions(-)
drivers/media/dvb/dvb-core/dvb_frontend.c +2 -0
index fbbe545..4555baa 100644
@@ -655,6 +655,8 @@ restart:
 					dprintk("%s: Retune requested, FESTATE_RETUNE\n", __func__);
 					re_tune = true;
 					fepriv->state = FESTATE_TUNED;
+				} else {
+					re_tune = false;
 				}
 
 				if (fe->ops.tune)
drivers/media/dvb/dvb-usb/az6027.c +31 -14

77 lines not on this page · raw message

drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
index d390dda..55cac30 100644
@@ -331,6 +331,7 @@
 #define USB_PID_AZUREWAVE_AZ6027			0x3275
 #define USB_PID_TERRATEC_DVBS2CI_V1			0x10a4
 #define USB_PID_TERRATEC_DVBS2CI_V2			0x10ac
+#define USB_PID_TERRATEC_DVBS2CI_V3			0x10b0
 #define USB_PID_TECHNISAT_USB2_HDCI_V1			0x0001
 #define USB_PID_TECHNISAT_USB2_HDCI_V2			0x0002
 #define USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2		0x0004
drivers/media/dvb/dvb-usb/dw2102.c +15 -1
index 451c5a7..87fcb7b 100644
@@ -1181,6 +1181,14 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
 {
 	u8 obuf[3] = { 0xe, 0x80, 0 };
 	u8 ibuf[] = { 0 };
+	
+	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+		err("command 0x0e transfer failed.");
+
+	//power on su3000
+	obuf[0] = 0xe;
+	obuf[1] = 0x02;
+	obuf[2] = 1;
 
 	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
 		err("command 0x0e transfer failed.");
@@ -1448,6 +1456,7 @@ enum dw2102_table_entry {
 	PROF_7500,
 	GENIATECH_SU3000,
 	TERRATEC_CINERGY_S2,
+	TERRATEC_CINERGY_S2rev2,
 	TEVII_S480_1,
 	TEVII_S480_2,
 	X3M_SPC1400HD,
@@ -1466,6 +1475,7 @@ static struct usb_device_id dw2102_table[] = {
 	[PROF_7500] = {USB_DEVICE(0x3034, 0x7500)},
 	[GENIATECH_SU3000] = {USB_DEVICE(0x1f4d, 0x3000)},
 	[TERRATEC_CINERGY_S2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
+	[TERRATEC_CINERGY_S2rev2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
 	[TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
 	[TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
 	[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
@@ -1857,7 +1867,7 @@ static struct dvb_usb_device_properties su3000_properties = {
 		}},
 		}
 	},
-	.num_device_descs = 3,
+	.num_device_descs = 4,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
 			{ &dw2102_table[GENIATECH_SU3000], NULL },
@@ -1871,6 +1881,10 @@ static struct dvb_usb_device_properties su3000_properties = {
 			{ &dw2102_table[X3M_SPC1400HD], NULL },
 			{ NULL },
 		},
+		{ "Terratec Cinergy S2 USB HD Rev.2",
+			{ &dw2102_table[TERRATEC_CINERGY_S2rev2], NULL },
+			{ NULL },
+		},
 	}
 };
 
Signature · 1 line
1.7.9.1
#12 lore raw

Re: [RFC/PATCH] New Terratec DVB USB IDs, symbolic names in az6027_usb_table

Em 10-03-2012 13:04, Eduard Bloch escreveu:

Quoted 11 lines

Hello Jonathan, hello LinuxTV,

Quoted 2 lines · Jonathan Nieder
Quoted 2 lines

Eduard, meet the LinuxTV project. linux-media folks, meet Eduard. Patch follows.

Hello guys and sorry for the delay.

Quoted 3 lines
Quoted 3 lines

Eduard: may we have your sign-off? Please see Documentation/SubmittingPatches, section 12 "Sign your work" for what this means.

Originally I hesitated to consider this changes trivial enough,

Well, trivial or not, someone has to do the patch ;)

Quoted 5 lines

but
after adopting/rewriting many parts of it, I think we can go along with that. I also modified az6027.c to the symbolic name structure suggested by Jonathan for dw2102.c which is AFAICS already accepted in mainline kernel.

Please, don't mix different logical changes on the same patch. If you have more than one change to do, send it as a patch set.

Quoted 44 lines

Btw, there is a little potential flaw with symbolic names: an array entry without position id impilicitly goes to the position after the last used symbolic name, which might overwrite data on another position instead of adding it where it's supposed to be (like null terminator in our case). In dw2102.c that didn't matter yet because the order of enum entries matches the device id array order, but for az6027.c I added a max-value enum entry and used the reference for the null terminator.

IMO it's subject for discussion whether this is needed/allowed/acceptable.

And there is another fix from LKML for a regression affecting several drivers including dw2102, and AFAICS it is not fixed neither in linux-3.3-rc* nor in linux-media branch yet.

Regards,
Eduard.

az6027-C99-init-and-Terratec-device-ids.patch

Quoted 1 line

From 650ff9ccd82ef11a4b87feaff9c619e562ab898a Mon Sep 17 00:00:00 2001

From: Eduard Bloch <[email protected]>
Date: Sat, 10 Mar 2012 16:13:51 +0100
Subject: [PATCH] Squashed commit of the following:

az6027.c: Use C99 style array initialization with position identifiers az6027.c: Added USB ID of latest TERRATEC S7 revision
dw2102.c: Added USB ID of latest TERRATEC Cinergy S2 USB HD dvb_frontend.c: From LKML, Signed-off-by: Simon Arlott <[email protected]>,
fixes regression from 7e0722215a510921cbb73ab4c37477d4dcb91bf8

---
 drivers/media/dvb/dvb-core/dvb_frontend.c |    2 +
 drivers/media/dvb/dvb-usb/az6027.c        |   45 ++++++++++++++++++++---------
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h   |    1 +
 drivers/media/dvb/dvb-usb/dw2102.c        |   16 +++++++++-
 4 files changed, 49 insertions(+), 15 deletions(-)
drivers/media/dvb/dvb-core/dvb_frontend.c +0 -0
index fbbe545..4555baa 100644

drivers/media/dvb/dvb-core/dvb_frontend.c restart: · line 660

Quoted 6 lines
drivers/media/dvb/dvb-core/dvb_frontend.c +2 -0
@@ -655,6 +655,8 @@ restart:
 					dprintk("%s: Retune requested, FESTATE_RETUNE\n", __func__);
 					re_tune = true;
 					fepriv->state = FESTATE_TUNED;
+				} else {
+					re_tune = false;
 				}

This were fixed on another patch. I think that the patch is already upstream.

Quoted 10 lines
drivers/media/dvb/dvb-core/dvb_frontend.c +0 -0
 				if (fe->ops.tune)
drivers/media/dvb/dvb-usb/az6027.c +0 -0
index 5e45ae6..eee669c 100644
@@ -1079,15 +1079,28 @@ int az6027_identify_state(struct usb_device *udev,
 	return 0;
 }
 

drivers/media/dvb/dvb-usb/az6027.c int az6027_identify_state(struct usb_device *udev, · line 1091

Quoted 10 lines
drivers/media/dvb/dvb-usb/az6027.c +10 -0
+enum az6027_table_entry {
+	AZUREWAVE_AZ6027,
+	ELGATO_EYETV_SAT,
+	TECHNISAT_USB2_HDCI_V1,
+	TECHNISAT_USB2_HDCI_V2,
+	TERRATEC_DVBS2CI_V1,
+	TERRATEC_DVBS2CI_V2,
+	TERRATEC_DVBS2CI_V3,
+
+	az6027_table_entry_enum_max

Please use uppercases on the above.

Quoted 70 lines
drivers/media/dvb/dvb-usb/az6027.c +21 -14
+};
 
 static struct usb_device_id az6027_usb_table[] = {
-	{ USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) },
-	{ USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V1) },
-	{ USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V2) },
-	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) },
-	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) },
-	{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) },
-	{ },
+	[AZUREWAVE_AZ6027] = { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) },
+	[ELGATO_EYETV_SAT] = { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) },
+	[TECHNISAT_USB2_HDCI_V1] = { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) },
+	[TECHNISAT_USB2_HDCI_V2] = { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) },
+	[TERRATEC_DVBS2CI_V1] = { USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V1) },
+	[TERRATEC_DVBS2CI_V2] = { USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V2) },
+	[TERRATEC_DVBS2CI_V3] = { USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI_V3) },
+
+	[az6027_table_entry_enum_max] = { 0 }
 };
 
 MODULE_DEVICE_TABLE(usb, az6027_usb_table);
@@ -1135,31 +1148,35 @@ static struct dvb_usb_device_properties az6027_properties = {
 
 	.i2c_algo         = &az6027_i2c_algo,
 
-	.num_device_descs = 6,
+	.num_device_descs = 7,
 	.devices = {
 		{
 			.name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)",
-			.cold_ids = { &az6027_usb_table[0], NULL },
+			.cold_ids = { &az6027_usb_table[AZUREWAVE_AZ6027], NULL },
 			.warm_ids = { NULL },
 		}, {
 			.name = "TERRATEC S7",
-			.cold_ids = { &az6027_usb_table[1], NULL },
+			.cold_ids = { &az6027_usb_table[TERRATEC_DVBS2CI_V1], NULL },
 			.warm_ids = { NULL },
 		}, {
 			.name = "TERRATEC S7 MKII",
-			.cold_ids = { &az6027_usb_table[2], NULL },
+			.cold_ids = { &az6027_usb_table[TERRATEC_DVBS2CI_V2], NULL },
 			.warm_ids = { NULL },
 		}, {
 			.name = "Technisat SkyStar USB 2 HD CI",
-			.cold_ids = { &az6027_usb_table[3], NULL },
+			.cold_ids = { &az6027_usb_table[TECHNISAT_USB2_HDCI_V1], NULL },
 			.warm_ids = { NULL },
 		}, {
 			.name = "Technisat SkyStar USB 2 HD CI",
-			.cold_ids = { &az6027_usb_table[4], NULL },
+			.cold_ids = { &az6027_usb_table[TECHNISAT_USB2_HDCI_V2], NULL },
 			.warm_ids = { NULL },
 		}, {
 			.name = "Elgato EyeTV Sat",
-			.cold_ids = { &az6027_usb_table[5], NULL },
+			.cold_ids = { &az6027_usb_table[ELGATO_EYETV_SAT], NULL },
+			.warm_ids = { NULL },
+		}, {
+			.name = "TERRATEC S7 Rev.3",
+			.cold_ids = { &az6027_usb_table[TERRATEC_DVBS2CI_V3], NULL },
 			.warm_ids = { NULL },
 		},
 		{ NULL },
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +0 -0
index d390dda..55cac30 100644

drivers/media/dvb/dvb-usb/dvb-usb-ids.h line 337

Quoted 7 lines
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
@@ -331,6 +331,7 @@
 #define USB_PID_AZUREWAVE_AZ6027			0x3275
 #define USB_PID_TERRATEC_DVBS2CI_V1			0x10a4
 #define USB_PID_TERRATEC_DVBS2CI_V2			0x10ac
+#define USB_PID_TERRATEC_DVBS2CI_V3			0x10b0
 #define USB_PID_TECHNISAT_USB2_HDCI_V1			0x0001
 #define USB_PID_TECHNISAT_USB2_HDCI_V2			0x0002
 #define USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2		0x0004

Ideally, the above should be on two separate patches, one adding the new USB IDs and the other one converting the structure to use the new way. That makes easier for reviewers to see what changed on each patch.

drivers/media/dvb/dvb-usb/dw2102.c static int su3000_frontend_attach(struct dvb_usb_adapter *d) · line 1188

Quoted 13 lines
drivers/media/dvb/dvb-usb/dw2102.c +5 -0
index 451c5a7..87fcb7b 100644
@@ -1181,6 +1181,14 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
 {
 	u8 obuf[3] = { 0xe, 0x80, 0 };
 	u8 ibuf[] = { 0 };
+	
+	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+		err("command 0x0e transfer failed.");
+
+	//power on su3000

Don't use // comments. Did you ran scripts/checkpatch.pl? It should have warned you that the above syntax is not allowed.

drivers/media/dvb/dvb-usb/dw2102.c static int su3000_frontend_attach(struct dvb_usb_adapter *d) · line 1194

Quoted 6 lines
drivers/media/dvb/dvb-usb/dw2102.c +3 -0
+	obuf[0] = 0xe;
+	obuf[1] = 0x02;
+	obuf[2] = 1;
 
 	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
 		err("command 0x0e transfer failed.");

The above code is a separate patch. Btw, for each patch, you should add a description saying why the change is needed.

Quoted 26 lines
drivers/media/dvb/dvb-usb/dw2102.c +3 -1
@@ -1448,6 +1456,7 @@ enum dw2102_table_entry {
 	PROF_7500,
 	GENIATECH_SU3000,
 	TERRATEC_CINERGY_S2,
+	TERRATEC_CINERGY_S2rev2,
 	TEVII_S480_1,
 	TEVII_S480_2,
 	X3M_SPC1400HD,
@@ -1466,6 +1475,7 @@ static struct usb_device_id dw2102_table[] = {
 	[PROF_7500] = {USB_DEVICE(0x3034, 0x7500)},
 	[GENIATECH_SU3000] = {USB_DEVICE(0x1f4d, 0x3000)},
 	[TERRATEC_CINERGY_S2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
+	[TERRATEC_CINERGY_S2rev2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
 	[TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
 	[TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
 	[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
@@ -1857,7 +1867,7 @@ static struct dvb_usb_device_properties su3000_properties = {
 		}},
 		}
 	},
-	.num_device_descs = 3,
+	.num_device_descs = 4,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
 			{ &dw2102_table[GENIATECH_SU3000], NULL },

drivers/media/dvb/dvb-usb/dw2102.c static struct dvb_usb_device_properties su3000_properties = { · line 1889

Quoted 9 lines
drivers/media/dvb/dvb-usb/dw2102.c +4 -0
@@ -1871,6 +1881,10 @@ static struct dvb_usb_device_properties su3000_properties = {
 			{ &dw2102_table[X3M_SPC1400HD], NULL },
 			{ NULL },
 		},
+		{ "Terratec Cinergy S2 USB HD Rev.2",
+			{ &dw2102_table[TERRATEC_CINERGY_S2rev2], NULL },
+			{ NULL },
+		},
 	}
 };

This should be a separate patchset as well, as it adds support for a new device variant.

Regards,
Mauro