summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorPatrick Boettcher <devnull@localhost>2005-03-31 18:55:37 +0000
committerPatrick Boettcher <devnull@localhost>2005-03-31 18:55:37 +0000
commit1d6c24e8bb867fb63c46b1be11c08dde5d9c6b9b (patch)
treeb4e1c3f4ddff0cd8ec1ca312c139aebe42ac9544 /linux/drivers/media
parent4ae33e4f5ab7230b6a4650fc00536f17ee5875a4 (diff)
downloadmediapointer-dvb-s2-1d6c24e8bb867fb63c46b1be11c08dde5d9c6b9b.tar.gz
mediapointer-dvb-s2-1d6c24e8bb867fb63c46b1be11c08dde5d9c6b9b.tar.bz2
- added read_mac_address-callback
- filling the MAC address into dvb_adapter->proposed_mac Thanks to Andreas Oberritter for pointing out.
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c11
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb.h7
-rw-r--r--linux/drivers/media/dvb/dvb-usb/vp7045.c44
-rw-r--r--linux/drivers/media/dvb/dvb-usb/vp7045.h51
4 files changed, 81 insertions, 32 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index 55864a891..643aeb3d2 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -87,6 +87,17 @@ int dvb_usb_dvb_init(struct dvb_usb_device *d)
}
d->dvb_adap.priv = d;
+ if (d->props.read_mac_address) {
+ if (d->props.read_mac_address(d,d->dvb_adap.proposed_mac) == 0)
+ info("MAC address: %02x:%02x:%02x:%02x:%02x:%02x",d->dvb_adap.proposed_mac[0],
+ d->dvb_adap.proposed_mac[1],d->dvb_adap.proposed_mac[2],
+ d->dvb_adap.proposed_mac[3],d->dvb_adap.proposed_mac[4],
+ d->dvb_adap.proposed_mac[5]);
+ else
+ err("MAC reading failed.");
+ }
+
+
d->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
d->demux.priv = d;
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
index d7835721b..7f08936ce 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -25,8 +25,8 @@
do { if ((var & level)) { printk(args); } } while (0)
#define debug_dump(b,l,func) {\
- int i; \
- for (i = 0; i < l; i++) func("%02x ", b[i]); \
+ int loop_; \
+ for (loop_ = 0; loop_ < l; loop_++) func("%02x ", b[loop_]); \
func("\n");\
}
#define DVB_USB_DEBUG_STATUS
@@ -79,10 +79,13 @@ struct dvb_usb_properties {
int (*pid_filter) (struct dvb_usb_device *, int, u16, int); /* if the device has a hardware pid filter */
int (*pid_filter_ctrl) (struct dvb_usb_device *, int); /* if the device has a hardware pid filter to en-/disable */
+ int (*read_mac_address) (struct dvb_usb_device *, u8 []); /* callback for reading the MAC address */
+
int (*power_ctrl) (struct dvb_usb_device *, int); /* power control callback of the device */
int (*frontend_attach) (struct dvb_usb_device *); /* each device has to know about its frontends */
+
struct dvb_usb_device_description * (*identify_desc_quirk) (void); /* the device is not distinuishable just by its USB IDs */
#define USB_REMOTE_PROTO_NO 1
diff --git a/linux/drivers/media/dvb/dvb-usb/vp7045.c b/linux/drivers/media/dvb/dvb-usb/vp7045.c
index 103c36361..10945591b 100644
--- a/linux/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/linux/drivers/media/dvb/dvb-usb/vp7045.c
@@ -94,12 +94,32 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u8 *key_buf, int *state)
{
deb_info("remote query\n");
*state = REMOTE_KEY_NO;
- return 0; //vp7045_usb_op(d,RC_VAL_READ,&v,1,NULL,0,20);
+ return 0; //vp7045_usb_op(d,RC_VAL_READ,NULL,0,&v,1,20);
+}
+
+static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset)
+{
+ int i = 0;
+ u8 v,br[2];
+ for (i=0; i < len; i++) {
+ v = offset + i;
+ vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5);
+ buf[i] = br[1];
+ }
+ deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i);
+ debug_dump(buf,i,deb_info);
+ return 0;
+}
+
+
+static int vp7045_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
+{
+ return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR);
}
static int vp7045_frontend_attach(struct dvb_usb_device *d)
{
- u8 buf[20];
+ u8 buf[255] = { 0 };
vp7045_usb_op(d,VENDOR_STRING_READ,NULL,0,buf,20,0);
buf[10] = '\0';
@@ -113,6 +133,9 @@ static int vp7045_frontend_attach(struct dvb_usb_device *d)
buf[10] = '\0';
deb_info("v%s\n",buf);
+/* Dump the EEPROM */
+/* vp7045_read_eeprom(d,buf, 255, FX2_ID_ADDR); */
+
d->fe = vp7045_fe_attach(d);
return 0;
@@ -138,15 +161,16 @@ static struct dvb_usb_properties vp7045_properties = {
.usb_ctrl = CYPRESS_FX2,
.firmware = "dvb-usb-vp7045-01.fw",
- .streaming_ctrl = NULL,
- .pid_filter = NULL,
- .pid_filter_ctrl = NULL,
- .power_ctrl = vp7045_power_ctrl,
- .frontend_attach = vp7045_frontend_attach,
+ .streaming_ctrl = NULL,
+ .pid_filter = NULL,
+ .pid_filter_ctrl = NULL,
+ .power_ctrl = vp7045_power_ctrl,
+ .frontend_attach = vp7045_frontend_attach,
+ .read_mac_address = vp7045_read_mac_addr,
- .rc_interval = 400,
- .remote_protocol = USB_REMOTE_PROTO_NEC,
- .query_rc = vp7045_rc_query,
+ .rc_interval = 400,
+ .remote_protocol = USB_REMOTE_PROTO_NEC,
+ .query_rc = vp7045_rc_query,
/* parameter for the MPEG2-data transfer */
.urb = {
diff --git a/linux/drivers/media/dvb/dvb-usb/vp7045.h b/linux/drivers/media/dvb/dvb-usb/vp7045.h
index e1f2eb4a3..0ff5e5dc6 100644
--- a/linux/drivers/media/dvb/dvb-usb/vp7045.h
+++ b/linux/drivers/media/dvb/dvb-usb/vp7045.h
@@ -27,37 +27,48 @@ extern int dvb_usb_vp7045_debug;
#define TH_COMMAND_IN 0xC0
#define TH_COMMAND_OUT 0xC1
-/* TH_COMMAND_OUT request type */
+/* command bytes */
#define TUNER_REG_READ 0x03
#define TUNER_REG_WRITE 0x04
+
#define RC_VAL_READ 0x05
+ #define RC_NO_KEY 0x44
+
#define SET_TUNER_POWER 0x06
+#define CHECK_TUNER_POWER 0x12
+ #define Tuner_Power_ON 1
+ #define Tuner_Power_OFF 0
+
#define GET_USB_SPEED 0x07
+ #define USB_SPEED_LOW 0
+ #define USB_SPEED_FULL 1
+ #define USB_SPEED_HIGH 2
+
#define LOCK_TUNER_COMMAND 0x09
+
#define TUNER_SIGNAL_READ 0x0A
-#define FW_VERSION_READ 0x0B
-#define VENDOR_STRING_READ 0x0C
-#define PRODUCT_STRING_READ 0x0D
+
+/* FX2 eeprom */
#define SET_EE_VALUE 0x10
#define GET_EE_VALUE 0x11
-#define CHECK_TUNER_POWER 0x12
-#define RESET_FX2 0x13
-#define FW_BCD_VERSION_READ 0x14
-
-#define Tuner_Power_ON 1
-#define Tuner_Power_OFF 0
-
-#define Tuner_Lock 1
-#define Tuner_UnLock 0
+ #define FX2_ID_ADDR 0x00
+ #define VID_MSB_ADDR 0x02
+ #define VID_LSB_ADDR 0x01
+ #define PID_MSB_ADDR 0x04
+ #define PID_LSB_ADDR 0x03
+ #define MAC_0_ADDR 0x07
+ #define MAC_1_ADDR 0x08
+ #define MAC_2_ADDR 0x09
+ #define MAC_3_ADDR 0x0a
+ #define MAC_4_ADDR 0x0b
+ #define MAC_5_ADDR 0x0c
-#define USB_SPEED_LOW 0
-#define USB_SPEED_FULL 1
-#define USB_SPEED_HIGH 2
+#define RESET_FX2 0x13
-#define TUNER_REG_QUALITY_2 0x0A
-#define TUNER_REG_QUALITY_1 0x0B
-#define TUNER_REG_QUALITY_0 0x0C
-#define TUNER_REG_STRENGTH 0x09
+#define FW_VERSION_READ 0x0B
+#define VENDOR_STRING_READ 0x0C
+#define PRODUCT_STRING_READ 0x0D
+#define FW_BCD_VERSION_READ 0x14
extern struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d);
extern int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen,int msec);