yashsingh1/xdaforums huggingface dataset:
[Galaxy Note 4 General] gekkehenkie11:
I tried but I might have missed some stuff, it seems not all RIL libs have RIL in their names. I'm really starting to think it must be this because:

1) Original 910F ROM (telephony) works with original 910T boot.img, indicating the kernel and ramdisk don't even matter, ril works either way

2) We have a zip that supposedly can convert a 910T rom into a 910F rom, it contains only files for the system image, no kernel image stuff.

Anyway I'm currently recompiling the original samsung kernel. I already tried it, I replaced original samsung rom with my cooked up kernel and everything worked fine. However I forgot to run the makefiles again after modding config things, so I still had a small dmesg buffer. BTW, I suggest all you devs out here change that too, change CONFIG_LOG_BUF_SHIFT=18 into CONFIG_LOG_BUF_SHIFT=21 and you will have 1 mb dmesg buffer size. With 128 kb you can't even see the first boot messages. And if you add some messages yourself, that 1mb comes in very handy.

So I'm now recompiling with that setting and I've added "dump_stack()" to the platform_device_register function, hopefully that will explain when & where the mhi device is registered !
[Galaxy Note 4 General] Beukhof1:
Again great work! So in normal people language ;) how close are you to a working RIL?

And can/will you use the new fixes from the T-Mobile version?
[Galaxy Note 4 General] allenjthomsen:
Have you tried replacing lib.connectivity-manager

---------- Post added at 06:48 AM ---------- Previous post was at 06:36 AM ----------

[MENTION=3296134]gekkehenkie11[/MENTION]

https://mega.co.nz/#!KIE2VaKB!rtQq6jYBzejWd4xUUfJv0kr9cNgqUNH7Q0nT2CP5Iiw

This zip contains n910t files related to signal and data if you pull same files from n910f rom and make a flashable zip for after cm12 flashing it should if im correct let you have data
[Galaxy Note 4 General] gekkehenkie11:
How are you sure that's all there is ?
[Galaxy Note 4 General] gekkehenkie11:
Really don't know. It's still guessing as to what the exact problems is at the moment ...
[Galaxy Note 4 General] allenjthomsen:
Because i made a flashable and tested on your cm12 rom the libs i posted and got signal and data

So if im right and you pull same libs from n910f rom you should be able to get signal and data

---------- Post added at 06:54 AM ---------- Previous post was at 06:53 AM ----------

If im wrong then its back to the drawing board until i figure it out or you do

---------- Post added at 06:54 AM ---------- Previous post was at 06:54 AM ----------

I can tell you right now its not your kernel its lib related
[Galaxy Note 4 General] gekkehenkie11:
Again, what [MENTION=3041959]fattire[/MENTION] explained: what you did is take my ROM, that was based on the 910T rom in the first place and then change some files back into 910F. So you went the route 910T->910F->910T. The files that are problematic, werent correctly changed in that 910T->910F conversion (at least that seems likely at this point) so it are by definition NOT the files you need to get 910T into 910F again.
[Galaxy Note 4 General] allenjthomsen:
In all honesty i think what needs to happen is you need to adb pull files from device so you can build from cm source and setup a device tree based off N910F that way it will compile it as n910f instead

And im willing to bet [MENTION=2457777]slayher[/MENTION] or [MENTION=3041959]fattire[/MENTION] can help you do so
[Galaxy Note 4 General] gekkehenkie11:
That's already happening of course. Kernel is replaced and a script pulls all blobs (=samsung propiatery files) from the current ROM and uses them when making the 910F Rom. But I suspect that one or more files do not get pulled and 910T version is used. However at this moment it's just a guess, it might as well be something else... Hopefully I will learn more in a bit when I have my samsung kernel up with stack dumps.
[Galaxy Note 4 General] allenjthomsen:
It just occureed to me it could be build.prop related also because on stock i had to edit build.prop when i flashed international roms to my n910T
[Galaxy Note 4 General] vogli:
[MENTION=3198335]allenjthomsen[/MENTION] do you have the mhi devices in your cm12 on 910T?
[Galaxy Note 4 General] gekkehenkie11:
great question ! Run:

ls /sys/bus/platform/devices/m*

From within your adb shell and see what it says on 910T CM12 please !
[Galaxy Note 4 General] allenjthomsen:
This is what i get
[Galaxy Note 4 General] allenjthomsen:
My cm12 is under ~/android/system just for refrence
[Galaxy Note 4 General] allenjthomsen:
Just to show you thats where its at look at kernel
[Galaxy Note 4 General] gekkehenkie11:
You need to run it from within your adb shell. If you don't have adb installed, this is how to install it:

http://xdaforums.com/showpost.php?p=57087225&postcount=52

Then start it with a dos command prompt: adb shell

Or alternatively, Cm12 (or the gapps) installs a terminal prompt app too, it's called 'terminal emulator', it shows a terminal prompt as a icon. Then just start the app and enter that command from there:

ls /sys/bus/platform/devices/m*
[Galaxy Note 4 General] allenjthomsen:
One moment while i flash my cm12 back to my device
[Galaxy Note 4 General] gekkehenkie11:
cool. It would be best though if you'd have ADB installed, cause you could also get us that logcat radio, that would also help a lot, to have that from CM12 910T !!!

You can get that with dos prompt command:

adb logcat -v time -b radio -d >radio.txt

(so run that from your dos prompt, after you have installed ADB and after you have enabled USB debuggin, all explained in that link I just posted). And then just post the output file 'radio.txt' that it will generate
[Galaxy Note 4 General] allenjthomsen:
This is the

ls /sys/bus/platform/devices/m*
[Galaxy Note 4 General] gekkehenkie11:
Thanks man !! So, no mhi devices present. Yeah that makes sense, since mhi.ko is not being used according to Slayher. But it also makes NO sense at the same time, cause how the hell can telephony work without mhi.ko then ?

I really hope you can get us that logcat, that would help SO much !! IF you need help just let me know.
[Galaxy Note 4 General] allenjthomsen:
here is that file
[Galaxy Note 4 General] gekkehenkie11:
cool !! That's indeed exactly what we need !! One problem though and that's that it's missing the first part of boot. Could you get me this same file, but then after a reboot as soon as possible, so as soon as the device is up and recognized by windows ? Thanks !!
[Galaxy Note 4 General] allenjthomsen:
here you go from boot
[Galaxy Note 4 General] gekkehenkie11:
Thanks ! But I see something that makes me think this is actually Touchwiz, so just to be 100% sure: this is cm12 running ?
[Galaxy Note 4 General] allenjthomsen:
Proof its cm
[Galaxy Note 4 General] vogli:
Can you also check if the mhi files are also not existent on Stock? Maybe this is something where the 2 devices differ.
[Galaxy Note 4 General] allenjthomsen:
So you want me to restore a stock rom
[Galaxy Note 4 General] gekkehenkie11:
Thanks mate !! So this is very interesting, it's actually doing stuff I only thought to be possible with mhi_pipes up, but obviously that's not the case, although, could you do one last test then, run either from within the emulator or adb shell:

ls /dev/m*

(cm12 again)
[Galaxy Note 4 General] allenjthomsen:
Here is ls /dev/m*
[Galaxy Note 4 General] vogli:
Could you restore stock and run the same commands there? That way we would know if these pipes are device specific or not.
[Galaxy Note 4 General] allenjthomsen:
OK give me a minute
[Galaxy Note 4 General] gekkehenkie11:
Thanks ! THat indeed confirms there are no mhi_pipes up. Very very interesting all this, this is helping a lot. I gotta go now though, be back in 2 hours, going to dive into all this. Again this is really helpful, thanks a lot man !
[Galaxy Note 4 General] allenjthomsen:
There are the 2 ls files
[Galaxy Note 4 General] allenjthomsen:
Those are from stock
[Galaxy Note 4 General] gekkehenkie11:
That's very interesting again ! So stock 910t doesn't even use mhi pipes. That's starting to make sense and explains the difference. One thing could you post your /system/bin/qmuxd file ? From either stock or cm12
[Galaxy Note 4 General] Preaper:
downloaded the N910T firmware (N910TUVU1ANK4) so I could analyse the difference. There is no libdetectmodem.so file on there. Weird?!

