/* * Linux driver for Technisat DVB-S/S2 USB 2.0 device * * Copyright (C) 2010 Patrick Boettcher, * Kernel Labs Inc. PO Box 745, St James, NY 11780 * * Development was sponsored by Technisat Digital UK Limited, whose * registered office is Witan Gate House 500 - 600 Witan Gate West, * Milton Keynes, MK9 1SH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * * THIS PROGRAM IS PROVIDED "AS IS" AND BOTH THE COPYRIGHT HOLDER AND * TECHNISAT DIGITAL UK LTD DISCLAIM ALL WARRANTIES WITH REGARD TO * THIS PROGRAM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. NEITHER THE COPYRIGHT HOLDER * NOR TECHNISAT DIGITAL UK LIMITED SHALL BE LIABLE FOR ANY SPECIAL, * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS PROGRAM. See the * GNU General Public License for more details.
*/
/* disables all LED control command and
* also does not start the signal polling thread */ staticint disable_led_control;
module_param(disable_led_control, int, 0444);
MODULE_PARM_DESC(disable_led_control, "disable LED control of the device (default: 0 - LED control is active).");
staticint technisat_usb2_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num)
{ int ret = 0, i; struct dvb_usb_device *d = i2c_get_adapdata(adap);
/* Ensure nobody else hits the i2c bus while we're sending our
sequence of messages, (such as the remote control thread) */ if (mutex_lock_interruptible(&d->i2c_mutex) < 0) return -EAGAIN;
for (i = 0; i < num; i++) { if (i+1 < num && msg[i+1].flags & I2C_M_RD) {
ret = technisat_usb2_i2c_access(d->udev, msg[i+1].addr,
msg[i].buf, msg[i].len,
msg[i+1].buf, msg[i+1].len); if (ret != 0) break;
i++;
} else {
ret = technisat_usb2_i2c_access(d->udev, msg[i].addr,
msg[i].buf, msg[i].len,
NULL, 0); if (ret != 0) break;
}
}
/* method to find out whether the firmware has to be downloaded or not */ staticint technisat_usb2_identify_state(struct usb_device *udev, conststruct dvb_usb_device_properties *props, conststruct dvb_usb_device_description **desc, int *cold)
{ int ret;
u8 *version;
version = kmalloc(3, GFP_KERNEL); if (!version) return -ENOMEM;
/* first select the interface */ if (usb_set_interface(udev, 0, 1) != 0)
err("could not set alternate setting to 0"); else
info("set alternate setting");
*cold = 0; /* by default do not download a firmware - just in case something is wrong */
/* power control */ staticint technisat_usb2_power_ctrl(struct dvb_usb_device *d, int level)
{ struct technisat_usb2_state *state = d->priv;
state->power_state = level;
if (disable_led_control) return 0;
/* green led is turned off in any case - will be turned on when tuning */
technisat_usb2_set_led(d, 0, TECH_LED_OFF); /* red led is turned on all the time */
technisat_usb2_set_led(d, 1, TECH_LED_ON); return 0;
}
/* mac address reading - from the eeprom */ #if 0 staticvoid technisat_usb2_eeprom_dump(struct dvb_usb_device *d)
{
u8 reg;
u8 b[16]; int i, j;
/* call the init function once to initialize tuner's clock output divider and demod's
master clock */ if (a->fe_adap[0].fe->ops.init)
a->fe_adap[0].fe->ops.init(a->fe_adap[0].fe);
if (mutex_lock_interruptible(&a->dev->i2c_mutex) < 0) return -EAGAIN;
/* if everything was successful assign a nice name to the frontend */
strscpy(a->fe_adap[0].fe->ops.info.name,
a->dev->desc->name, sizeof(a->fe_adap[0].fe->ops.info.name));
} else {
dvb_frontend_detach(a->fe_adap[0].fe);
a->fe_adap[0].fe = NULL;
}
}
technisat_usb2_set_led_timer(a->dev, 1, 1);
return a->fe_adap[0].fe == NULL ? -ENODEV : 0;
}
/* Remote control */
/* the device is giving providing raw IR-signals to the host mapping * it only to one remote control is just the default implementation
*/ #define NOMINAL_IR_BIT_TRANSITION_TIME_US 889 #define NOMINAL_IR_BIT_TIME_US (2 * NOMINAL_IR_BIT_TRANSITION_TIME_US)
/* work and stuff was only created when the device is hot-state */ if (dev != NULL) { struct technisat_usb2_state *state = dev->priv; if (state != NULL)
cancel_delayed_work_sync(&state->green_led_work);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.