[dev] camera fix - HD Mini Android Development

Some fixes:
- dmesg
Code:
<6>[ 1.044134] pmem_camera: 1 init
- mem
Code:
static struct android_pmem_platform_data pmem_camera_pdata = {
.name = "pmem_camera",
.no_allocator = 0,
//cardsharing
// .cached = 0,
.cached = 1,
};
no more physical address error, but somethink is not ok with jpegtask
Code:
<6>[ 194.591656] pmem: successful request for physical address of pmem region id 1, offset 650190848, len 524288
<6>[ 194.591716] pmem: successful request for physical address of pmem region id 2, offset 661762048, len 6721536
<6>[ 194.612419] adsp_open() name = 'JPEGTASK'
<6>[ 194.612514] adsp: opening module JPEGTASK
<6>[ 194.613648] adsp: module JPEGTASK has been registered
<6>[ 194.613674] adsp_open() module 'JPEGTASK' adev e4978e84
<6>[ 194.613708] msm_adsp_enable() 'JPEGTASK'state[0] id[42]
<6>[ 194.614464] adsp: rpc event=0, proc_id=2, module=42, image=0
<6>[ 194.614748] adsp: module JPEGTASK: READY
<6>[ 194.615379] pmem: successful request for physical address of pmem region id 1, offset 649142272, len 4096
<6>[ 194.615554] pmem: successful request for physical address of pmem region id 1, offset 649146368, len 4096
<6>[ 194.615603] adsp_pmem_add module JPEGTASK vaddr:0x41168000 paddr:0x26b12000 len:4096
<6>[ 194.615633] adsp_pmem_add module JPEGTASK vaddr:0x4116c000 paddr:0x26b13000 len:4096
<6>[ 194.615801] adsp_pmem_add module JPEGTASK vaddr:0x41ffc000 paddr:0x26c12000 len:524288
<3>[ 194.615836] module JPEGTASK: verify failed.
maybe you have idea!

I think problem with: camera (jpeg), youtube (high def video) , but all working (output way), but not working (input way), is becouse we have something wrong with user space (maybe problem with permisions!), or maybe need corection for memory mapping!
I've tried to fix cammera, and I know bug is inside when camera catcing picture from jpeg task (input way not working, but output way working). Also, I know when youtube catching "high def video" (input way), something is not ok with "codecs" or "user space" or "memmory map"... maybe you have idea?
I think fixing cam bug will fix all (youtube...etc)
EDIT:
See this:
Code:
<6>[ 194.615801] adsp_pmem_add module JPEGTASK vaddr:0x41ffc000 paddr:0x26c12000 len:524288
Why len is 524288? Picture have size > 3-4M, maybe it cause problem with jpegtask verify??

about video and youtube problem in codecs
about camera problem in memory map

I think problem is in msm_adsp.h, adsp.c, adsp.h and adsp_photon.c
something is not ok there (I think wrong in adsp_photon.c != msm_adsp.h!) becouse I see in dmesg from int adsp_video_verify_cmd() warning about "unknown video queue"... from code:
Code:
int adsp_video_verify_cmd(struct msm_adsp_module *module,
unsigned int queue_id, void *cmd_data,
size_t cmd_size)
{
switch (queue_id) {
case QDSP_mpuVDecPktQueue:
DLOG("\n");
return verify_vdec_pkt_cmd(module, cmd_data, cmd_size);
default:
printk(KERN_INFO "unknown video queue %u\n", queue_id);
return 0;
}
}
and from it I know QDSP_mpuVDecPktQueue is not used, so I think we have problem in adsp_photon.c and need to realign it like defined in msm_adsp.h!!!
I dumped something, maybe help here:
Code:
<4>[ 0.972350] adsp: module name=AUDPLAY0TASK, module id=2, mod clk=<NULL>, verify cmd=0, patch event=0, pdev name=adsp_AUDPLAY0TASK, pdev id=-1, id_to_module=e4979000
<4>[ 0.972588] adsp: module name=AUDPPTASK, module id=7, mod clk=<NULL>, verify cmd=0, patch event=0, pdev name=adsp_AUDPPTASK, pdev id=-1, id_to_module=e4979148
<4>[ 0.972741] adsp: module name=AUDRECTASK, module id=19, mod clk=<NULL>, verify cmd=0, patch event=0, pdev name=adsp_AUDRECTASK, pdev id=-1, id_to_module=e4979290
<4>[ 0.972886] adsp: module name=AUDPREPROCTASK, module id=20, mod clk=<NULL>, verify cmd=0, patch event=0, pdev name=adsp_AUDPREPROCTASK, pdev id=-1, id_to_module=e49793d8
<4>[ 0.973040] adsp: module name=VFETASK, module id=31, mod clk=vfe_clk, verify cmd=c0143330, patch event=c01437f4, pdev name=adsp_VFETASK, pdev id=-1, id_to_module=e4979520
<4>[ 0.973183] adsp: module name=QCAMTASK, module id=43, mod clk=<NULL>, verify cmd=0, patch event=0, pdev name=adsp_QCAMTASK, pdev id=-1, id_to_module=e4979668
<4>[ 0.973330] adsp: module name=JPEGTASK, module id=42, mod clk=vdc_clk, verify cmd=c0142f0c, patch event=c01432d4, pdev name=adsp_JPEGTASK, pdev id=-1, id_to_module=e49797b0
<4>[ 0.973568] adsp: module name=VIDEOTASK, module id=9, mod clk=vdc_clk, verify cmd=c01429c0, patch event=0, pdev name=adsp_VIDEOTASK, pdev id=-1, id_to_module=e49798f8
<4>[ 0.973713] adsp: module name=VDEC_LP_MODE, module id=48, mod clk=<NULL>, verify cmd=0, patch event=0, pdev name=adsp_VDEC_LP_MODE, pdev id=-1, id_to_module=e4979a40
<4>[ 0.973901] adsp: module name=VIDEOENCTASK, module id=30, mod clk=vdc_clk, verify cmd=c0142bd8, patch event=0, pdev name=adsp_VIDEOENCTASK, pdev id=-1, id_to_module=e4979b88
And yes, cammera jpegtask have problem with memory map, but video have problem in adsp!

may be ,video with another player with codecs work good

http://gitorious.org/linux-on-qualcomm-s-msm/linux-msm/blobs/htc-msm-2.6.27/arch/arm/mach-msm/pmem.c
this file had camera pmem calc
i think this is help with with
NOTE: need edits in devices_htc.c/.h
NOTE2: Camera Snapshot work only in Fast Burst Camera

Ok I will try! Please see this -> http://forum.xda-developers.com/showpost.php?p=16448252&postcount=4

camera
Hi !
sorry for my English, but someone has a solution for a problem with camera in hd mini ? I try the android r134 FANTASTIC, but no photos some one can help me?
tanks

No reason do make doubbleposts.
As you can see in this thread, they are working on it.
Its still "under construction"

something interesting from strace
Code:
writev(3, [{"\4", 1}, {"GPhoto\0", 7}, {"Sd-card availableSize = 5673\0", 29}], 3) = 37
syscall_983042(0x43904738, 0x4390473c, 0, 0x4390473c, 0xaca8c3f4, 0x438f70cf, 0x434, 0xf0002, 0, 0x40041858, 0xcd80, 0xbe9e4700, 0, 0xbe9e43f0, 0xaca64fc7, 0xafd0ec8c, 0x8000010, 0x43904738, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = 0
Code:
recv(52740, 0x80, 4294966774, MSG_WAITALL|MSG_TRUNC|MSG_DONTWAIT|MSG_PROBE|MSG_FIN|MSG_NOSIGNAL|0xbe9e0000) = -1 ETIMEDOUT (Connection timed out)

TIMEDOUT !! I don't know where is timedout, hmmm FUTEX??? Also I seen in dmesg always diferent size in bank_1 but it's defined static !!

this adress 0xbe9e0000 don't responding

I found something! Curently error come from msm_camera.c (see dmesg.log) "msm_put_stats_buffer: NULL physical address"!!!
Two functions:
first:
Code:
static int msm_put_stats_buffer(struct msm_sync *sync, void __user *arg)
{
int rc = -EIO;
struct msm_stats_buf buf;
unsigned long pphy;
struct msm_vfe_cfg_cmd cfgcmd;
if (copy_from_user(&buf, arg,
sizeof(struct msm_stats_buf))) {
ERR_COPY_FROM_USER();
return -EFAULT;
}
CDBG("%s\n", __func__);
pphy = msm_pmem_stats_vtop_lookup(sync, buf.buffer, buf.fd);
if (pphy != 0) {
if (buf.type == STAT_AEAW)
cfgcmd.cmd_type = CMD_STATS_BUF_RELEASE;
else if (buf.type == STAT_AF)
cfgcmd.cmd_type = CMD_STATS_AF_BUF_RELEASE;
else {
pr_err("%s: invalid buf type %d\n",
__func__,
buf.type);
rc = -EINVAL;
goto put_done;
}
cfgcmd.value = (void *)&buf;
if (sync->vfefn.vfe_config) {
rc = sync->vfefn.vfe_config(&cfgcmd, &pphy);
if (rc < 0)
pr_err("%s: vfe_config error %d\n",
__func__, rc);
} else
pr_err("%s: vfe_config is NULL\n", __func__);
} else {
pr_err("%s: NULL physical address\n", __func__);
rc = -EINVAL;
}
put_done:
return rc;
}
In second function I added (see dmesg.log!) printk, and I see vaddr and buffer addr sometimes is ===, sometimes !== so it need to be fixed but hmmm where??? I not have idea , maybe you have idea:
Code:
static unsigned long msm_pmem_stats_vtop_lookup(
struct msm_sync *sync,
unsigned long buffer,
int fd)
{
struct msm_pmem_region *region;
struct hlist_node *node, *n;
hlist_for_each_entry_safe(region, node, n, &sync->pmem_stats, list) {
printk("ADSP TEST: region->info.vaddr(0x%08lx)==(0x%08lx)buffer, region->info.fd(%d)==(%d)fd, region->info.vfe_can_write(%d)==0\n",
((unsigned long)(region->info.vaddr)), buffer, region->info.fd, fd, region->info.vfe_can_write);
if (((unsigned long)(region->info.vaddr) == buffer) &&
(region->info.fd == fd) &&
region->info.vfe_can_write == 0) {
region->info.vfe_can_write = 1;
return region->paddr;
}
}
return 0;
}
As you see some memory regions is not writeable becouse region->info.vaddr !== buffer

i don't think so
i think problem in s5k4e1gx.c
Code:
{ /*Snapshot*/
0x06, /* pre_pll_clk_div REG=0x0305 */
0x00, /* pll_multiplier_msb REG=0x0306 */
0x50, /* pll_multiplier_lsb REG=0x0307 */
0x00, /* vt_sys_clk_div REG=0x30B5 */
0xB0, /* DPHY_bandctrl REG=0x30F1 */
0x00, /* read_mode REG=0x0101 */
0x0A, /* x_output_size_msb REG=0x034C */
0x30, /* x_output_size_lsb REG=0x034D */
0x07, /* y_output_size_msb REG=0x034E */
0xA8, /* y_output_size_lsb REG=0x034F */
0x01, /* x_even_inc REG=0x0381 */
0x01, /* x_odd_inc REG=0x0383 */
0x01, /* y_even_inc REG=0x0385 */
0x01, /* y_odd_inc REG=0x0387 */
0x03, /* h_binning REG=0x30A9 */
0xE8, /* v_binning REG=0x300E */
0x07, /* frame_length_lines_msb REG=0x0340 */
0xB4, /* frame_length_lines_lsb REG=0x0341 */
0x0A, /* line_length_pck_msb REG=0x0342 */
0xB2, /* line_length_pck_lsb REG=0x0343 */
0x10, /* pclk_inv; REG=0x3110 */
0x0C, /* pclk_delay; REG=0x3117 */
0x0A, /* v_h_strength; REG=0x3119 */
0xAA, /* data_pclk_strength; REG=0x311A */
0x82, /* cds_test REG=0x300F */
0xC0, /* rst_offset1 REG=0x3013 */
0xA4, /* rmp_init REG=0x3017 */ /*0x94*/
0x88, /* comp_bias REG=0x301B */ /*0x71*/
0x00, /* analogue_gain_code_global_msb REG=0x0204 */
0x80, /* analogue_gain_code_global_lsb REG=0x0205 */
0x07, /* coarse_integration_time_msb REG=0x0202 */
0xA8, /* coarse_intergation_time_lsb REG=0x0203 */
1960, /* size_h */
12, /* blk_l*/
2608, /* size_w*/
130 /* blk_p*/
}
};
or may be
static int msm_divert_snapshot(struct msm_sync *sync,
in msm_camera

Ok maybe! But as you see region->info.vaddr !== buffer ...some offsets differs there and I don't know what cause it or where I need to search Maybe haret not cleaned completely some memory regions?

i try to research diffs in leo kernel
only find time fix

Maked some tests and I confirm we have problem in queue_id and it need to be fixed in photon_adsp.c or msm_adsp.h... see dmesg with latest kernel from munjeni release thread... I tried video and camera and got "adsp_video_verify_cmd: unknown video queue 4" and in jpeg_verify "-1" !!! So one queue step fail or maybe array of the queues (or array of the module offsets) in adsp_photon.c or msm_adsp.h need to be realigned! I think it cause audio loop and video freze in youtube becouse wrong queue (wrong module used), allso cause problem in video capture! With new memory map I got youtube to "not freze" but could not stop audio and no high def video... please see commit http://gitorious.org/2-6-32-photon/testing/commit/e3121b4083068760fc33a277e10c049a4054840d you will see QDSP_uPJpegActionCmdQueue is not used!

i think value for camera 22 - 23
because logcat have error with 22 ioctl
QDSP_uPJpegActionCmdQueue with 22 value you can find in leo source msm_adsp

Maybe asking help from Cianogen to support our phone becouse it's related to rpc and we not have that knownledge, it is hard to fix without .pdf specification for our phone!

problem with resolution, in fast burst camera with large buffer and 1280x760 all good in android camera problem with buffer ,
the first what can be a problem : auto-focus wrong offset
the second : buffer with very high resolution too large and pmem don't have needed size
the third : problem with ioctl

Related

Compiling custom modules... failed to insmod

Hi,
I am trying to make custom mtd module, to expand the mtd devices to read whole nand and i am using as an example msm_nand.c
So what i have done is added a few devices to mtd partition and compiled. But at the compilation ld says msm_dmov_exec_cmd in not found.. Does not sound good, because original msm_nand.c compiled good as well as the whole kernel.
Could someone help me?
Here is the code i added, i left last lines from the original and my addition due to the code length restriction here:
Code:
/* drivers/mtd/devices/msm_nand.c
.....
msm_nand_release_ex(&info->mtd);
dma_free_coherent(/*dev*/ NULL, SZ_4K,
info->msm_nand.dma_buffer,
info->msm_nand.dma_addr);
kfree(info);
}
return 0;
}
#define DRIVER_NAME "msm_nand_ex"
static struct platform_driver msm_nand_driver = {
.probe = msm_nand_probe,
.remove = __devexit_p(msm_nand_remove_ex),
.driver = {
.name = DRIVER_NAME,
}
};
MODULE_ALIAS(DRIVER_NAME);
#if defined(CONFIG_ARCH_MSM7X30)
#define MSM_NAND_PHYS 0xA0200000
#else
#define MSM_NAND_PHYS 0xA0A00000
#endif
static struct resource resources_nand[] = {
[0] = {
.name = "msm_nand_dmac",
.start = DMOV_NAND_CHAN,
.end = DMOV_NAND_CHAN,
.flags = IORESOURCE_DMA,
},
[1] = {
.name = "msm_nand_phys",
.start = MSM_NAND_PHYS,
.end = MSM_NAND_PHYS + 0x7FF,
.flags = IORESOURCE_MEM,
},
};
static struct mtd_partition nand_ex_partitions[] = {
{
.name = "bootloader",
.size = 0x00000016,
.offset = 0,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "amss",
.size = 0x000000bf,
.offset = 0x00000016,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "amss_fs",
.size = 0x00000058,
.offset = 0x000000d5,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "fota0",
.size = 0x00000022,
.offset = 0x0000012d,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "fota1",
.size = 0x00000022,
.offset = 0x0000014f,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "recovery",
.size = 0x00000062,
.offset = 0x00000171,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "dsp1",
.size = 0x000000a2,
.offset = 0x000001d3,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "boot",
.size = 0x00000062,
.offset = 0x00000275,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}
};
struct flash_platform_data msm_nand_ex_data = {
.parts = nand_ex_partitions,
.nr_parts = ARRAY_SIZE(nand_ex_partitions),
};
static struct platform_device *msm_device_nand_ex;
static int __init msm_nand_init(void)
{
int ret;
msm_device_nand_ex = platform_device_alloc("msm_nand_ex", -1);
if (!msm_device_nand_ex)
return -ENOMEM;
ret = platform_device_add_data(msm_device_nand_ex, &msm_nand_ex_data,
sizeof(msm_nand_ex_data));
ret = platform_device_add_resources(msm_device_nand_ex, resources_nand,
ARRAY_SIZE(resources_nand));
printk("%s : res=%d\n", __FUNCTION__, ARRAY_SIZE(resources_nand));
if (ret == 0)
ret = platform_device_add(msm_device_nand_ex);
if (ret){
platform_device_put(msm_device_nand_ex);
return ret;
}
return platform_driver_register(&msm_nand_driver);
}
static void __exit msm_nand_exit(void)
{
platform_driver_unregister(&msm_nand_driver);
platform_device_unregister(msm_device_nand_ex);
}
module_init(msm_nand_init);
module_exit(msm_nand_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("msm_nand flash driver code");
And also i get in dmesg weird message that my kernel version string is wrong, though i used same kernel except the last modification string. And i can't find any other kernel..
Thanks guys!
you should edit the Makefile and set
EXTRAVERSION = <your kernel version>.
Yes i managed to bypass it but the insmod then says msm_dmov_exec_cmd is not found..
Weird..
anonymous2183 said:
you should edit the Makefile and set
EXTRAVERSION = <your kernel version>.
Click to expand...
Click to collapse

j4fs driver is now OpenSource

Big news for every hacker on Samsung devices! j4fs driver is now OpenSource Enjoy: http://bit.ly/jatK1c
Click to expand...
Click to collapse
http://romkitchen.org/sgs/?s=home
Someone care to explain the benefits, if any, of this? My understanding from what little i read is it will help with kernal development on a decent number of samsung devices.
Edit: as in should i be "super excited", "meh", or "cool beans".
second that question .. does this help us?
Would this driver be the one that controls download mode?
Sent from my GT-I9000 using XDA Premium App
Maybe this?
added: Should have checked supercurio's github
Samsung v1 GT-I9100 sources: [common] param.lfs/j4fs driver (communication with bootloader), now OpenSource, yay!
google :
j4fs...
its a filesystem.... FACT
So my GUESS...
a driver for a filesystem...
like ext4 and fat drivers for handling our other storage..
a new filesystem for us to tweak the crap out of and use..?
though ive been wrong before. that is only a logical conclusion not a factual statement
TRusselo said:
google :
j4fs...
its a filesystem.... FACT
So my GUESS...
a driver for a filesystem...
like ext4 and fat drivers for handling our other storage..
a new filesystem for us to tweak the crap out of and use..?
though ive been wrong before. that is only a logical conclusion not a factual statement
Click to expand...
Click to collapse
Sounds good to me.
Sent from my GT-I9000 using XDA Premium App
TRusselo said:
google :
j4fs...
its a filesystem.... FACT
So my GUESS...
a driver for a filesystem...
like ext4 and fat drivers for handling our other storage..
a new filesystem for us to tweak the crap out of and use..?
though ive been wrong before. that is only a logical conclusion not a factual statement
Click to expand...
Click to collapse
according to the post above you this may be the file system used for the bootloaders on the sgs2 so it would help those folks when hacking.
J4FS porting released
If someone is still interested I've just finished the porting of the J4FS on 3.1.x kernel adding support for normal "block device" (for loopback image mounting).
movitool.ntd.homelinux.org/trac/movitool/wiki/j4fs
Hope this can help...
Ceers
Nitro
And another tool (standalone) to extract j4fs/lfs images (eg. param.lfs).
Note: it only extracts - if you want to modify an image you'll have to use the kernel module from the post above (or a hexeditor and some cleverness).
https://github.com/ius/j4fs_extract
(for Googleability)
whiteguypl said:
http://romkitchen.org/sgs/?s=home
Someone care to explain the benefits, if any, of this? My understanding from what little i read is it will help with kernal development on a decent number of samsung devices.
Edit: as in should i be "super excited", "meh", or "cool beans".
Click to expand...
Click to collapse
dunno for what the driver/partition is used, had troubles (device freeze) with custom kernel an the original module from my GT-I9100 (ICS)
as note: device boots and working without the j4fs module in initramfs...
just for fun a little patch for kernel 3.0.15, just read operation tested.
Code:
Index: jv/llid_kernel.c
===================================================================
--- jv/llid_kernel.c (Revision 2075)
+++ jv/llid_kernel.c (Arbeitskopie)
@@ -95,7 +95,7 @@
set_fs(oldfs);
j4fs_filp->f_flags &= ~O_NONBLOCK;
if (ret < 0) {
- printk(1, "j4fs_filp->read() failed: %d\n", ret);
+ printk(KERN_WARNING "j4fs_filp->read() failed: %d\n", ret);
return J4FS_FAIL;
}
// J4FS for moviNAND merged from ROSSI
@@ -153,7 +153,7 @@
set_fs(oldfs);
j4fs_filp->f_flags &= ~O_NONBLOCK;
if (ret < 0) {
- printk(1, "j4fs_filp->write() failed: %d\n", ret);
+ printk(KERN_WARNING "j4fs_filp->write() failed: %d\n", ret);
return J4FS_FAIL;
}
// J4FS for moviNAND merged from ROSSI
Index: jv/j4fs_kernel.c
===================================================================
--- jv/j4fs_kernel.c (Revision 2075)
+++ jv/j4fs_kernel.c (Arbeitskopie)
@@ -10,7 +10,9 @@
* 2009.03 - Currently managed by SungHwan.yun <[email protected]> @[email protected]
*
*/
-#include <linux/smp_lock.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
#include <linux/time.h>
#include <linux/highuid.h>
#include <linux/pagemap.h>
@@ -53,6 +55,8 @@
#define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags)
+#define init_MUTEX(sema) sema_init(sema,1)
+
extern j4fs_device_info device_info;
extern unsigned int j4fs_traceMask;
extern unsigned int j4fs_rw_start;
@@ -234,7 +238,7 @@
T(J4FS_TRACE_FS, ("start j4fs_write_begin\n"));
if(to>PAGE_CACHE_SIZE) {
- T(J4FS_TRACE_ALWAYS,("%s %d: page size overflow(pos,index,offset,len,to)=(%d,%d,%d,%d,%d)\n",__FUNCTION__,__LINE__,pos,index,offset,len,to));
+ T(J4FS_TRACE_ALWAYS,("%s %d: page size overflow(pos,index,offset,len,to)=(%llu,%lu,%d,%d,%d)\n",__FUNCTION__,__LINE__,pos,index,offset,len,to));
j4fs_panic("page size overflow");
return -ENOSPC;
}
@@ -1221,7 +1225,7 @@
struct j4fs_sb_info * sbi;
struct j4fs_super_block * es;
struct inode *root;
- u32 tmp, len,ret;
+ u32 ret;
T(J4FS_TRACE_FS,("%s %d\n",__FUNCTION__,__LINE__));
@@ -1322,11 +1326,11 @@
}
-int j4fs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+static struct dentry *j4fs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
{
T(J4FS_TRACE_FS,("%s %d\n",__FUNCTION__,__LINE__));
- return get_sb_bdev(fs_type, flags, dev_name, data, j4fs_fill_super, mnt);
+ return mount_bdev(fs_type, flags, dev_name, data, j4fs_fill_super);
}
struct kmem_cache * j4fs_inode_cachep;
@@ -1386,7 +1390,7 @@
struct file_system_type j4fs_fs_type = {
.owner = THIS_MODULE,
.name = "j4fs",
- .get_sb = j4fs_get_sb,
+ .mount = j4fs_mount,
.kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV,
};
@@ -1416,9 +1420,16 @@
return -EINVAL;
}
-int j4fs_fsync(struct file *file, struct dentry *dentry, int datasync)
+static int j4fs_fsync(struct file *file, int datasync)
{
- return 0;
+ int rc = 0;
+
+ rc = generic_file_fsync(file, datasync);
+ if (rc)
+ goto out;
+ rc = vfs_fsync(file, datasync);
+out:
+ return rc;
}
int __init init_j4fs_fs(void)
Index: jv/j4fs.h
===================================================================
--- jv/j4fs.h (Revision 2075)
+++ jv/j4fs.h (Arbeitskopie)
@@ -167,6 +167,7 @@
#define J4FS_RECLAIM_RESET_UNUSED_SPACE
#define J4FS_TRANSACTION_LOGGING
+#undef T
#define T(mask, p) do { if ((mask) & (j4fs_traceMask | J4FS_TRACE_ALWAYS)) TOUT(p); } while (0)
#define POR(mask, p, q) do { if (((mask) & (j4fs_PORMask))&&!(--j4fs_PORCount)) {TOUT(p); while(1); }} while (0)
Index: jv/Makefile
===================================================================
--- jv/Makefile (Revision 2075)
+++ jv/Makefile (Arbeitskopie)
@@ -1,31 +1,5 @@
-##############################################################################
-# COPYRIGHT(C) : Samsung Electronics Co.Ltd, 2006-2011 ALL RIGHTS RESERVED
-# 2009.02 - Currently managed by JongMinKim <[email protected]> , SungHwanYun <[email protected]>
-##############################################################################
-# VERSION&DATE : Version 1.00 2009/02
-##############################################################################
+EXTRA_CFLAGS += -Wframe-larger-than=2048 -Wno-error=declaration-after-statement
-MOD_NAME = j4fs
+obj-$(CONFIG_J4FS) += j4fs.o
-ifneq ($(KERNELRELEASE), )
-
-EXTRA_CFLAGS += -I$(PRJROOT)/modules/include -I$(KDIR)/drivers/tfsr/Inc -I$(KDIR)/include -I$(KDIR)/include/linux -I$(KDIR)/include/asm -D__KERNEL
-
-obj-m := $(MOD_NAME).o
-
-$(MOD_NAME)-y := j4fs_kernel.o llid_kernel.o fsd_common.o
-
-else
-
-all:
- @$(MAKE) -C $(KDIR) \
- SUBDIRS=$(CURDIR) modules
-
-clean:
- rm -f *.o *.ko *.mod.c *~ .*.cmd
-
-install:
- @$(MAKE) --no-print-directory -C $(KDIR) \
- SUBDIRS=$(CURDIR) modules_install
-
-endif
+j4fs-objs := j4fs_kernel.o llid_kernel.o fsd_common.o