To find out if libmdmdetect.so is a suitable replacement I dumped the available symbols:

nm -D vendor/samsung/trlte/proprietary/lib/libmdmdetect.so
U __aeabi_unwind_cpp_pr0
U __aeabi_unwind_cpp_pr1
U __android_log_print
00003014 A __bss_start
U __cxa_atexit
U __cxa_finalize
U __errno
U __stack_chk_fail
U __stack_chk_guard
U __strlen_chk
00003014 A _edata
00003014 A _end
U close
U closedir
00000d19 T esoc_framework_supported
00000cad T esoc_supported
U free
00000d49 T get_esoc_details
00000f59 T get_peripheral_state
00000a2d T get_soc_link
00000935 T get_soc_name
00000ba1 T get_soc_port
00000b25 T get_soc_ramdump_path
00000e61 T get_system_info
U malloc
U memset
U open
U opendir
U read
U readdir
U snprintf
U stat
U strerror
U strlcpy
U strlen
U strncmp
00003004 D supported_modems

various required function such as count_modems and open_first_external_modem are not there.

So my question is: is libmdmdetect.so really a suitable replacement?
[Galaxy Note 4 General] allenjthomsen:
heres qmuxd
[Galaxy Note 4 General] gekkehenkie11:
Thanks again ! I will analyse it when I am at home I expect it to be different from 910f using an alternative method to communicate with the modem . Thanks mate all this has been revealing a lot ! Maybe it's as simple as using qmuxd from 910t although I expect that's way too optimistic. So we know at least now that 910f and 910t use different mechanisms to communicate with modem. And preaper als nice find man !
[Galaxy Note 4 General] Preaper:
Just did a bruto force search. Ran "nm -D" for every file on the N910F firmware and did a grep for count_modem . No results.

What I still don't understand is that on the firmware for the N910T I downloaded there is no libdetectmodem.so . Guys, what is up with that? Can somebody upload a copy?
[Galaxy Note 4 General] allenjthomsen:
There is no lib.detectmodem.so on n910t even on stock ive checked
[Galaxy Note 4 General] gekkehenkie11:
So resuming what we know now : stock 910f firmware uses mhi pipes to communicate with modem. Both stock 910t and cm12 do not. So it would make a lot of sense that we need to get those mhi pipes up on cm12 in order to get it to work. Unless the method that 910t is using also possibly works for 910f. Will look into that when I'm at home.currently our qmuxd expects those piped but maybe there is an alternative method ....
[Galaxy Note 4 General] gekkehenkie11:
[MENTION=346046]Preaper[/MENTION] How do you extract files from the roms system.img ? I tried some tools, none worked
[Galaxy Note 4 General] allenjthomsen:
Use ext4 app

http://xdaforums.com/showthread.php?t=1921399

---------- Post added at 10:03 AM ---------- Previous post was at 10:00 AM ----------

Or this thread they always worked for me

http://xdaforums.com/showthread.php?t=2285831
[Galaxy Note 4 General] Preaper:
I work with linux, so have a lot of tools availible. I used the simg2img from the android-tools-fsutils package to convert the image to a mountable file.

sudo apt-get install android-tools-fsutils
simg2img system.img.ext4 system.img.ext4.raw
mount -t ext4 -o loop system.img.ext3.raw /your-favorite-mount-point
[Galaxy Note 4 General] allenjthomsen:
He didnt specify so my bad for not knowing
[Galaxy Note 4 General] Preaper:
I have no idea how to unpack the system.new.dat inside [MENTION=2457777]slayher[/MENTION] his rom ZIP file. If somebody can shed some light on that?

$ sudo mount -t ext4 -o loop system.new.dat /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/loop2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

