Project

General

Profile

Ubuntu 14.04 compiling VTuner x86_64 to use with TVheadend ยป kernel-3.10.patch

Mario Rossi, 2015-01-28 18:10

View differences:

Makefile Tue Apr 02 13:58:29 2013 +0200 โ†’ Makefile Tue Jul 09 13:32:18 2013 +0200
27 27
	ifeq "$(wildcard $(KDIR) )" ""
28 28
		KDIR = /usr/src/$(shell uname -r)
29 29
	endif
30
	ifeq "$(wildcard $(KDIR) )" ""
31
		KDIR = /usr/src/linux-headers-$(shell uname -r)
32
	endif
30 33
endif
31 34

  
32 35
PWD := $(shell pwd)
vtunerc_main.c Tue Apr 02 13:58:29 2013 +0200 โ†’ vtunerc_main.c Tue Jul 09 13:32:18 2013 +0200
22 22
#include <linux/i2c.h>
23 23
#include <asm/uaccess.h>
24 24
#include <linux/delay.h>
25
#include <linux/seq_file.h>
25 26

  
26 27
#include "demux.h"
27 28
#include "dmxdev.h"
......
32 33

  
33 34
#include "vtunerc_priv.h"
34 35

  
35
#define VTUNERC_MODULE_VERSION "1.4"
36
#define VTUNERC_MODULE_VERSION "1.4"
36 37

  
37 38
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
38 39

  
......
172 173
	return (feinfo && feinfo->name) ? feinfo->name : "(not set)";
173 174
}
174 175

  
175
/**
176
 * @brief  procfs file handler
177
 * @param  buffer:
178
 * @param  start:
179
 * @param  offset:
180
 * @param  size:
181
 * @param  eof:
182
 * @param  data:
183
 * @return =0: success <br/>
184
 *         <0: if any error occur
185
 */
186
#define MAXBUF 512
187
int vtunerc_read_proc(char *buffer, char **start, off_t offset, int size,
188
			int *eof, void *data)
176
static int vtunerc_read_proc(struct seq_file *seq, void *v)
189 177
{
190
	char outbuf[MAXBUF] = "[ vtunerc driver, version "
191
				VTUNERC_MODULE_VERSION " ]\n";
192
	int blen, i, pcnt;
193
	struct vtunerc_ctx *ctx = (struct vtunerc_ctx *)data;
178
	int i, pcnt = 0;
179
	struct vtunerc_ctx *ctx = (struct vtunerc_ctx *)seq->private;
194 180

  
195
	blen = strlen(outbuf);
196
	sprintf(outbuf+blen, "  sessions: %u\n", ctx->stat_ctrl_sess);
197
	blen = strlen(outbuf);
198
	sprintf(outbuf+blen, "  TS data : %u\n", ctx->stat_wr_data);
199
	blen = strlen(outbuf);
200
	sprintf(outbuf+blen, "  PID tab :");
201
	pcnt = 0;
202
	for (i = 0; i < MAX_PIDTAB_LEN; i++) {
203
		blen = strlen(outbuf);
181
	seq_printf(seq, "[ vtunerc driver, version "
182
				VTUNERC_MODULE_VERSION " ]\n");
183
	seq_printf(seq, "  sessions: %u\n", ctx->stat_ctrl_sess);
184
	seq_printf(seq, "  TS data : %u\n", ctx->stat_wr_data);
185
	seq_printf(seq, "  PID tab :");
186
	for (i = 0; i < MAX_PIDTAB_LEN; i++)
204 187
		if (ctx->pidtab[i] != PID_UNKNOWN) {
205
			sprintf(outbuf+blen, " %x", ctx->pidtab[i]);
188
			seq_printf(seq, " %x", ctx->pidtab[i]);
206 189
			pcnt++;
207 190
		}
208
	}
209
	blen = strlen(outbuf);
210
	sprintf(outbuf+blen, " (len=%d)\n", pcnt);
211
	blen = strlen(outbuf);
212
	sprintf(outbuf+blen, "  FE type : %s\n", get_fe_name(ctx->feinfo));
191
	seq_printf(seq, " (len=%d)\n", pcnt);
192
	seq_printf(seq, "  FE type : %s\n", get_fe_name(ctx->feinfo));
213 193

  
214
	blen = strlen(outbuf);
215
	sprintf(outbuf+blen, "  msg xchg: %d/%d\n", ctx->ctrldev_request.type, ctx->ctrldev_response.type);
194
	seq_printf(seq, "  msg xchg: %d/%d\n", ctx->ctrldev_request.type, ctx->ctrldev_response.type);
216 195

  
217
	blen = strlen(outbuf);
196
	return 0;
197
}
218 198

  
219
	if (size < blen)
220
		return -EINVAL;
199
static int vtunerc_proc_open(struct inode *inode, struct file *file)
200
{
201
	int ret;
202
	struct vtunerc_ctx *ctx = PDE_DATA(inode);
221 203

  
222
	if (offset != 0)
223
		return 0;
204
	if (!try_module_get(THIS_MODULE))
205
		return -ENODEV;
206
	ret = single_open(file, vtunerc_read_proc, ctx);
207
	if (ret)
208
		module_put(THIS_MODULE);
209
	return ret;
210
}
224 211

  
225
	strcpy(buffer, outbuf);
212
static int vtuner_proc_release(struct inode *inode, struct file *file)
213
{
214
	int ret = single_release(inode, file);
215
	module_put(THIS_MODULE);
216
	return ret;
217
}
226 218

  
227
	/* signal EOF */
228
	*eof = 1;
219
static const struct file_operations vtunerc_read_proc_fops = {
220
	.open		= vtunerc_proc_open,
221
	.read		= seq_read,
222
	.llseek		= seq_lseek,
223
	.release	= vtuner_proc_release,
224
	};
229 225

  
230
	return blen;
231

  
232
}
233 226
#endif
234 227

  
235 228
static char *my_strdup(const char *s)
......
338 331
			sprintf(procfilename, VTUNERC_PROC_FILENAME,
339 332
					ctx->idx);
340 333
			ctx->procname = my_strdup(procfilename);
341
			if (create_proc_read_entry(ctx->procname, 0, NULL,
342
							vtunerc_read_proc,
334
			if (proc_create_data(ctx->procname, 0, NULL,
335
							&vtunerc_read_proc_fops,
343 336
							ctx) == 0)
344 337
				printk(KERN_WARNING
345 338
					"vtunerc%d: Unable to register '%s' proc file\n",
vtunerc_priv.h Tue Apr 02 13:58:29 2013 +0200 โ†’ vtunerc_priv.h Tue Jul 09 13:32:18 2013 +0200
20 20
#include <linux/module.h>	/* Specifically, a module */
21 21
#include <linux/kernel.h>	/* We're doing kernel work */
22 22
#include <linux/cdev.h>
23
#include <linux/version.h>
23 24

  
24 25
#include "demux.h"
25 26
#include "dmxdev.h"
......
105 106
	printk(KERN_DEBUG "vtunerc%d: " fmt, ctx->idx, ##arg);	\
106 107
} while (0)
107 108

  
109
/* backward compatibility stuff */
110
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
111
static inline void *PDE_DATA(const struct inode *inode)
112
{
113
	return PROC_I(inode)->pde->data;
114
}
108 115
#endif
116

  
117

  
118
#endif
    (1-1/1)