[DEV][WiP] Random MAC adressing with BCMDHD

Just wanted to share some knowledge here.
The main code responsable for the random MAC wifi adress with the newer BCMDHD wifi driver is mainly due to a small peace of code :
eeprom-wifi-mac.c in /tf101-kernel_whatever/arch/arm/mach-tegra.
code snippet:
Code:
#include <linux/i2c/at24.h>
#include <linux/sysfs.h>
#include <linux/device.h>
#include <linux/slab.h>
#define EEPROM_LEN 32
static char wifi_mac[] = "ff:ff:ff:ff:ff:ff";
static ssize_t show_addr_sysfs(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", wifi_mac);
}
DEVICE_ATTR(addr, 0444, show_addr_sysfs, NULL);
static struct attribute *wifi_mac_addr_attributes[] = {
&dev_attr_addr.attr,
NULL
};
static const struct attribute_group wifi_mac_addr_group = {
.attrs = wifi_mac_addr_attributes,
};
int create_sys_fs(void)
{
int ret = -1;
static struct kobject *reg_kobj;
reg_kobj = kobject_create_and_add("wifi_mac_addr", kernel_kobj);
if (!reg_kobj)
return -ENOMEM;
ret = sysfs_create_group(reg_kobj, &wifi_mac_addr_group);
if (ret < 0) {
kobject_put(reg_kobj);
return ret;
}
return ret;
}
void get_mac_addr(struct memory_accessor *mem_acc, void *context)
{
char *mac_addr;
int ret = 0;
off_t offset = (off_t)context;
mac_addr = kzalloc(sizeof(char)*EEPROM_LEN, GFP_ATOMIC);
if (!mac_addr) {
pr_err("no memory to allocate");
return;
}
/* Read MAC addr from EEPROM */
ret = mem_acc->read(mem_acc, mac_addr, offset, EEPROM_LEN);
if (ret == EEPROM_LEN) {
pr_err("Read MAC addr from EEPROM: %pM\n", (mac_addr+19));
sprintf(wifi_mac, "%02x:%02x:%02x:%02x:%02x:%02x",
*(mac_addr+19), *(mac_addr+20), *(mac_addr+21),
*(mac_addr+22), *(mac_addr+23), *(mac_addr+24));
} else
pr_err("Error reading MAC addr from EEPROM\n");
create_sys_fs();
}
Now we need a code monkey to do some dirty work and give us a new algorithm we can apply to the kernel for reading out / creating the MAC adress in another way. Maybe create a new sysfs interface to be able to change the MAC adress to whatever we like in userspace mode, e.g. per app.
Remember: This is a dev thread. Please do only post development-related stuff in here. Any help is appreciated. If you just want to say 'thanks', well, you know where the corresponding button is, don't ya ? ​
I don't understand what positive use a random MAC could be?
Sent from my Transformer TF101 using xda app-developers app
Probably the easiest way would be to strace wifimacwriter on ICS. It must call something in the kernel to get the MAC, or run some ioctls. Anyway, it's not self contained, so if we figure out how it works, we can write it ourselves, in kernel space.

