2.4.33.3:patch v4l2,bttv driver--Help
Hi,
New (n permanent) Slackware 11 (ibare 2.4 kernel) user. A few questions regarding kernel upgrade/patch (my 1st): 1.Got these (only) 2 failures while patching the 2.4.33.3 kernel with this patch from bytesex.org: patch-2_4_26-kraxel_gz ( want aviosys 7134 TV Tuner pci card drivers, also driver for bttv cards ) 1.(Stripping trailing CRs from patch.) patching file drivers/media/video/bttv-driver.c Hunk #10 FAILED at 258. 1 out of 15 hunks FAILED -- saving rejects to file drivers/media/video/bttv-driver.c.rej patching file drivers/media/video/bttv-if.c Hunk #9 FAILED at 150. 1 out of 9 hunks FAILED -- saving rejects to file drivers/media/video/bttv-if.c.rej bttv-driver.c.rej contents (there were red(-) and blue lines (+)): *** 557,564 **** .vbipack = 144, .sram = -1, },{ - /* PAL-N */ - .Fsc 35468950, .swidth = 768, .sheight = 576, .totalwidth = 1135, --- 258,266 ---- .vbipack = 144, .sram = -1, },{ + .v4l2_id = V4L2_STD_PAL_N, + .name = "PAL-N", + .Fsc = 35468950, .swidth = 768, .sheight = 576, .totalwidth = 1135, Opened .rej and .c files in kwrite (saw the previous formatted text) and added (in bttv-driver.c) : .v4l2_id = V4L2_STD_PAL_N, .name = "PAL-N", AND deleted: /* PAL-N */ Also, bttv-if.c.rej( there were no red and blue lines) contents (There were very few differences in .c.rej and .c....On a hunch i opened patch-2_4_26-kraxel_gz in kwrite and saw that below lines, referring to same file were in red with a - sign): *** 144,352 **** return &btv->gpioq; } - - /* ----------------------------------------------------------------------- */ - /* I2C functions */ - - void bttv_bit_setscl(void *data, int state) - { - struct bttv *btv = (struct bttv*)data; - - if (state) - btv->i2c_state |= 0x02; - else - btv->i2c_state &= ~0x02; - btwrite(btv->i2c_state, BT848_I2C); - btread(BT848_I2C); - } - - void bttv_bit_setsda(void *data, int state) - { - struct bttv *btv = (struct bttv*)data; - - if (state) - btv->i2c_state |= 0x01; - else - btv->i2c_state &= ~0x01; - btwrite(btv->i2c_state, BT848_I2C); - btread(BT848_I2C); - } - - static int bttv_bit_getscl(void *data) - { - struct bttv *btv = (struct bttv*)data; - int state; - - state = btread(BT848_I2C) & 0x02 ? 1 : 0; - return state; - } - - static int bttv_bit_getsda(void *data) - { - struct bttv *btv = (struct bttv*)data; - int state; - - state = btread(BT848_I2C) & 0x01; - return state; - } - - #ifndef I2C_PEC - static void bttv_inc_use(struct i2c_adapter *adap) - { - MOD_INC_USE_COUNT; - } - - static void bttv_dec_use(struct i2c_adapter *adap) - { - MOD_DEC_USE_COUNT; - } - #endif - - static int attach_inform(struct i2c_client *client) - { - struct bttv *btv = i2c_get_adapdata(client->adapter); - - if (btv->tuner_type != UNSET) - bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); - if (btv->pinnacle_id != UNSET) - bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, - &btv->pinnacle_id); - - if (bttv_debug) - printk("bttv%d: i2c attach [client=%s]\n", - btv->nr, i2c_clientname(client)); - return 0; - } - - void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg) - { - if (0 != btv->i2c_rc) - return; - i2c_clients_command(&btv->i2c_adap, cmd, arg); - } - - void bttv_i2c_call(unsigned int card, unsigned int cmd, void *arg) - { - if (card >= bttv_num) - return; - bttv_call_i2c_clients(&bttvs[card], cmd, arg); - } - - static struct i2c_algo_bit_data bttv_i2c_algo_template = { - .setsda = bttv_bit_setsda, - .setscl = bttv_bit_setscl, - .getsda = bttv_bit_getsda, - .getscl = bttv_bit_getscl, - .udelay = 16, - .mdelay = 10, - .timeout = 200, - }; - - static struct i2c_adapter bttv_i2c_adap_template = { - #ifdef I2C_PEC - .owner = THIS_MODULE, - #else - .inc_use = bttv_inc_use, - .dec_use = bttv_dec_use, - #endif - #ifdef I2C_ADAP_CLASS_TV_ANALOG - .class = I2C_ADAP_CLASS_TV_ANALOG, - #endif - I2C_DEVNAME("bt848"), - .id = I2C_HW_B_BT848, - .client_register = attach_inform, - }; - - static struct i2c_client bttv_i2c_client_template = { - I2C_DEVNAME("bttv internal"), - .id = -1, - }; - - - /* read I2C */ - int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for) - { - unsigned char buffer = 0; - - if (0 != btv->i2c_rc) - return -1; - if (bttv_verbose && NULL != probe_for) - printk(KERN_INFO "bttv%d: i2c: checking for %s @ 0x%02x... ", - btv->nr,probe_for,addr); - btv->i2c_client.addr = addr >> 1; - if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) { - if (NULL != probe_for) { - if (bttv_verbose) - printk("not found\n"); - } else - printk(KERN_WARNING "bttv%d: i2c read 0x%x: error\n", - btv->nr,addr); - return -1; - } - if (bttv_verbose && NULL != probe_for) - printk("found\n"); - return buffer; - } - - /* write I2C */ - int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1, - unsigned char b2, int both) - { - unsigned char buffer[2]; - int bytes = both ? 2 : 1; - - if (0 != btv->i2c_rc) - return -1; - btv->i2c_client.addr = addr >> 1; - buffer[0] = b1; - buffer[1] = b2; - if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes)) - return -1; - return 0; - } - - /* read EEPROM content */ - void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) - { - int i; - - if (bttv_I2CWrite(btv, addr, 0, -1, 0)<0) { - printk(KERN_WARNING "bttv: readee error\n"); - return; - } - btv->i2c_client.addr = addr >> 1; - for (i=0; i<256; i+=16) { - if (16 != i2c_master_recv(&btv->i2c_client,eedata+i,16)) { - printk(KERN_WARNING "bttv: readee error\n"); - break; - } - } - } - - /* init + register i2c algo-bit adapter */ - int __devinit init_bttv_i2c(struct bttv *btv) - { - memcpy(&btv->i2c_adap, &bttv_i2c_adap_template, - sizeof(struct i2c_adapter)); - memcpy(&btv->i2c_algo, &bttv_i2c_algo_template, - sizeof(struct i2c_algo_bit_data)); - memcpy(&btv->i2c_client, &bttv_i2c_client_template, - sizeof(struct i2c_client)); - - sprintf(btv->i2c_adap.name, "bt848 #%d", btv->nr); - - btv->i2c_algo.data = btv; - i2c_set_adapdata(&btv->i2c_adap, btv); - btv->i2c_adap.algo_data = &btv->i2c_algo; - btv->i2c_client.adapter = &btv->i2c_adap; - - bttv_bit_setscl(btv,1); - bttv_bit_setsda(btv,1); - - btv->i2c_rc = i2c_bit_add_bus(&btv->i2c_adap); - return btv->i2c_rc; - } - /* * Local variables: * c-basic-offset: 8 --- 150,155 ---- return &btv->gpioq; } /* * Local variables: * c-basic-offset: 8 - #ifdef I2C_PEC - .owner = THIS_MODULE, - #else So deleted all these lines starting from: /* I2C functions .... Added these 2 lines at the end since they were in patch-2_4_26-kraxel_gz (not red) and not in bttv-if.c: #endif #ifndef I2C_PEC Please comment on whether what i did above was correct or not. 2.Since i want to recompile the kernel ,i would like to know which (where) are the incremental patches which can be d/l and tranferred on a floppy. I have the patches: from patch-2.4.33.4 to patch-2.4.33.7. I suppose these patches can't be applied as they are not incremental patches (i.e.patch-2.4.33.7 can be applied only to 2.4.33 to bring it up to 2.4.33.7) ??? Read for 2.6 kernel u can go back and then do an upgrade (but how?)..ex.from 2.6.17.3 to 2.6.17 and then to 2.6.18. Is it possible for kernel to be upgraded to 2.4.34 using only incremental patches or is it better/less trouble to stick with 2.4.33.3/2.4.33.7? (have Internet access only at cybercafe) Thanks |
Hunks usually get rejected because the code to replace is not in the place the patch says it is. Someitmes you have to manully insert those hunks -stuff with the '-' is what gets removed and stuff with '+' is what gets added. You can sometimes jiggle the line lumbers in the patch to do the same thing. Try using 'patch -l' to ignore minor white-space differernces.
Usually grepping for the leading line of each hunk in the source file will help you find where the code is intended to go: grep -nrH "vbipack \= 144" * |
Thanks gnashley.I tried with -l switch-same outcome. I am quite sure i got the "driver" file right.
Also patched kernel with patch-2.4.33.7 Deleted the .rej's) My Linux adventure continues..... Regards |
All times are GMT -5. The time now is 07:05 AM. |