[Samsung Gear 2] biktor_gj:
Okay guys, if I finally end up making the camera work you're going to owe me a BIIIIG beeeer ;)

No premade libraries would work on the Gear2. What can I do? Build them from the Samsung Manta opensource packages of course!

Just for the curious out there, here are the video nodes:

video6 --> s5p-mfc-dec

video7 --> s5p-mfc-enc

video13 --> exynos5-jpeg-hx.0:dec

video14 --> exynos5-jpeg-hx.0:enc

video23 --> exynos-gsc.0:m2m

video24 --> exynos-gsc.0.output

video25 --> exynos-gsc.0.capture

video26 --> exynos-gsc.1:m2m

video27 --> exynos-gsc.1:output

video28 --> exynos-gsc.1:capture

video100 --> fimc-is-sensor0

video101 --> fimc-is-sensor1

video110 --> fimc-is-3aa.0

video111 --> fimc-is-3aa.0c

video134 --> exynos-fimc-scalerc

media0 --> exynos-mdev.00

media1 --> exynos-mdev.11

So far, I have succeeded making the kernel crash, but at least, it got to attempt to open the camera before dying!

<6>[ 51.317639] [1] 1330 [@][SS0:V:0] fimc_is_sen_video_open
<6>[ 51.317739] [1] 1330 [@][RSC] fimc_is_resource_get: rsccount = 0
<6>[ 51.318462] [1] 1330 [@][SEN:D:0] fimc_is_sensor_runtime_resume(0)
<6>[ 51.318547] [1] 1330 [@][SEN:D:0] fimc_is_sensor_open(0)
<6>[ 51.318698] [1] 1330 [@][3A0:V:0] fimc_is_3aa_video_open
<6>[ 51.318826] [1] 1330 [@][RSC] fimc_is_resource_get: rsccount = 1
<6>[ 51.318974] [1] 1330 FIMC_IS runtime resume in
<6>[ 51.320074] [0] 1330 [RSC] fimc_is_runtime_resume: QoS LOCK [INT(135000), MIF(400000), CAM(0), DISP(100000)]
<6>[ 51.320162] [0] 1330 [RSC] fimc_is_runtime_resume: QoS LOCK [CPU(400000)]
<6>[ 51.320222] [0] 1330 exynos3_fimc_is_cfg_clk
<6>[ 51.320342] [0] 1330 sclk_mpll_pre_div : 400000000
<6>[ 51.320408] [0] 1330 xusbxti : 24000000
<6>[ 51.320561] [0] 1330 mcu_isp_400 : 400000000
<6>[ 51.320606] [0] 1330 mcu_isp_400_div0 : 200000000
<6>[ 51.320655] [0] 1330 aclk_mcuisp_div1 : 100000000
<6>[ 51.320775] [0] 1330 isp_266 : 100000000
<6>[ 51.320847] [0] 1330 aclk_div0 : 50000000
<6>[ 51.320920] [0] 1330 aclk_div1 : 50000000
<6>[ 51.320996] [0] 1330 aclk_div2 : 50000000
<6>[ 51.321068] [0] 1330 isp_uart : 66666666
<6>[ 51.321163] [0] 1330 isp_spi1 : 100000000
<6>[ 51.321259] [0] 1330 isp_spi0 : 100000000
<6>[ 51.321325] [0] 1330 isp_cam1 : 24000000
<6>[ 51.321496] [0] 1330 FIMC-IS runtime resume out
<6>[ 51.364316] [0] 1330 [@]fimc_is_fw2.bin version : E3470 7653-2014/06/18 16:07:26]F08LLHF04AM
<6>[ 51.365479] [0] 1330 [@]Camera: the default FW were applied successfully.
<6>[ 51.365707] [0] 1330 fimc_is_ischain_power : PA_FIMC_IS_GIC_C : 0x000000fc
<6>[ 51.365769] [0] 1330 [@]fimc_is_ischain_power(1) - A5 Power on
<6>[ 51.365827] [0] 1330 [@]fimc_is_ischain_power(1)
<6>[ 51.365878] [0] 1330 [@][ISC:D:0] fimc_is_ischain_open(0)
<6>[ 51.366584] [0] 1330 [@][SCC:V:0] fimc_is_scc_video_open
<6>[ 51.379219] [0] 406 [@]IS Version: 244.130 [0x00]
<6>[ 51.706963] [1] 1330 [@][ISP:V:0] <-> [SS0:V:0]
<4>[ 51.707065] [1] 1330 ------------[ cut here ]------------
<2>[ 51.707118] [1] 1330 kernel BUG at drivers/media/video/exynos/fimc-is-w1/fimc-is-device-sensor.c:1401!
<0>[ 51.707196] [1] 1330 Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
<4>[ 51.707263] [1] 1330 CPU: 1 Tainted: G W (3.4.39-ge5748b9-dirty #5)
<4>[ 51.707343] [1] 1330 PC is at fimc_is_sensor_g_module+0x5c/0x68
<4>[ 51.707402] [1] 1330 LR is at fimc_is_ischain_init+0x74/0x77c
<4>[ 51.707461] [1] 1330 pc : [<c038f0a4>] lr : [<c0395cd4>] psr: 600d0013
<4>[ 51.707514] [1] 1330 sp : dd591c78 ip : dd591c88 fp : dd591c84
<4>[ 51.707570] [1] 1330 r10: 00000000 r9 : dec80000 r8 : 00000003
<4>[ 51.707627] [1] 1330 r7 : 00000003 r6 : dec86e70 r5 : dec8ca08 r4 : dec8ca08
<4>[ 51.707692] [1] 1330 r3 : 00000000 r2 : 00000000 r1 : dd591ca0 r0 : dec86e70
<4>[ 51.707760] [1] 1330 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
<4>[ 51.707829] [1] 1330 Control: 10c5387d Table: 5d59c06a DAC: 00000015
<4>[ 51.707886] [1] 1330 CPU 1 / CLUSTER 0
<4>[ 51.707928] [1] 1330 DFSR: 00000017, ADFSR: 00000000, IFSR: 00000007, AIFSR: 00000000
<4>[ 51.708005] [1] 1330 CPUFREQ: 500000 KHz
<4>[ 51.708046] [1] 1330

What this means is:

1. The sensor device is opened correctly

2. The firmware is applied (yayyy!)

3. When opening the scaler, the entire kernel crashes. Now, since there are two scalers, each with its capture, output, and memory2memory device, and then a common one, I suppose that I'm opening the wrong one

We'll see if I can make it, at least, don't crash! (I could also try with the correct firmware too by the way ;))

Edit:

Come on buddy, a little more...

<6>[ 55.699997] [0] 1636 [@][SS0:V:0] fimc_is_sen_video_open
<6>[ 55.700101] [0] 1636 [@][RSC] fimc_is_resource_get: rsccount = 0
<6>[ 55.701259] [0] 1636 [@][SEN:D:0] fimc_is_sensor_runtime_resume(0)
<6>[ 55.701343] [0] 1636 [@][SEN:D:0] fimc_is_sensor_open(0)
<6>[ 55.701769] [0] 1636 [@][3A0C:V:0] fimc_is_3aac_video_open
<6>[ 55.701916] [0] 1636 [@][SCC:V:0] fimc_is_scc_video_open
<6>[ 55.985770] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(0), act(6), ch(cam_io_1.80))
<6>[ 55.986636] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(0), act(6), ch(cam_vdd_2.8v0))
<6>[ 55.987176] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(0), act(6), ch(cam_vdd_1.20))
<6>[ 55.987643] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(0), act(8), ch(0))
<6>[ 55.988969] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(155), act(1), ch(GPM2.3 (CAM_nRST)0))
<6>[ 55.989086] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(154), act(5), ch(GPM2.2 (CAM_MCLK)0))
<6>[ 55.990287] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(167), act(5), ch(GPM4.0 (CAM_I2C0_SCL)0))
<6>[ 55.991462] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(168), act(5), ch(GPM4.1 (CAM_I2C0_SDA)0))
<6>[ 55.992635] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(169), act(5), ch(GPM4.2 (CAM_I2C1_SCL)0))
<6>[ 55.993811] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(170), act(5), ch(GPM4.3 (CAM_I2C1_SDA)0))
<6>[ 55.994984] [0] 1636 exynos_fimc_is_sensor_pin_control(pin(0), act(6), ch(cam_af_2.80))
<6>[ 55.995597] [0] 1636 gpio cfg is end(11)
<6>[ 55.995646] [0] 1636 [@][SEN:D:0] input: 3, drive: 0, ret: 0)
<4>[ 55.995732] [0] 1636 [@][WRN] could not find proper sensor mode: 2576x1930@30fps
<6>[ 55.995797] [0] 1636 sensor mode(2576x1930@30) = 0
<4>[ 56.004844] [0] 1636 ------------[ cut here ]------------
<2>[ 56.004903] [0] 1636 kernel BUG at drivers/media/video/exynos/fimc-is-w1/fimc-is-device-sensor.c:1513!
<0>[ 56.004980] [0] 1636 Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM

Interesting, there are a lot of devices related to the camera. I don't know what most of them do, and as I don't have the camera I can only guess. Two of those devices are:

3aa.0

3aa.0c

There's also some thing that's called ISP. I don't know what that is either. But I found that if I use 3aa.0 device as the ISP video node, it loads the firmware and crashes the kernel. If, instead, I use 3aa.0c, It doesn't load the firmware, but it enables the GPIO outputs for the camera and attempts to set the resolution. An incorrect one by the way, then crashes the kernel too. But that's another story. Thing is... what the f*** is a ISP video node? What the f*** is the 3aa device? Why the f*** is there a common ScalerC (Scaler capture, used to downwsize the video image for capture through hardware -I think-) but there's no ScalerP for preview?

Thank god this is a 'FIMC-Lite' and not a Full FIMC... I don't understand anything...

EDIT AGAIN:

Aaaand this is looking... better?

KERNEL SIDE:

<6>[ 57.358366] [0] 2853 [@][SS1:V:0] fimc_is_sen_video_open
<6>[ 57.358440] [0] 2853 [@][RSC] fimc_is_resource_get: rsccount = 0
<6>[ 57.359869] [0] 2853 [@][SEN:D:1] fimc_is_sensor_runtime_resume(0)
<6>[ 57.359940] [0] 2853 [@][SEN:D:1] fimc_is_sensor_open(0)
<6>[ 57.360080] [0] 2853 [@][3A0:V:0] fimc_is_3aa_video_open
<6>[ 57.360189] [0] 2853 [@][RSC] fimc_is_resource_get: rsccount = 1
<6>[ 57.360317] [0] 2853 FIMC_IS runtime resume in
<6>[ 57.361666] [0] 2853 [RSC] fimc_is_runtime_resume: QoS LOCK [INT(135000)
, MIF(400000), CAM(0), DISP(100000)]
<6>[ 57.361765] [0] 2853 [RSC] fimc_is_runtime_resume: QoS LOCK [CPU(400000)
]
<6>[ 57.361831] [0] 2853 exynos3_fimc_is_cfg_clk
<6>[ 57.361951] [0] 2853 sclk_mpll_pre_div : 400000000
<6>[ 57.362025] [0] 2853 xusbxti : 24000000
<6>[ 57.362182] [0] 2853 mcu_isp_400 : 400000000
<6>[ 57.362238] [0] 2853 mcu_isp_400_div0 : 200000000
<6>[ 57.362292] [0] 2853 aclk_mcuisp_div1 : 100000000
<6>[ 57.362418] [0] 2853 isp_266 : 100000000
<6>[ 57.363009] [0] 2853 aclk_div0 : 50000000
<6>[ 57.363107] [0] 2853 aclk_div1 : 50000000
<6>[ 57.363197] [0] 2853 aclk_div2 : 50000000
<6>[ 57.363279] [0] 2853 isp_uart : 66666666
<6>[ 57.364295] [0] 2853 isp_spi1 : 100000000
<6>[ 57.364400] [0] 2853 isp_spi0 : 100000000
<6>[ 57.364472] [0] 2853 isp_cam1 : 24000000
<6>[ 57.364652] [0] 2853 FIMC-IS runtime resume out
<6>[ 57.433396] [0] 2853 [@]fimc_is_fw2.bin version : 5E3250 5132-2014/03/05
12:39:55]O13LHC02SB
<6>[ 57.435283] [0] 2853 [@]Camera: the default FW were applied successfully
.
<6>[ 57.435507] [0] 2853 fimc_is_ischain_power : PA_FIMC_IS_GIC_C : 0x000000
fc
<6>[ 57.435579] [0] 2853 [@]fimc_is_ischain_power(1) - A5 Power on
<6>[ 57.435648] [0] 2853 [@]fimc_is_ischain_power(1)
<6>[ 57.435707] [0] 2853 [@][ISC:D:0] fimc_is_ischain_open(0)
<6>[ 57.436203] [0] 2853 [@][SCC:V:0] fimc_is_scc_video_open
<6>[ 57.452753] [0] 406 [@]IS Version: 244.130 [0x00]
<6>[ 57.801444] [0] 2853 [@][ISP:V:0] <-> [SS0:V:0]
<3>[ 57.801518] [0] 2853 [@][0][ERR]fimc_is_3aa_video_s_input:579: sensor0 i
s not opened

And Android side of the camera:

I/Camera2ClientBase( 1331): Camera 0: Opened. Client: media (PID 1331, UID 1013)
D/ExynosCameraHAL2( 1331):
D/ExynosCameraHAL2( 1331):
D/ExynosCameraHAL2( 1331): >>> I'm Samsung's CameraHAL_2(ID:0) <<<
D/ExynosCameraHAL2( 1331):
D/ExynosCameraHAL2( 1331): g_cam2_device : 0x00000000
D/ExynosCameraHAL2( 1331): (ExynosCameraHWInterface2): ENTER
E/libexynosv4l2( 1331): failed to ioctl: VIDIOC_S_INPUT (22 - Invalid argument)
E/ExynosCameraHAL2( 1331): cam_int_s_input: VIDIOC_S_INPUT failed (-1)
E/ExynosCameraHAL2( 1331): ERR(InitializeISPChain): cam_int_s_input(3) failed!!!!
D/ExynosCameraHAL2( 1331): (ExynosCameraHWInterface2): EXIT
E/ExynosCameraHAL2( 1331): DEBUG(HAL2_camera_device_open): ExynosCameraHWInterface2 creation failed
I/Sensors ( 1637): AccSensor (0) old sensor_state 2228224, new sensor_state : 2228225 en : 1
E/Camera2-Device( 1331): initialize: Could not open camera 0: No such device (-19)
E/Camera2ClientBase( 1331): initialize: Camera 0: unable to initialize device: No such device (-19)
E/CameraService( 1331): connectFinishUnsafe: Could not initialize client from HAL module.
I/Camera2Client( 1331): Camera 0: Closed
I/Camera2ClientBase( 1331): Closed Camera 0. Client was: media (PID 1331, UID 1013)
W/CameraManager( 2859): Error querying camera device 0 for listing.
I/CameraService( 1331): getCameraCharacteristics: Switching to HAL1 shim implementation...

Aaaand this is where I stand. I don't have a camera. As far as I can see, it's doing what it should do, given that the kernel cannot start a device that doesn't exist. It's very unlikely that this is going to work at all, but I can't test any further. Building an image now for you to try all this stuff.

WHAT I NEED:

1. Flash the image with Odin

2. When it boots, open a shell, and run:

adb logcat > logcat.log

Leave it running for 30 seconds more or less, then attempt to launch "OpenCamera" app (it will be bundled on the image)

IF IT DOESN'T REBOOT HARD AND JUST GOES BACK TO THE CLOCK:

press CTRL+C on the shell and run:

adb shell dmesg > dmesg.log

POST BOTH FILES!

IF IT REBOOTS HARD:

Press and hold the power button until reboots, THEN GO STRAIGHT TO RECOVERY.

When recovery is up and adb is available, run:

adb shell cat /proc/last_kmsg > last_kmsg.log

POST BOTH FILES, LOGCAT AND LAST_KMSG /DMESG, WITHOUT CUTTING PIECES! I need the full files to see if the first init was successful, and be able to debug at least a bit.

EDIT:

*** CAMERA TEST IMAGE ***

Contains kernel, boot image, recovery and system partition.

http://www.mediafire.com/download/od6pu8o11b333gp/wear_511__07_26_2015__camtest_OS.tar

Yes, everything I fix in test kernels, boot images or system partitons and proves to be working, are in all the next builds.