diff options
Diffstat (limited to 'src/af903x-devices.c')
-rw-r--r-- | src/af903x-devices.c | 138 |
1 files changed, 50 insertions, 88 deletions
diff --git a/src/af903x-devices.c b/src/af903x-devices.c index c8691cd..8e82aaa 100644 --- a/src/af903x-devices.c +++ b/src/af903x-devices.c @@ -4,7 +4,6 @@ bool DevicePower; static int af903x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) { int ret =0; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) deb_data("%s: onoff:%d\n", __func__, onoff); if ( PDC->fc[adap->id].bEnPID != onoff ) @@ -13,7 +12,6 @@ static int af903x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) PDC->fc[adap->id].bEnPID = onoff; DL_PIDOnOff((BYTE)adap->id,onoff); -#endif return ret; } @@ -22,7 +20,6 @@ static int af903x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pidnum int onoff) { int ret = 0; - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) Pid pid; deb_data("- %s: set pid filter, index %d, pid %x, onoff %d, now_onoff %d.\n", __func__, index, pidnum, onoff, PDC->fc[adap->id].bEnPID); @@ -43,8 +40,6 @@ static int af903x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pidnum }else{ ret = DL_RemovePID((BYTE)adap->id, index, pid); } -#endif - return ret; } @@ -62,15 +57,9 @@ static int af903x_powerctrl(struct dvb_usb_device *d, int onoff) int ret; DevicePower = onoff; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) deb_data("- Enter %s Function - chip=%d:%s\n",__FUNCTION__, d->adapter->id, onoff?"ON":"OFF"); ret = DL_ApCtrl(d->adapter->id, onoff); -#else - deb_data("- Enter %s Function - %s\n",__FUNCTION__, onoff?"ON":"OFF"); - ret = DL_ApCtrl(0, onoff); -#endif if(ret) deb_data(" af903x_powerctrl Fail: 0x%04X\n", ret); - return ret; } @@ -85,89 +74,59 @@ static int af903x_identify_state(struct usb_device *udev, struct dvb_usb_device_ static int af903x_frontend_attach(struct dvb_usb_adapter *adap) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) deb_data("- Enter %s Function - chip=%d\n", __FUNCTION__, adap->id); -#else - deb_data("- Enter %s Function - \n", __FUNCTION__); -#endif adap->fe = af903x_attach(1); - return adap->fe == NULL ? -ENODEV : 0; } static int af903x_tuner_attach(struct dvb_usb_adapter *adap) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) deb_data("- Enter %s Function - chip=%d\n",__FUNCTION__, adap->id); -#else - deb_data("- Enter %s Function - \n", __FUNCTION__); -#endif tuner_attach(adap->fe); return 0; } static int af903x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) deb_data("- Enter %s Function - (%s) streaming state for chip=%d\n",__FUNCTION__, onoff?"ON":"OFF", adap->id); //PID off DL_ResetPID((BYTE)adap->id); PDC->fc[adap->id].bEnPID = 0; DL_PIDOnOff((BYTE)adap->id,0); -#else - deb_data("- Enter %s Function - (%s) streaming state \n",__FUNCTION__, onoff?"ON":"OFF"); -#endif - return 0; } + 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_PLUS) }, + { 0}, /* Terminating entry */ }; + MODULE_DEVICE_TABLE(usb, af903x_usb_id_table); struct dvb_usb_device_properties af903x_properties[] = { { - .usb_ctrl = DEVICE_SPECIFIC, + .usb_ctrl = DEVICE_SPECIFIC, .download_firmware = af903x_download_firmware, - .no_reconnect = 1, - .power_ctrl = af903x_powerctrl, - .identify_state = af903x_identify_state, - -#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18) - .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, - .pid_filter_count = 32, - .frontend_attach = af903x_frontend_attach, - .tuner_attach = af903x_tuner_attach, - .streaming_ctrl = af903x_streaming_ctrl, - .urb = { - .type = DVB_USB_BULK, - .count = 10, - .endpoint = 0x84, - .u = { - .bulk = { - .buffersize = 65424, - } - } - }, -#else - .num_adapters = 1, + .no_reconnect = 1, + .power_ctrl = af903x_powerctrl, + .identify_state = af903x_identify_state, + .num_adapters = 2, .adapter = { { .caps = DVB_USB_ADAP_HAS_PID_FILTER | 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 = { + .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, @@ -177,47 +136,50 @@ struct dvb_usb_device_properties af903x_properties[] = { } } } - }, - { + }, { .caps = DVB_USB_ADAP_HAS_PID_FILTER | 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, + .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, - } + .bulk = { + .buffersize = 65424, + } } } }, }, -#endif .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}, + .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 - }, - } + } + } } }; |