📄 anysee.c
字号:
if (adap->fe != NULL) { state->tuner = DVB_PLL_THOMSON_DTT7579; return 0; } /* Zarlink ZL10353 DVB-T demod inside of Samsung DNOS404ZH103A NIM */ adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, &adap->dev->i2c_adap); if (adap->fe != NULL) { state->tuner = DVB_PLL_THOMSON_DTT7579; return 0; } /* for E30 Combo Plus DVB-T demodulator */ if (dvb_usb_anysee_delsys) { ret = anysee_write_reg(adap->dev, 0xb0, 0x01); if (ret) return ret; /* Zarlink ZL10353 DVB-T demod */ adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, &adap->dev->i2c_adap); if (adap->fe != NULL) { state->tuner = DVB_PLL_SAMSUNG_DTOS403IH102A; return 0; } } /* connect demod on IO port D for TDA10023 & ZL10353 */ ret = anysee_write_reg(adap->dev, 0xb0, 0x25); if (ret) return ret; /* Zarlink ZL10353 DVB-T demod inside of Samsung DNOS404ZH103A NIM */ adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config, &adap->dev->i2c_adap); if (adap->fe != NULL) { state->tuner = DVB_PLL_THOMSON_DTT7579; return 0; } /* IO port E - E30C rev 0.4 board requires this */ ret = anysee_write_reg(adap->dev, 0xb1, 0xa7); if (ret) return ret; /* Philips TDA10023 DVB-C demod */ adap->fe = dvb_attach(tda10023_attach, &anysee_tda10023_config, &adap->dev->i2c_adap, 0x48); if (adap->fe != NULL) { state->tuner = DVB_PLL_SAMSUNG_DTOS403IH102A; return 0; } /* return IO port D to init value for safe */ ret = anysee_write_reg(adap->dev, 0xb0, io_d); if (ret) return ret; err("Unkown Anysee version: %02x %02x %02x. "\ "Please report the <linux-dvb@linuxtv.org>.", hw_info[0], hw_info[1], hw_info[2]); return -ENODEV;}static int anysee_tuner_attach(struct dvb_usb_adapter *adap){ struct anysee_state *state = adap->dev->priv; deb_info("%s: \n", __func__); switch (state->tuner) { case DVB_PLL_THOMSON_DTT7579: /* Thomson dtt7579 (not sure) PLL inside of: Samsung DNOS404ZH102A NIM Samsung DNOS404ZH103A NIM */ dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, DVB_PLL_THOMSON_DTT7579); break; case DVB_PLL_SAMSUNG_DTOS403IH102A: /* Unknown PLL inside of Samsung DTOS403IH102A tuner module */ dvb_attach(dvb_pll_attach, adap->fe, 0xc0, &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); break; } return 0;}static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state){ u8 buf[] = {CMD_GET_IR_CODE}; struct dvb_usb_rc_key *keymap = d->props.rc_key_map; u8 ircode[2]; int i, ret; ret = anysee_ctrl_msg(d, buf, sizeof(buf), &ircode[0], 2); if (ret) return ret; *event = 0; *state = REMOTE_NO_KEY_PRESSED; for (i = 0; i < d->props.rc_key_map_size; i++) { if (keymap[i].custom == ircode[0] && keymap[i].data == ircode[1]) { *event = keymap[i].event; *state = REMOTE_KEY_PRESSED; return 0; } } return 0;}static struct dvb_usb_rc_key anysee_rc_keys[] = { { 0x01, 0x00, KEY_0 }, { 0x01, 0x01, KEY_1 }, { 0x01, 0x02, KEY_2 }, { 0x01, 0x03, KEY_3 }, { 0x01, 0x04, KEY_4 }, { 0x01, 0x05, KEY_5 }, { 0x01, 0x06, KEY_6 }, { 0x01, 0x07, KEY_7 }, { 0x01, 0x08, KEY_8 }, { 0x01, 0x09, KEY_9 }, { 0x01, 0x0a, KEY_POWER }, { 0x01, 0x0b, KEY_DOCUMENTS }, /* * */ { 0x01, 0x19, KEY_FAVORITES }, { 0x01, 0x20, KEY_SLEEP }, { 0x01, 0x21, KEY_MODE }, /* 4:3 / 16:9 select */ { 0x01, 0x22, KEY_ZOOM }, { 0x01, 0x47, KEY_TEXT }, { 0x01, 0x16, KEY_TV }, /* TV / radio select */ { 0x01, 0x1e, KEY_LANGUAGE }, /* Second Audio Program */ { 0x01, 0x1a, KEY_SUBTITLE }, { 0x01, 0x1b, KEY_CAMERA }, /* screenshot */ { 0x01, 0x42, KEY_MUTE }, { 0x01, 0x0e, KEY_MENU }, { 0x01, 0x0f, KEY_EPG }, { 0x01, 0x17, KEY_INFO }, { 0x01, 0x10, KEY_EXIT }, { 0x01, 0x13, KEY_VOLUMEUP }, { 0x01, 0x12, KEY_VOLUMEDOWN }, { 0x01, 0x11, KEY_CHANNELUP }, { 0x01, 0x14, KEY_CHANNELDOWN }, { 0x01, 0x15, KEY_OK }, { 0x01, 0x1d, KEY_RED }, { 0x01, 0x1f, KEY_GREEN }, { 0x01, 0x1c, KEY_YELLOW }, { 0x01, 0x44, KEY_BLUE }, { 0x01, 0x0c, KEY_SHUFFLE }, /* snapshot */ { 0x01, 0x48, KEY_STOP }, { 0x01, 0x50, KEY_PLAY }, { 0x01, 0x51, KEY_PAUSE }, { 0x01, 0x49, KEY_RECORD }, { 0x01, 0x18, KEY_PREVIOUS }, /* |<< */ { 0x01, 0x0d, KEY_NEXT }, /* >>| */ { 0x01, 0x24, KEY_PROG1 }, /* F1 */ { 0x01, 0x25, KEY_PROG2 }, /* F2 */};/* DVB USB Driver stuff */static struct dvb_usb_device_properties anysee_properties;static int anysee_probe(struct usb_interface *intf, const struct usb_device_id *id){ struct dvb_usb_device *d; struct usb_host_interface *alt; int ret; mutex_init(&anysee_usb_mutex); /* There is one interface with two alternate settings. Alternate setting 0 is for bulk transfer. Alternate setting 1 is for isochronous transfer. We use bulk transfer (alternate setting 0). */ if (intf->num_altsetting < 1) return -ENODEV; ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d, adapter_nr); if (ret) return ret; alt = usb_altnum_to_altsetting(intf, 0); if (alt == NULL) { deb_info("%s: no alt found!\n", __func__); return -ENODEV; } ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting); if (ret) return ret; if (d) ret = anysee_init(d); return ret;}static struct usb_device_id anysee_table [] = { { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ANYSEE) }, { USB_DEVICE(USB_VID_AMT, USB_PID_ANYSEE) }, { } /* Terminating entry */};MODULE_DEVICE_TABLE(usb, anysee_table);static struct dvb_usb_device_properties anysee_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, .size_of_priv = sizeof(struct anysee_state), .num_adapters = 1, .adapter = { { .streaming_ctrl = anysee_streaming_ctrl, .frontend_attach = anysee_frontend_attach, .tuner_attach = anysee_tuner_attach, .stream = { .type = USB_BULK, .count = 8, .endpoint = 0x82, .u = { .bulk = { .buffersize = 512, } } }, } }, .rc_key_map = anysee_rc_keys, .rc_key_map_size = ARRAY_SIZE(anysee_rc_keys), .rc_query = anysee_rc_query, .rc_interval = 200, /* windows driver uses 500ms */ .i2c_algo = &anysee_i2c_algo, .generic_bulk_ctrl_endpoint = 1, .num_device_descs = 1, .devices = { { .name = "Anysee DVB USB2.0", .cold_ids = {NULL}, .warm_ids = {&anysee_table[0], &anysee_table[1], NULL}, }, }};static struct usb_driver anysee_driver = { .name = "dvb_usb_anysee", .probe = anysee_probe, .disconnect = dvb_usb_device_exit, .id_table = anysee_table,};/* module stuff */static int __init anysee_module_init(void){ int ret; ret = usb_register(&anysee_driver); if (ret) err("%s: usb_register failed. Error number %d", __func__, ret); return ret;}static void __exit anysee_module_exit(void){ /* deregister this driver from the USB subsystem */ usb_deregister(&anysee_driver);}module_init(anysee_module_init);module_exit(anysee_module_exit);MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0");MODULE_LICENSE("GPL");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -