From c0dd634c8b5b2eb7c566ad5a8d8e0a75ac4058c3 Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Fri, 21 Sep 2012 22:01:45 +0200 Subject: Josef Gercak's latest patches for the Asus U3100Mini Plus Only the asus stick should work with this on 3.2 kernel. Other tuners/demodulators etc are disabled. Untested. --- Makefile | 26 ++++----- README | 21 ++++---- api/demodulatorextend.c | 133 +++++++++++---------------------------------- api/i2c_driver.c | 2 +- api/standard.c | 2 + api/type.h | 1 + api/usb2impl.c | 7 ++- src/af903x-core.c | 22 +++----- src/af903x-devices.c | 141 +++++++++++++++++++++++++++++++----------------- src/af903x-drv.c | 16 ++++-- src/af903x-fe.c | 40 +++++++------- src/af903x-tuner.c | 5 +- src/af903x.h | 12 +---- 13 files changed, 196 insertions(+), 232 deletions(-) mode change 100644 => 100755 Makefile diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index 6e6ba8f..5c212ee --- a/Makefile +++ b/Makefile @@ -3,29 +3,20 @@ EXTRA_CFLAGS = -DEXPORT_SYMTAB CURRENT = $(shell uname -r) KDIR = /lib/modules/$(CURRENT)/build PWD = $(shell pwd) -KDIR26 := /lib/modules/$(CURRENT)/kernel/drivers/media/dvb/dvb-usb +KDIR26 := /lib/modules/$(CURRENT)/kernel/drivers/media/dvb/dvb-usb + dvb-usb-af903x-objs := \ af903x-core.o af903x-devices.o af903x-fe.o af903x-drv.o af903x-tuner.o\ cmd.o standard.o demodulator.o demodulatorextend.o \ usb2impl.o user.o \ - Afa_AF9007.o TDA18291.o Fitipower_FC0011.o\ - Philips_TDA18291HN.o Microtune_MT2266.o mt2266.o \ - mt2266_userdef.o Infineon_TUA9001.o driver_tua9001.o \ - Afa_PEACOCK.o Infineon_TUA8010.o driver_tua8010.o\ - e4000.o Elonics_E4000.o fc2580.o FCI_FC2580.o\ - Fitipower_FC0012.o Freescale_MC44CD02.o Infineon_TUA6039.o\ - ITD30x0.o Integrant_ITD3020.o Maxlinear_MXL5005.o MXL5005.o\ - MXL5005_Initialize.o Microtune_MT2260B0.o mt2260.o\ - mt2260_userdef.o Panasonic_ENV77H11D5.o Peacock.o\ - Philips_FQD1218ME_MK5.o Philips_TD1316AFIHP.o xc3028_control.o\ - Xceive_XC3028L.o i2c_driver.o xc4000_control.o Xceive_XC4000.o\ - Philips_TDA18271.o TDA18271.o Philips_TDA18271_C2.o\ - TDA18271_C2.o Philips_TDA18271_C2_Askey.o TDA18271_C2_Askey.o -obj-m += dvb-usb-af903x.o + fc2580.o FCI_FC2580.o + +obj-m += dvb-usb-af903x.o default: - @(cp v4l/* ./; cp ./api/* ./; cp src/* ./) + @cp -f v4l/* ./ + @(cp api/*.* ./; cp src/*.* ./) make -C $(KDIR) SUBDIRS=$(PWD) modules install: @@ -41,8 +32,9 @@ remove: @files='dvb-af903x.ko'; for i in $$files;do if [ -e $(KDIR26)/$$i ]; then echo -n "$$i "; rm $(KDIR26)/$$i; fi; done; for i in $$files;do if [ -e $(KDIR26)/$$i.gz ]; then echo -n "$$i.gz "; rm $(KDIR26)/$$i.gz; fi; done; echo; clean: - @-rm -rf *~ *.o *.ko .*.o.cmd .*.ko.cmd *.mod.c *.*~ *.c *.h .tmp_versions \ + @-rm -f *~ *.o *.ko .*.o.cmd .*.ko.cmd *.mod.c *.*~ *.c *.h \ demux.h dmxdev.h dvb-pll.h dvb-usb-ids.h dvb-usb.h dvb_demux.h dvb_frontend.h \ dvb_net.h dvb_ringbuffer.h dvbdev.h modules.order Module.markers Module.symvers -include $(KDIR)/Rules.make + diff --git a/README b/README index 2016042..bfc01e2 100644 --- a/README +++ b/README @@ -1,17 +1,16 @@ this is modified original AF903x driver v9.08.14.1 -!!! works with linux-2.6.35 and newer +current version AF903x driver v9.08.14.2 +!!! works only with linux-3.2.1 and newer -- Valid kernel sources, or headers need to exist in (a symlink to) /usr/src/linux -- As root! patch the v4l/dvb-usb-ids.h or unlink the symlink and copy the contents; then patch. - * Unlink and copy (Does not require root) - unlink v4l/dvb-usb-ids.h - cp /usr/src/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h v4l/dvb-usb-ids.h - * patch (if above is not done then needs to be done as root) - patch -p0 < asus_dvb-usb-ids.h.diff -- and type make && make install && depmod -a +- There should exist kernel sources or symlink /usr/src/linux +- you need edit file AF903x_SRC/v4l/dvb-usb-ids.h + add + #define USB_PID_ASUS_U3100MINI 0x1779 +- type make && make install modprobe dvb-usb-af903x -## The following MAY no longer be required when having the kernel Symbols: RC_CORE and RC_MAP -- As root create or modify file /etc/modprobe.d/usbhid.conf and add +## I'm not 100% sure, but following is no longer requiered if you have setup kernel Symbol: RC_CORE and RC_MAP +- create or modify file /etc/modprobe.d/usbhid.conf + add options usbhid quirks=0x0b05:0x1779:0x0004 diff --git a/api/demodulatorextend.c b/api/demodulatorextend.c index 980949f..db967a6 100644 --- a/api/demodulatorextend.c +++ b/api/demodulatorextend.c @@ -8,29 +8,29 @@ //#include "i2u.h" //#include "af9035u2iimpl.h" -#include "Afa_AF9007.h" -#include "Afa_PEACOCK.h" -#include "Freescale_MC44CD02.h" -#include "Integrant_ITD3020.h" -#include "Maxlinear_MXL5005.h" -#include "Microtune_MT2260B0.h" -#include "Microtune_MT2266.h" -#include "Panasonic_ENV77H11D5.h" -#include "Philips_TD1316AFIHP.h" -#include "Philips_TDA18291HN.h" -#include "Xceive_XC3028L.h" -#include "Infineon_TUA9001.h" -#include "Fitipower_FC0011.h" -#include "Infineon_TUA6039.h" -#include "Philips_TDA18271.h" -#include "Philips_FQD1218ME_MK5.h" -#include "Xceive_XC4000.h" -#include "Philips_TDA18271_C2.h" -#include "Infineon_TUA8010.h" +//#include "Afa_AF9007.h" +//#include "Afa_PEACOCK.h" +//#include "Freescale_MC44CD02.h" +//#include "Integrant_ITD3020.h" +//#include "Maxlinear_MXL5005.h" +//#include "Microtune_MT2260B0.h" +//#include "Microtune_MT2266.h" +//#include "Panasonic_ENV77H11D5.h" +//#include "Philips_TD1316AFIHP.h" +//#include "Philips_TDA18291HN.h" +//#include "Xceive_XC3028L.h" +//#include "Infineon_TUA9001.h" +//#include "Fitipower_FC0011.h" +//#include "Infineon_TUA6039.h" +//#include "Philips_TDA18271.h" +//#include "Philips_FQD1218ME_MK5.h" +//#include "Xceive_XC4000.h" +//#include "Philips_TDA18271_C2.h" +//#include "Infineon_TUA8010.h" #include "FCI_FC2580.h" -#include "Fitipower_FC0012.h" -#include "Philips_TDA18271_C2_Askey.h" -#include "Elonics_E4000.h" +//#include "Fitipower_FC0012.h" +//#include "Philips_TDA18271_C2_Askey.h" +//#include "Elonics_E4000.h" static PidInfo pidInfo; BusDescription busDesc[] = @@ -291,80 +291,9 @@ Dword Demodulator_setBusTuner ( */ switch (tunerId) { - case Tuner_Afatech_AF9007: - ganymede->tunerDescription = &tuner_AF9007; - break; - case Tuner_Panasonic_ENV77H11D5: - ganymede->tunerDescription = &tuner_ENV77H11D5; - break; - case Tuner_Philip_TD1316AFIHP: - ganymede->tunerDescription = &tuner_TD1316AFIHP; - break; - case Tuner_Maxlinear_MXL5005: - ganymede->tunerDescription = &tuner_MXL5005; - break; - case Tuner_Freescale_MC44CD02: - ganymede->tunerDescription = &tuner_MC44CD02; - break; - case Tuner_Microtune_MT2260B0: - ganymede->tunerDescription = &tuner_MT2260B0; - break; - case Tuner_Philips_TDA18291HN: - ganymede->tunerDescription = &tuner_TDA18291HN; - break; - case Tuner_Microtune_MT2266: - ganymede->tunerDescription = &tuner_MT2266; - MT2266_supportTA4029CTC ((Demodulator*) &ganymede, 0); - break; - case Tuner_Integrant_ITD3020: - ganymede->tunerDescription = &tuner_ITD3020; - break; - case Tuner_Afatech_PEACOCK: - ganymede->tunerDescription = &tuner_PEACOCK; - break; - case Tuner_Xceive_XC3028L: - ganymede->tunerDescription = &tuner_XC3028L; - break; - case Tuner_Infineon_TUA9001: - ganymede->tunerDescription = &tuner_TUA9001; - break; - case Tuner_Fitipower_FC0011: - ganymede->tunerDescription = &tuner_FC0011; - break; - case Tuner_Infineon_TUA6039: - ganymede->tunerDescription = &tuner_TUA6039; - break; - case Tuner_Philips_TDA18271: - ganymede->tunerDescription = &tuner_TDA18271; - break; - case Tuner_Philips_FQD1218ME_MK5: - ganymede->tunerDescription = &tuner_FQD1218ME_MK5; - break; - case Tuner_Xceive_XC4000: - ganymede->tunerDescription = &tuner_XC4000; - break; - case Tuner_Philips_TDA18271_C2: - ganymede->tunerDescription = &tuner_TDA18271_C2; - break; - case Tuner_Infineon_TUA8010: - ganymede->tunerDescription = &tuner_TUA8010; - break; case Tuner_FCI_FC2580: ganymede->tunerDescription = &tuner_FC2580; break; - case Tuner_Microtune_MT2266_TA4029CTC: - ganymede->tunerDescription = &tuner_MT2266; - MT2266_supportTA4029CTC ((Demodulator*) &ganymede, 1); - break; - case Tuner_Fitipower_FC0012: - ganymede->tunerDescription = &tuner_FC0012; - break; - case Tuner_Philips_TDA18271_C2_Askey: - ganymede->tunerDescription = &tuner_TDA18271_C2_Askey; - break; - case Tuner_Elonics_E4000: - ganymede->tunerDescription = &tuner_E4000; - break; default: error = Error_INVALID_TUNER_TYPE; goto exit; @@ -709,22 +638,22 @@ exit : } -#if UNDER_CE -#else +//#if UNDER_CE +//#else extern long ActiveSync; -#endif +//#endif Dword Demodulator_controlActiveSync ( IN Demodulator* demodulator, IN Byte control ) { -#if UNDER_CE +//#if UNDER_CE //#else //for Linux - if (control == 0) - ActiveSync = 0; - else - ActiveSync = 1; -#endif +// if (control == 0) +// ActiveSync = 0; +// else +// ActiveSync = 1; +//#endif return (Error_NO_ERROR); } diff --git a/api/i2c_driver.c b/api/i2c_driver.c index ef6285d..ae2063d 100644 --- a/api/i2c_driver.c +++ b/api/i2c_driver.c @@ -37,7 +37,7 @@ int xc_read_i2c_data(unsigned char *bytes_received, int nb_bytes_to_receive) return (error); } -int xc_reset(void) +int xc_reset( void ) { Dword error = Error_NO_ERROR; diff --git a/api/standard.c b/api/standard.c index c677234..0649989 100644 --- a/api/standard.c +++ b/api/standard.c @@ -2767,6 +2767,7 @@ Dword Standard_setStreamType ( error = Error_DRIVER_INVALID; } #else + //Dword warning = Error_NO_ERROR; Ganymede* ganymede; Byte i; @@ -3588,6 +3589,7 @@ Dword Standard_getDatagram ( Ganymede* ganymede; Dword length = 0; Byte value; + //Bool ready = False; ganymede = (Ganymede*) demodulator; diff --git a/api/type.h b/api/type.h index d7cf236..2c58167 100644 --- a/api/type.h +++ b/api/type.h @@ -15,6 +15,7 @@ #define IN + #define OUT #define INOUT diff --git a/api/usb2impl.c b/api/usb2impl.c index f284328..7df4af9 100644 --- a/api/usb2impl.c +++ b/api/usb2impl.c @@ -1,11 +1,12 @@ // all for Linux -#include +//#include #include #include #include #include #include #include +//#include #include #include #include @@ -126,7 +127,8 @@ Dword Usb2_writeControlBus ( IN Dword bufferLength, IN Byte* buffer ) { - + +// Ganymede *pGanymede = (Ganymede *)demodulator; Dword ret,act_len; ret = 0; // printk("- Enter %s Function -\n",__FUNCTION__); @@ -149,6 +151,7 @@ Dword Usb2_readControlBus ( OUT Byte* buffer ) { +// Ganymede *pGanymede = (Ganymede *)demodulator; Dword ret, nBytesRead; ret = 0; // printk("- Enter %s Function -\n",__FUNCTION__); diff --git a/src/af903x-core.c b/src/af903x-core.c index 5d49694..0829a8e 100644 --- a/src/af903x-core.c +++ b/src/af903x-core.c @@ -31,14 +31,11 @@ static int af903x_probe(struct usb_interface *intf, return -ENOMEM; } -/*static int af903x_suspend(struct usb_interface *intf, u32 state) +static int af903x_suspend(struct usb_interface *intf, u32 state) { int error; deb_data("Enter %s Function\n",__FUNCTION__); -#ifdef EEEPC - error = DL_Reboot(); -#else if (DevicePower) { error = DL_CheckTunerInited(0, (Bool *) &TunerInited0); @@ -50,18 +47,15 @@ static int af903x_probe(struct usb_interface *intf, DeviceReboot = true; } -#endif return 0; -}*/ +} -/*static int af903x_resume(struct usb_interface *intf) +static int af903x_resume(struct usb_interface *intf) { int retval = -ENOMEM; int error; deb_data("Enter %s Function\n",__FUNCTION__); -#ifdef EEEPC -#else if(DeviceReboot == true) { retval = Device_init(interface_to_usbdev(intf),&DC, false); @@ -73,21 +67,17 @@ static int af903x_probe(struct usb_interface *intf, if (TunerInited1) error = DL_ApCtrl(1, 1); } -#endif return 0; -}*/ +} static struct usb_driver af903x_driver = { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) - .owner = THIS_MODULE, -#endif .name = "dvb_usb_af903x", .probe = af903x_probe, .disconnect = dvb_usb_device_exit, .id_table = af903x_usb_id_table, -// .suspend = af903x_suspend, -// .resume = af903x_resume, + .suspend = af903x_suspend, + .resume = af903x_resume, }; static int __init af903x_module_init(void) diff --git a/src/af903x-devices.c b/src/af903x-devices.c index e7ecfd4..3df9fde 100644 --- a/src/af903x-devices.c +++ b/src/af903x-devices.c @@ -1,5 +1,9 @@ #include "af903x.h" +static int dvb_usb_af903x_disable_rc = 1; +module_param_named(disable_rc, dvb_usb_af903x_disable_rc, int, 0644); +MODULE_PARM_DESC(disable_rc, "disable rc"); + bool DevicePower; static int af903x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) { @@ -75,7 +79,7 @@ static int af903x_identify_state(struct usb_device *udev, struct dvb_usb_device_ static int af903x_frontend_attach(struct dvb_usb_adapter *adap) { deb_data("- Enter %s Function - chip=%d\n", __FUNCTION__, adap->id); - adap->fe_adap[0].fe = af903x_attach(1); + adap->fe_adap[0].fe = af903x_attach(1); return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; } @@ -98,35 +102,40 @@ static int af903x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) struct usb_device_id af903x_usb_id_table[] = { - { USB_DEVICE(0x15A4,0x1000) }, - { USB_DEVICE(0x15A4,0x1001) }, - { USB_DEVICE(0x15A4,0x1002) }, - { USB_DEVICE(0x15A4,0x1003) }, - { USB_DEVICE(0x15A4,0x9035) }, - { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS) }, - { 0}, /* Terminating entry */ + { USB_DEVICE(0x15A4,0x1000) }, + { USB_DEVICE(0x15A4,0x1001) }, + { USB_DEVICE(0x15A4,0x1002) }, + { USB_DEVICE(0x15A4,0x1003) }, + { USB_DEVICE(0x15A4,0x9035) }, + { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI) }, + { 0}, /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, af903x_usb_id_table); -struct dvb_usb_device_properties af903x_properties[] = { - { - .usb_ctrl = DEVICE_SPECIFIC, - .download_firmware = af903x_download_firmware, - .no_reconnect = 1, - .power_ctrl = af903x_powerctrl, - .identify_state = af903x_identify_state, - .num_adapters = 1, +struct dvb_usb_device_properties af903x_properties[] = {{ + .usb_ctrl = DEVICE_SPECIFIC, + .download_firmware = af903x_download_firmware, + .no_reconnect = 1, + .power_ctrl = af903x_powerctrl, + .identify_state = af903x_identify_state, + .num_adapters = 2, .adapter = { { - .fe[0].caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, - .fe[0].pid_filter_count = 32, - .fe[0].pid_filter = af903x_pid_filter, - .fe[0].pid_filter_ctrl = af903x_pid_filter_ctrl, - .fe[0].frontend_attach = af903x_frontend_attach, - .fe[0].tuner_attach = af903x_tuner_attach, - .fe[0].streaming_ctrl = af903x_streaming_ctrl, - .fe[0].stream = { + + .num_frontends = 1, + .fe = {{ + + .caps = DVB_USB_ADAP_HAS_PID_FILTER | + DVB_USB_ADAP_NEED_PID_FILTERING | + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 32, + .pid_filter = af903x_pid_filter, + .pid_filter_ctrl = af903x_pid_filter_ctrl, + .frontend_attach = af903x_frontend_attach, + .tuner_attach = af903x_tuner_attach, + .streaming_ctrl = af903x_streaming_ctrl, + .stream = { .type = USB_BULK, .count = 4, .endpoint = 0x84, @@ -136,33 +145,65 @@ struct dvb_usb_device_properties af903x_properties[] = { } } } - } - }, - .num_device_descs = 2, - .devices = { + + }}, + + }, { - "ITEtech USB2.0 DVB-T Receiver", { - &af903x_usb_id_table[0], - &af903x_usb_id_table[1], - &af903x_usb_id_table[2], - &af903x_usb_id_table[3], - &af903x_usb_id_table[4], - NULL - }, { - NULL - } - }, { - "Asus U3100MINI_PLUS/T/RC Receiver", { - &af903x_usb_id_table[5], - NULL - }, { - NULL + + .num_frontends = 1, + .fe = {{ + + .caps = DVB_USB_ADAP_HAS_PID_FILTER | + DVB_USB_ADAP_NEED_PID_FILTERING | + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 32, + .pid_filter = af903x_pid_filter, + .pid_filter_ctrl = af903x_pid_filter_ctrl, + .frontend_attach = af903x_frontend_attach, + .tuner_attach = af903x_tuner_attach, + .streaming_ctrl = af903x_streaming_ctrl, + .stream = { + .type = USB_BULK, + .count = 4, + .endpoint = 0x85, + .u = { + .bulk = { + .buffersize = 65424, + } + } } - }, { - NULL - } - } - } -}; + + }}, + + }, + }, +// .rc.core = { +// .protocol = RC_TYPE_NEC, +// .module_name = "af903x", +// .rc_query = af903x_rc_query, +// .rc_interval = AF903X_POLL, +// .allowed_protos = RC_TYPE_NEC, +// .rc_codes = NULL, /* will be set in +// af903x_identify_state */ +// }, + .num_device_descs = 2, + .devices = { + {"ITEtech USB2.0 DVB-T Receiver", + {&af903x_usb_id_table[0], + &af903x_usb_id_table[1], + &af903x_usb_id_table[2], + &af903x_usb_id_table[3], + &af903x_usb_id_table[4], + NULL}, + {NULL}, + }, {"Asus U3100MINI_PLUS/T/RC Receiver", + {&af903x_usb_id_table[5], + NULL}, + {NULL}, + }, {NULL}, + } + +}}; int af903x_device_count = ARRAY_SIZE(af903x_properties); diff --git a/src/af903x-drv.c b/src/af903x-drv.c index 86a7802..bd9084d 100644 --- a/src/af903x-drv.c +++ b/src/af903x-drv.c @@ -6,6 +6,7 @@ int dvb_usb_af903x_debug; module_param_named(debug,dvb_usb_af903x_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level.(info=1,deb_fw=2,deb_fwdata=4,deb_data=8)" DVB_USB_DEBUG_STATUS); + struct usb_device *udevs; PDEVICE_CONTEXT PDC; @@ -37,6 +38,14 @@ static DWORD DRV_IrTblDownload(IN void * handle) filp->f_pos=0x00; fileSize = filp->f_op->read(filp,b_buf,sizeof(b_buf),&filp->f_pos); + //for(i=0; iDemodulator, (Word)fileSize, b_buf); if (dwError) {printk("Demodulator_loadIrTable fail"); goto exit;} @@ -81,9 +90,10 @@ static DWORD DRV_SetFreqBw( ) { DWORD dwError = Error_NO_ERROR; + PDEVICE_CONTEXT pdc = (PDEVICE_CONTEXT)handle; - Bool bLock = true; + Bool bLock = true; deb_data("- Enter %s Function -\n ",__FUNCTION__); deb_data(" ucSlaveDemod = %d, Freq= %d, BW=%d\n", (int) ucSlaveDemod, (int) dwFreq, (int) ucBw); @@ -549,7 +559,7 @@ static DWORD DRV_GetEEPROMConfig( cnt = 1; } - for(; ucSlaveDemod < cnt; ucSlaveDemod++) + for(ucSlaveDemod; ucSlaveDemod < cnt; ucSlaveDemod++) { deb_data("ucSlaveDemod: %d \n",cnt); dwError = DRV_GetEEPROMConfig2(pdc, ucSlaveDemod); @@ -1404,7 +1414,7 @@ DWORD Device_init(struct usb_device *udev,PDEVICE_CONTEXT PDCs, Bool bBoot) PDC->Demodulator.userData = (Handle)PDC; PDC->Demodulator.chipNumber = 1; PDC->architecture=Architecture_DCA; - PDC->Demodulator.frequency[0] = 546000; + PDC->Demodulator.frequency[0] = 834000; PDC->Demodulator.bandwidth[0] = 8000; PDC->bIrTblDownload = false; PDC->fc[0].tunerinfo.TunerId = 0; diff --git a/src/af903x-fe.c b/src/af903x-fe.c index aee8948..d8876ab 100644 --- a/src/af903x-fe.c +++ b/src/af903x-fe.c @@ -3,7 +3,7 @@ struct af903xm_state { struct dvb_frontend demod; - fe_bandwidth_t current_bandwidth; + u32 current_bandwidth; }; static int af903x_init(struct dvb_frontend *demod) @@ -16,7 +16,7 @@ static int af903x_init(struct dvb_frontend *demod) deb_data("af903x_init return error\n"); return error; } - + return 0; } @@ -42,32 +42,32 @@ static int af903x_identify(struct af903xm_state *state) return 0; } -static int af903x_get_frontend(struct dvb_frontend* fe, - struct dvb_frontend_parameters *fep) +static int af903x_get_frontend(struct dvb_frontend* fe) { + struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct af903xm_state *state = fe->demodulator_priv; deb_data("- Enter %s Function - chip=%d\n",__FUNCTION__, fe->dvb->num); fep->inversion = INVERSION_AUTO; - fep->u.ofdm.bandwidth = state->current_bandwidth; + fep->bandwidth_hz = state->current_bandwidth; return 0; } -static int af903x_set_frontend(struct dvb_frontend* fe, - struct dvb_frontend_parameters *fep) +static int af903x_set_frontend(struct dvb_frontend* fe) { + struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct af903xm_state *state = fe->demodulator_priv; struct af903x_ofdm_channel ch; DWORD error = Error_NO_ERROR; - - deb_data("- Enter %s Function - chip=%d\n",__FUNCTION__, fe->dvb->num); - if (fep->u.ofdm.bandwidth == 0) fep->u.ofdm.bandwidth=8; - if (fep->u.ofdm.bandwidth == 1) fep->u.ofdm.bandwidth=7; - if (fep->u.ofdm.bandwidth == 2) fep->u.ofdm.bandwidth=6; + deb_data("- Enter %s Function - chip=%d delsys=%d BW=%d\n",__FUNCTION__, fe->dvb->num, fe->dtv_property_cache.delivery_system,fep->bandwidth_hz); + //fep->bandwidth_hz=8; + if (fep->bandwidth_hz == 0) fep->bandwidth_hz=8; + if (fep->bandwidth_hz == 1) fep->bandwidth_hz=7; + if (fep->bandwidth_hz == 2) fep->bandwidth_hz=6; ch.RF_kHz = fep->frequency / 1000; - ch.Bw = fep->u.ofdm.bandwidth; + ch.Bw = fep->bandwidth_hz; - state->current_bandwidth = fep->u.ofdm.bandwidth; + state->current_bandwidth = fep->bandwidth_hz; deb_data("- Enter %s Function - chip=%d RF=%d, BW=%d\n",__FUNCTION__, fe->dvb->num,ch.RF_kHz,ch.Bw); @@ -130,12 +130,14 @@ static int af903x_read_ber(struct dvb_frontend *fe, u32 *ber) static int af903x_read_snr(struct dvb_frontend* fe, u16 *snr) { +// (void) fe; +// *snr = 0x0000; + //struct af903xm_state *state = fe->demodulator_priv; + DWORD error = Error_NO_ERROR; Constellation constellation; BYTE SignalSnr = 0; - *snr = 0; - error = DL_getSNR(fe->dvb->num, &constellation, &SignalSnr); if(error) return error; @@ -165,6 +167,8 @@ static int af903x_read_unc_blocks(struct dvb_frontend *fe, u32 *unc) } static int af903x_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { +// struct af903xm_state *state = fe->demodulator_priv; + DWORD error = Error_NO_ERROR; BYTE SignalStrength = 0; @@ -200,7 +204,7 @@ struct dvb_frontend * af903x_attach(u8 tmp) struct dvb_frontend *demod; struct af903xm_state *st; - deb_data("- Enter %s Function -\n",__FUNCTION__); + deb_data("- Enter %s Function -\n",__FUNCTION__); st = kzalloc(sizeof(struct af903xm_state), GFP_KERNEL); if (st == NULL) return NULL; @@ -208,7 +212,6 @@ struct dvb_frontend * af903x_attach(u8 tmp) demod = &st->demod; demod->demodulator_priv = st; memcpy(&st->demod.ops, &af903x_ops, sizeof(struct dvb_frontend_ops)); - af903x_identify(st); return demod; @@ -216,6 +219,7 @@ struct dvb_frontend * af903x_attach(u8 tmp) EXPORT_SYMBOL(af903x_attach); static struct dvb_frontend_ops af903x_ops = { + .delsys = { SYS_DVBT }, .info = { .name = "AF903X USB DVB-T", .type = FE_OFDM, diff --git a/src/af903x-tuner.c b/src/af903x-tuner.c index c45f1ae..1e9c562 100644 --- a/src/af903x-tuner.c +++ b/src/af903x-tuner.c @@ -11,13 +11,14 @@ -static int tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +static int tuner_set_params(struct dvb_frontend *fe) { + struct dtv_frontend_properties *params = &fe->dtv_property_cache; struct tuner_priv *priv=NULL; DWORD dwError = Error_NO_ERROR; DWORD freq = params->frequency ;// 1000; // Hz -> kHz - priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; + priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->bandwidth_hz : 0; deb_data("%s - freq : %d , bandwidth : %dn",__FUNCTION__, (int) freq,priv->bandwidth); diff --git a/src/af903x.h b/src/af903x.h index 5c3b9ad..0d676ab 100644 --- a/src/af903x.h +++ b/src/af903x.h @@ -15,25 +15,17 @@ #include "af903x-ioctl.h" #include "demodulator.h" #include "userdef.h" +//#include "firmware.h" #include "type.h" #include "Common.h" #include #include -#define DRIVER_RELEASE_VERSION "v9.08.14.1" +#define DRIVER_RELEASE_VERSION "v9.08.14.3" //***************** customization ***************** //#define QuantaMID 1 //#define EEEPC 1 -//***************** from compat.h ***************** -#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18) -typedef int bool; -#define true 1 -#define false 0 -//***************** from dvb-usb.h ***************** -#define dvb_usb_device_properties dvb_usb_properties -#define dvb_usb_adapter dvb_usb_device -#endif //***************** from device.h *****************// #define AFA_USB_DEVICE -- cgit v0.12