[Q] HTC EVO 4G LTE pmem memory allocation failed -- reqbufs failed -12

I am trying to connect an USB camera over the USB port in the following device :
The android device is an HTC EVO 4G LTE
AndroidVersion = 4.3.1
Kernel Version = 3.4.11-gf8fed45
[email protected] #1
Mon Nov 11 6:05:44 PST 2013
CPU : ARMv7 Processor rev 0(v7I)
CynogenMod Version: 10.2.-20131111-NIGHTLY-jewel
The android phone is OTG enabled and reads the CAM in the USB port as shown in the logs. The problem I am facing is in the lines I described in the heading, the device is not able to to allocate the pmem memory. I am wondering is this is a bug in Cynogen in the videobuf2-msm-mem.c.
<6>[ 2850.902853] [CAM] s5k3h2yx: fuse->fuse_id_word1:0
<6>[ 2850.907522] [CAM] s5k3h2yx: fuse->fuse_id_word2:0
<6>[ 2850.912253] [CAM] s5k3h2yx: fuse->fuse_id_word3:0x00000004
<6>[ 2850.917686] [CAM] s5k3h2yx: fuse->fuse_id_word4:0x00430514
<6>[ 2850.923240] [CAM] msm_get_sensor_info,sdata->htc_image=0,sdata->use_rawchip=1,sdata->hdr_mode=0,sdata->video_hdr_capability=0
<6>[ 2850.945612] [CAM] msm_sensor_mode_init called
<6>[ 2850.950251] [CAM] msm_sensor_setting: update_type=0, res=0
<6>[ 2851.008545] [CAM] msm_get_sensor_info,sdata->htc_image=0,sdata->use_rawchip=1,sdata->hdr_mode=0,sdata->video_hdr_capability=0
<6>[ 2851.022676] [CAM] msm_enqueue: queue control new max is 1
<3>[ 2851.181351] [CAM][ERR] msm_camera_v4l2_reqbufs reqbufs failed -12
<6>[ 2855.596856] [CAM] msm_close Inst d895e400 freeing buffer offsets array
<6>[ 2855.602471] [CAM] msm_close Closing down instance d895e400, [0, 1]
<6>[ 2855.608820] [CAM] msm_send_close_server qid 0
<6>[ 2855.614405] [CAM] vpe_reset: VPE already disabled.
<6>[ 2855.618098] [CAM] vpe_disable, vpe_ctrl->state 0
<6>[ 2855.622767] [CAM] vpe_disable: VPE already disabled
snipset of the Kernel code
static void *msm_vb2_mem_ops_alloc(void *alloc_ctx, unsigned long size)
{
struct videobuf2_contig_pmem *mem;
unsigned int flags = 0;
long rc;
mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem)
return ERR_PTR(-ENOMEM);
mem->magic = MAGIC_PMEM;
mem->size = PAGE_ALIGN(size);
mem->alloc_ctx = alloc_ctx;
mem->is_userptr = 0;
mem->phyaddr = msm_mem_allocate(mem);
if (!mem->phyaddr) {
pr_err("%s : pmem memory allocation failed\n", __func__);
kfree(mem);
return ERR_PTR(-ENOMEM);
}
flags = MSM_SUBSYSTEM_MAP_IOVA;
mem->subsys_id = MSM_SUBSYSTEM_CAMERA;
mem->msm_buffer = msm_subsystem_map_buffer(mem->phyaddr, mem->size,
flags, &(mem->subsys_id), 1);
if (IS_ERR((void *)mem->msm_buffer)) {
pr_err("%s: msm_subsystem_map_buffer failed\n", __func__);
rc = PTR_ERR((void *)mem->msm_buffer);
msm_mem_free(mem);
kfree(mem);
return ERR_PTR(-ENOMEM);
}
mem->mapped_phyaddr = mem->msm_buffer->iova[0];
return mem;
}
static void msm_vb2_mem_ops_put(void *buf_priv)
{
struct videobuf2_contig_pmem *mem = buf_priv;
if (!mem->is_userptr) {
D("%s Freeing memory ", __func__);
if (msm_subsystem_unmap_buffer(mem->msm_buffer) < 0)
D("%s unmapped memory\n", __func__);
msm_mem_free(mem);
}
kfree(mem);
Any help will be appreciated

[HELP] weird errors with compiling kernel for s3ve3g

So, I decided I want to put Kali-Linux on my samsung s3 neo device, and I succeeded after hard work and a lots of research... Now I had another problem, that my built-in chipset does not support aircrack-ng, so i decided to work around it, and use a wireless usb adapter.
what i did is modifying the kernel, to be able to support some of the wireless devices... the point where i got stuck is at compiling the new-made kernel... basically i followed the following guide:
PHP:
http://forum.xda-developers.com/showthread.php?t=2338179
and i got stuck at the final section of the compiling segment...
So here is my error.
arch/arm/crypto/sha512_neon_glue.c: In function 'sha512_neon_update':
arch/arm/crypto/sha512_neon_glue.c:144:3: warning: implicit declaration of function 'crypto_sha512_update' [-Wimplicit-function-declaration]
error, forbidden warning: sha512_neon_glue.c:144
scripts/Makefile.build:307: recipe for target 'arch/arm/crypto/sha512_neon_glue.o' failed
make[1]: *** [arch/arm/crypto/sha512_neon_glue.o] Error 1
Makefile:950: recipe for target 'arch/arm/crypto' failed
make: *** [arch/arm/crypto] Error 2
Click to expand...
Click to collapse
so, first of all I have a question, where exactly do i put "KCONFIG_CFLAGS += -w" in the code of the Makefile, and if it would solve the error? according to the guide it should ignore errors that the compiler makes.
2nd question right under the code lines.
Makefile:
PHP:
https://github.com/CyanogenMod/android_kernel_samsung_s3ve3g/blob/cm-12.1/Makefile
Couldn't post it here, too long.
Second question, in case the first solution would not work, if i wanted to edit the problematic file, so it would see the declared functions, how do i do that?
NOTE: the error is in line 144
(will be marked with "------->")
Code:
*
* Glue code for the SHA512 Secure Hash Algorithm assembly implementation
* using NEON instructions.
*
* Copyright © 2014 Jussi Kivilinna <[email protected]>
*
* This file is based on sha512_ssse3_glue.c:
* Copyright (C) 2013 Intel Corporation
* Author: Tim Chen <[email protected]>
*
* 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.
*
*/
#include <crypto/internal/hash.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/cryptohash.h>
#include <linux/types.h>
#include <linux/string.h>
#include <crypto/sha.h>
#include <asm/byteorder.h>
#include <asm/simd.h>
#include <asm/neon.h>
static const u64 sha512_k[] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
0xd807aa98a3030242ULL, 0x12835b0145706fbeULL,
0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL,
0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL,
0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL,
0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL,
0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL,
0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL,
0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL,
0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL,
0xd192e819d6ef5218ULL, 0xd69906245565a910ULL,
0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL,
0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL,
0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL,
0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL,
0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL,
0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL,
0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
0x28db77f523047d84ULL, 0x32caab7b40c72493ULL,
0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL,
0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
};
asmlinkage void sha512_transform_neon(u64 *digest, const void *data,
const u64 k[], unsigned int num_blks);
static int sha512_neon_init(struct shash_desc *desc)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA512_H0;
sctx->state[1] = SHA512_H1;
sctx->state[2] = SHA512_H2;
sctx->state[3] = SHA512_H3;
sctx->state[4] = SHA512_H4;
sctx->state[5] = SHA512_H5;
sctx->state[6] = SHA512_H6;
sctx->state[7] = SHA512_H7;
sctx->count[0] = sctx->count[1] = 0;
return 0;
}
static int __sha512_neon_update(struct shash_desc *desc, const u8 *data,
unsigned int len, unsigned int partial)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
unsigned int done = 0;
sctx->count[0] += len;
if (sctx->count[0] < len)
sctx->count[1]++;
if (partial) {
done = SHA512_BLOCK_SIZE - partial;
memcpy(sctx->buf + partial, data, done);
sha512_transform_neon(sctx->state, sctx->buf, sha512_k, 1);
}
if (len - done >= SHA512_BLOCK_SIZE) {
const unsigned int rounds = (len - done) / SHA512_BLOCK_SIZE;
sha512_transform_neon(sctx->state, data + done, sha512_k,
rounds);
done += rounds * SHA512_BLOCK_SIZE;
}
memcpy(sctx->buf, data + done, len - done);
return 0;
}
static int sha512_neon_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE;
int res;
/* Handle the fast case right here */
if (partial + len < SHA512_BLOCK_SIZE) {
sctx->count[0] += len;
if (sctx->count[0] < len)
sctx->count[1]++;
memcpy(sctx->buf + partial, data, len);
return 0;
}
if (!may_use_simd()) {
------------> res = crypto_sha512_update(desc, data, len);
} else {
kernel_neon_begin();
res = __sha512_neon_update(desc, data, len, partial);
kernel_neon_end();
}
return res;
}
/* Add padding and return the message digest. */
static int sha512_neon_final(struct shash_desc *desc, u8 *out)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
unsigned int i, index, padlen;
__be64 *dst = (__be64 *)out;
__be64 bits[2];
static const u8 padding[SHA512_BLOCK_SIZE] = { 0x80, };
/* save number of bits */
bits[1] = cpu_to_be64(sctx->count[0] << 3);
bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
/* Pad out to 112 mod 128 and append length */
index = sctx->count[0] & 0x7f;
padlen = (index < 112) ? (112 - index) : ((128+112) - index);
if (!may_use_simd()) {
crypto_sha512_update(desc, padding, padlen);
crypto_sha512_update(desc, (const u8 *)&bits, sizeof(bits));
} else {
kernel_neon_begin();
/* We need to fill a whole block for __sha512_neon_update() */
if (padlen <= 112) {
sctx->count[0] += padlen;
if (sctx->count[0] < padlen)
sctx->count[1]++;
memcpy(sctx->buf + index, padding, padlen);
} else {
__sha512_neon_update(desc, padding, padlen, index);
}
__sha512_neon_update(desc, (const u8 *)&bits,
sizeof(bits), 112);
kernel_neon_end();
}
/* Store state in digest */
for (i = 0; i < 8; i++)
dst[i] = cpu_to_be64(sctx->state[i]);
/* Wipe context */
memset(sctx, 0, sizeof(*sctx));
return 0;
}
static int sha512_neon_export(struct shash_desc *desc, void *out)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memcpy(out, sctx, sizeof(*sctx));
return 0;
}
static int sha512_neon_import(struct shash_desc *desc, const void *in)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memcpy(sctx, in, sizeof(*sctx));
return 0;
}
static int sha384_neon_init(struct shash_desc *desc)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA384_H0;
sctx->state[1] = SHA384_H1;
sctx->state[2] = SHA384_H2;
sctx->state[3] = SHA384_H3;
sctx->state[4] = SHA384_H4;
sctx->state[5] = SHA384_H5;
sctx->state[6] = SHA384_H6;
sctx->state[7] = SHA384_H7;
sctx->count[0] = sctx->count[1] = 0;
return 0;
}
static int sha384_neon_final(struct shash_desc *desc, u8 *hash)
{
u8 D[SHA512_DIGEST_SIZE];
sha512_neon_final(desc, D);
memcpy(hash, D, SHA384_DIGEST_SIZE);
memset(D, 0, SHA512_DIGEST_SIZE);
return 0;
}
static struct shash_alg algs[] = { {
.digestsize = SHA512_DIGEST_SIZE,
.init = sha512_neon_init,
.update = sha512_neon_update,
.final = sha512_neon_final,
.export = sha512_neon_export,
.import = sha512_neon_import,
.descsize = sizeof(struct sha512_state),
.statesize = sizeof(struct sha512_state),
.base = {
.cra_name = "sha512",
.cra_driver_name = "sha512-neon",
.cra_priority = 250,
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SHA512_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
}, {
.digestsize = SHA384_DIGEST_SIZE,
.init = sha384_neon_init,
.update = sha512_neon_update,
.final = sha384_neon_final,
.export = sha512_neon_export,
.import = sha512_neon_import,
.descsize = sizeof(struct sha512_state),
.statesize = sizeof(struct sha512_state),
.base = {
.cra_name = "sha384",
.cra_driver_name = "sha384-neon",
.cra_priority = 250,
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SHA384_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
} };
static int __init sha512_neon_mod_init(void)
{
if (!cpu_has_neon())
return -ENODEV;
return crypto_register_shashes(algs, ARRAY_SIZE(algs));
}
static void __exit sha512_neon_mod_fini(void)
{
crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
}
module_init(sha512_neon_mod_init);
module_exit(sha512_neon_mod_fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, NEON accelerated");
MODULE_ALIAS("sha512");
MODULE_ALIAS("sha384");
Please help me I will be very thankful.
(NOTE: I am not a developer, and I wish I was, or at least i'm ought to be so please explain carefully your solutions since I'm not familiar with any coding language, and for me, reaching this stage of the kernel compiling was time consuming and my only tools were my logic and the internet). thanks in advance for any help i can get i wish it will work so i can move on in learning kali better!

Categories

Resources