Commit 17f93e1e authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB: af9005: use generic_bulk_ctrl_endpoint_response

Signed-off-by: default avatarMichael Krufky <mkrufky@kernellabs.com>
Acked-by: default avatarLuca Olivetti <luca@ventoso.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7e48b30a
...@@ -54,50 +54,6 @@ struct af9005_device_state { ...@@ -54,50 +54,6 @@ struct af9005_device_state {
int led_state; int led_state;
}; };
static int af9005_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen,
u8 *rbuf, u16 rlen, int delay_ms)
{
int actlen, ret = -ENOMEM;
if (wbuf == NULL || wlen == 0)
return -EINVAL;
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
deb_xfer(">>> ");
debug_dump(wbuf, wlen, deb_xfer);
ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev,
2), wbuf, wlen,
&actlen, 2000);
if (ret)
err("bulk message failed: %d (%d/%d)", ret, wlen, actlen);
else
ret = actlen != wlen ? -1 : 0;
/* an answer is expected, and no error before */
if (!ret && rbuf && rlen) {
if (delay_ms)
msleep(delay_ms);
ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev,
0x01), rbuf,
rlen, &actlen, 2000);
if (ret)
err("recv bulk message failed: %d", ret);
else {
deb_xfer("<<< ");
debug_dump(rbuf, actlen, deb_xfer);
}
}
mutex_unlock(&d->usb_mutex);
return ret;
}
static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg,
int readwrite, int type, u8 * values, int len) int readwrite, int type, u8 * values, int len)
{ {
...@@ -146,7 +102,7 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, ...@@ -146,7 +102,7 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg,
obuf[8] = values[0]; obuf[8] = values[0];
obuf[7] = command; obuf[7] = command;
ret = af9005_usb_generic_rw(d, obuf, 16, ibuf, 17, 0); ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 17, 0);
if (ret) if (ret)
return ret; return ret;
...@@ -534,7 +490,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf, ...@@ -534,7 +490,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf,
buf[6] = wlen; buf[6] = wlen;
for (i = 0; i < wlen; i++) for (i = 0; i < wlen; i++)
buf[7 + i] = wbuf[i]; buf[7 + i] = wbuf[i];
ret = af9005_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0); ret = dvb_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0);
if (ret) if (ret)
return ret; return ret;
if (ibuf[2] != 0x27) { if (ibuf[2] != 0x27) {
...@@ -581,7 +537,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values, ...@@ -581,7 +537,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values,
obuf[6] = len; obuf[6] = len;
obuf[7] = address; obuf[7] = address;
ret = af9005_usb_generic_rw(d, obuf, 16, ibuf, 14, 0); ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 14, 0);
if (ret) if (ret)
return ret; return ret;
if (ibuf[2] != 0x2b) { if (ibuf[2] != 0x2b) {
...@@ -882,7 +838,7 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state) ...@@ -882,7 +838,7 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
obuf[2] = 0x40; /* read remote */ obuf[2] = 0x40; /* read remote */
obuf[3] = 1; /* rest of packet length */ obuf[3] = 1; /* rest of packet length */
obuf[4] = st->sequence++; /* sequence number */ obuf[4] = st->sequence++; /* sequence number */
ret = af9005_usb_generic_rw(d, obuf, 5, ibuf, 256, 0); ret = dvb_usb_generic_rw(d, obuf, 5, ibuf, 256, 0);
if (ret) { if (ret) {
err("rc query failed"); err("rc query failed");
return ret; return ret;
...@@ -1074,6 +1030,9 @@ static struct dvb_usb_device_properties af9005_properties = { ...@@ -1074,6 +1030,9 @@ static struct dvb_usb_device_properties af9005_properties = {
.rc_key_map_size = 0, .rc_key_map_size = 0,
.rc_query = af9005_rc_query, .rc_query = af9005_rc_query,
.generic_bulk_ctrl_endpoint = 2,
.generic_bulk_ctrl_endpoint_response = 1,
.num_device_descs = 3, .num_device_descs = 3,
.devices = { .devices = {
{.name = "Afatech DVB-T USB1.1 stick", {.name = "Afatech DVB-T USB1.1 stick",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment