[mythtv-users] HDPVR IR blaster slow
Joseph Fry
joe at thefrys.com
Sat Jun 20 16:23:05 UTC 2015
On Fri, Jun 19, 2015 at 6:43 PM, Gary Buhrmaster <gary.buhrmaster at gmail.com>
wrote:
> On Fri, Jun 19, 2015 at 10:24 PM, Joseph Fry <joe at thefrys.com> wrote:
> ....
> > I am on an IPTV system
>
> Ah, yes, the IPTV providers do not have to play by the
> same regulations that the cable companies have to
> (the FCC is going to be changing that, but the studies
> are ongoing to provide recommendations for the next
> generation technologies and requirements, with the
> results of the study due in the fall(*)).
>
> Gary
>
>
> (*) With an anticipated outcry by some of "It is the
> end of the CableCARD as we know it, and the sky
> is falling".
So, I spent the morning looking at the code for lirc_zilog and I think I
found the problem block of code:
/* Send the data block */
ret = send_data_block(tx, data_block);
if (ret != 0)
return ret;
/* Send data block length? */
buf[0] = 0x00;
buf[1] = 0x40;
ret = i2c_master_send(tx->c, buf, 2);
if (ret != 2) {
dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT;
}
/* Give the z8 a moment to process data block */
for (i = 0; i < 10; i++) {
ret = i2c_master_send(tx->c, buf, 1);
if (ret == 1)
break;
udelay(100);
}
>From what I can tell, it sends a block of data, then sends it's length...
and finally it loops for 1 second in 100ms increments waiting for i2c to
say it completed processing (return 1). My guess is that i2c isn't
returning a 1, and this loop continues for the entire 1 second before the
process continues on.
A quick look at the code for i2c_master_send suggests I am right:
/**
2045 * i2c_master_send - issue a single I2C message in master transmit mode
2046 * @client: Handle to slave device
2047 * @buf: Data that will be written to the slave
2048 * @count: How many bytes to write, must be less than 64k since
msg.len is u16
2049 *
2050 * Returns negative errno, or else the number of bytes written.
2051 */
2052 int i2c_master_send(const struct i2c_client *client, const char *buf,
int count)
2053 {
2054 int ret;
2055 struct i2c_adapter *adap = client->adapter;
2056 struct i2c_msg msg;
2057
2058 msg.addr = client->addr;
2059 msg.flags = client->flags & I2C_M_TEN;
2060 msg.len = count;
2061 msg.buf = (char *)buf;
2062
2063 ret = i2c_transfer(adap, &msg, 1);
2064
2065 /*
2066 * If everything went ok (i.e. 1 msg transmitted), return
#bytes
2067 * transmitted, else error code.
2068 */
2069 return (ret == 1) ? count : ret;
2070 }
In the function description you see that it says it returns a negative
error number, or the number of bytes written. If you look at the actual
return statement, it's returning the count (or the error from i2c_transfer).
I think I need to patch lirc_zilog:
for (i = 0; i < 10; i++) {
ret = i2c_master_send(tx->c, buf, 1);
- if (ret == 1)
+ if (ret > 0)
break;
udelay(100);
}
Can anyone confirm my conclusion? My programming skills are limited to
scripts... so this is new territory for me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20150620/8cd2cba8/attachment.html>
More information about the mythtv-users
mailing list