$ dmesg | tail
[693300.587081] EXT4-fs (loop2): mounted filesystem with ordered data mode. Opts: (null)
[699139.704652] EXT4-fs (loop2): mounted filesystem with ordered data mode. Opts: (null)
[699217.390274] EXT4-fs (loop3): mounted filesystem with ordered data mode. Opts: (null)
[699917.079450] EXT4-fs (loop4): mounted filesystem with ordered data mode. Opts: (null)
[704066.843728] EXT4-fs (loop2): mounted filesystem with ordered data mode. Opts: (null)
[705111.800925] EXT4-fs (loop2): mounted filesystem with ordered data mode. Opts: (null)
[707575.740673] EXT4-fs (loop2): mounted filesystem with ordered data mode. Opts: (null)
[710477.903004] EXT4-fs (loop2): bad geometry: block count 972800 exceeds size of device (126119 blocks)
[710699.037384] EXT4-fs (loop2): bad geometry: block count 972800 exceeds size of device (126119 blocks)
[711236.884215] EXT4-fs (loop2): bad geometry: block count 972800 exceeds size of device (126119 blocks)

Also simg2img doesn't know the file type. Google just gives me loads of other people trying to unpack the damn thing but not knowing how.
[Galaxy Note 4 General] gekkehenkie11:
So I just checked, it's the exact same file as our 910F version. So qmuxd uses mhi_pipes on 910F and selects to some other different method on 910T. I think we should just focus on getting mhi_pipes up, since that's how it's working on 910F stock ROM and there's a very good chance that the 910T way doesn't even work on 910F. Not sure why though I was under the impression it's the same hardware but who knows, it might slightly be different or maybe other modem firmware.

Anyway, so I'm going to continue looking into getting that mhi device up. I can now modify stock kernel and I just checked, I can now indeed dump stacks etc from stock kernel so I can hopefully find out how stock kernel enables that mhi device.
[Galaxy Note 4 General] Preaper:
That just doesn't make any sense. Either I'm pretty clueless here, or Slayer his source can never build on any device, period. [MENTION=3041959]fattire[/MENTION], can you shed some light on this? How is it possible libdetectmodem.so doesn't exist on the N910T, but it is required for a successful build of slayer his port?

Make: *** No rule to make target `vendor/samsung/trlte-common/proprietary/lib/libdetectmodem.so', needed by `/home/cmbuild/android/out/target/product/trltetmo/system/lib/libdetectmodem.so'. Stop.
make: *** Waiting for unfinished jobs....
[Galaxy Note 4 General] gekkehenkie11:
BTW, this sums it up. Our firmware does this:

01-01 04:04:26.579 E/RIL-QMI ( 435): qmuxd: opening connection for RMNET57 [MHICTL0]

and 910T firmware does this:

02-14 21:22:24.050 E/RIL-QMI ( 308): qmuxd: opening connection for RMNET29 [MDM_DATA1_CNTL]

so ours uses mhi ctl and 910T uses a mdm_data ctl.
[Galaxy Note 4 General] gekkehenkie11:
And also just confirmed from stock dmesg dump: mhi indeed succesfully executes the 'probe' part of the driver. That's the part that's never getting executed in on our CM12 build. And that's the part again that's getting executed when the kernel can match driver and device and that's again not happening cause the MHI device simply is not registered. So, basically everything I found out in the past few days was correct :) Now we need to find out how to register the mhi device :) Going to try to find out how stock does that ...
[Galaxy Note 4 General] vogli:
Did you do a different between the kernel source from Samsung for 910F and 910T? I still think this is ftb related. If you look at the dts files then they do mention mhi in them.
[Galaxy Note 4 General] gekkehenkie11:
no, haven't compared kernel sources, that's also an interesting venue to explore. Currently I'm going to mess around with stock ROM and see if I can find out how it registers the mhi device.

*EDIT* btw I actually DID compare kernel sources, need to look at that again ...

Also I compared DTB files in the ramdisks between 910T and 910F and 910F CM12, they're pretty much the same, only the header of the DTB files are slightly different, but it are only 1 bytes and then some leading 0's that are different, so I doubt the device registering is dtb related. I agree it would make sense that it was DTB, but if that was the case, I guess the DTB files would need to show way more difference

What do you mean with ftb ?
[Galaxy Note 4 General] gekkehenkie11:
So I can already confirm that the mhi device is NOT being registered via "platform_device_register" on stock firmware, so it must be another way. I outputted devices that are being registered that way and the mhi device is not among them. It seems only a subset of devices is being registered this way. Going to see if I can find out which alternate ways there are for a platform to register devices.

*EDIT* "Platform drivers follow the standard driver model convention, where discovery/enumeration is handled outside the drivers" from: https://www.kernel.org/doc/Documentation/driver-model/platform.txt

So it's indeed also not happening from within the driver itself ...
[Galaxy Note 4 General] gekkehenkie11:
Got it ! It's being registered via "platform_device_add". Now going to add a stack dump into that function and let's pray that's going to tell us what lib we need :)

*EDIT Hmm no although this routine uses it, it's actually not what we're looking for it seems, damn ... Going to search now ..
[Galaxy Note 4 General] Preaper:
Nice detective work. So basically you've compiled the Samsung kernel from source and added some statements to dump more to the log in order for you to reverse engineer the device loading procedure?
[Galaxy Note 4 General] gekkehenkie11:
Yes exactly :) But it's still not the function I'm looking for, going to investigate, I already found some other candidates ...

*EDIT* The function I just found shows this stack dump:

4>[ 9.524964] [<c010ca7c>] (unwind_backtrace+0x0/0x11c) from [<c0109e58>] (show_stack+0x10/0x14)
<4>[ 9.524977] [<c0109e58>] (show_stack+0x10/0x14) from [<c0513244>] (platform_device_add+0x38/0x214)
<4>[ 9.525007] [<c0513244>] (platform_device_add+0x38/0x214) from [<bf004c30>] (probe_clients+0xbc/0x148 [mhi])
<4>[ 9.525026] [<bf004c30>] (probe_clients+0xbc/0x148 [mhi]) from [<bf004b8c>] (probe_clients+0x18/0x148 [mhi])
<4>[ 9.525048] [<bf004b8c>] (probe_clients+0x18/0x148 [mhi]) from [<bf0103a4>] (process_AMSS_transition+0x350/0x51c [mhi])
<4>[ 9.525071] [<bf0103a4>] (process_AMSS_transition+0x350/0x51c [mhi]) from [<bf011a54>] (mhi_state_change_thread+0x27c/0x2cc [mhi])
<4>[ 9.525090] [<bf011a54>] (mhi_state_change_thread+0x27c/0x2cc [mhi]) from [<c0190b90>] (kthread+0xa0/0xb0)
<4>[ 9.525100] [<c0190b90>] (kthread+0xa0/0xb0) from [<c0106258>] (ret_from_fork+0x14/0x3c)

As you can see, this is getting called from the actual probe function, so this happens AFTER the device is registered. And I'm just checking the log, that's indeed correct. So I need to find which function it calls before this, to register it ...
[Galaxy Note 4 General] Preaper:
If I grep the CM kernel source for probe_clients I come up blank. Is there another naming convention in the backtrace then used in the source files?

Downloading the N910F and N910T sourcecode from opensource.samsung.com. Should have done that much earlier.
[Galaxy Note 4 General] vogli:
ftb was just a typo. It was supposed to be dtb.
[Galaxy Note 4 General] gekkehenkie11:
Damn I tried every function in platform.c that looks like it could register platform devices, but didn't find the one that starts the mhi_uci device...

However I was comparing dmesg logs again between stock and CM12 and I think I have a new lead ... Both versions do this:

<4>[ 7.834698] [ALOG] 1 supported modem(s) found
<4>[ 7.834752] [ALOG] Setting up mdm helper device structure
<4>[ 7.834940] [ALOG] Found private data for MDM9x35
<4>[ 7.834981] [ALOG] ESOC Details:
<4>[ 7.834981]	Name:MDM9x35
<4>[ 7.834981]	Port:/dev/esoc-0
<4>[ 7.834981]	Link:HSIC
<4>[ 7.835019] [ALOG] Device configuration loaded
<4>[ 7.835062] [ALOG] Starting MDM helper
<4>[ 7.835120] [ALOG] Creating thread for MDM9x35

However stock then continues like:

<4>[ 4.169481] [ALOG] Starting MDM9x35

While CM12 never does that .. So it looks like it's not even starting up the modem ! Going to investigate this ...

*EDIT* the above takes place in file /bin/mdm_helper, sounds like 'modem_helper' ;) It's a blob, going to reverse engineer it and see what's going on :)

*EDIT2* if "persist.mdm_boot_debug" is set to 1 in your prop file, then it should yield debug output, going to try that now.

*EDIT3* hmm debug mode didnt function just yet, can look into that later. But quickly saw in the mdmhelper a ref to file 'acdb.mbn' ! And this file is actually one of the few difference in the ini files between 910T and 910F like I described here: http://xdaforums.com/showpost.php?p=57483382&postcount=604 so I'm guessing this is actually something we need. Going to research more ...

*EDIT4* [MENTION=263774]Reaper[/MENTION], you'll like this: one of the import libs to this file is 'libmdmdetect.so' ;) The plot thickens ...
[Galaxy Note 4 General] Preaper:
Yeah, I still don't like the fact that we skipped over the libdetectmodem.so dependency by substituting it with a clearly different file.. Something just doesn't add up. How can Slayher his source depend on this file without us having it?

I tried downloading the nexus (Shamu) ROM, because I know the binary is available there. But I can't open the system.new.dat file to extract it.

Anyway, I also discovered that system/lib/libcordon.so calls mdm_helper . Not sure what this tells us though.

---------- Post added at 11:06 PM ---------- Previous post was at 11:03 PM ----------

The amount of propriety software in this so called open source Android machine is mind boggling.
[Galaxy Note 4 General] vogli:
I read somewhere that libdetectmodem is very simple and only exposes one function. Maybe it should just be copied from the 910T. I guess they got it from the Shamu sources as well. Renaming it was wrong as I think that both devices do have libmdmdetect.
[Galaxy Note 4 General] Preaper:
Two functions. count_modems and open_first_external_modem

The later seems rather important :)

It must have come from the Shamu source - but I can't find it.

According to allenjthomsen the file doesn't exist on the N910T. Not on CM and not on stock. It's not in stock for sure, since I looked in the N910T rom. I hope he's wrong about the CM ROM. :)
[Galaxy Note 4 General] gekkehenkie11:
Guys I'm sure we should forget about the 910T version. mdm_helper loads up the 910F version "libmdmdetect.so" in stock, so it should just do that in 910F too.

I just found in mdm_helper a part that either starts the modem thread (like it does on stock), or enters an infinite waiting loop... Now need to find out what determines the difference between those two :)
[Galaxy Note 4 General] Preaper:
Downloading factory shamu image from https://developers.google.com/android/nexus/images#shamu .. Maybe...

---------- Post added at 11:24 PM ---------- Previous post was at 11:21 PM ----------

Not sure what you mean. What should we forget about the N910T?
[Galaxy Note 4 General] gekkehenkie11:
The 'libmodemdetect.so'. We shouldn't use it, I'm pretty sure of it. It doesn't even exist on stock
[Galaxy Note 4 General] Preaper:
The dependency on that library is pretty much hardcoded in the board logic we're using (which I guess comes from the shamu implementation)
[Galaxy Note 4 General] vogli:
There is 2 places in the code where is being referenced in Makefiles. Therefore I would just take the file from slayers report and leave libmdmdetect as it is.
[Galaxy Note 4 General] Preaper:
Got him!

$ nm -D lib/libdetectmodem.so
U __aeabi_unwind_cpp_pr1
U __android_log_print
00002004 A __bss_start
000004e1 T count_modems
U __cxa_atexit
U __cxa_finalize
00002004 A _edata
00002004 A _end
U __errno
U get_system_info
U memset
U open
0000052d T open_first_external_modem
U strerror
[Galaxy Note 4 General] Preaper:
Straight from the official Google Shamu ROM
[Galaxy Note 4 General] gekkehenkie11:
Ah ok I see what you guys mean now ...