Hiby R3 Pro Portable Bluetooth DAP
Apr 5, 2023 at 10:03 AM Post #1,966 of 2,094
Hello Hiby friends,

i have the R3 Pro Saber (old) and primary using qobuz. Like many others i don't like newer firmwares with their 50 tracks limit. After many hours and lot of testing, the last version with no 50 track bug is 1.6. So i took the shanling theme tool and compared the firmware for many hours. Working in sysadministration for more than 20 years, so a bit experience and fun included with it. I suspect something: there must be a value, python or javascript, with a track limit, found lots of examples on github and there are not many ways to get qobuz with their api. I also see, that there is already a custom version of 2.2 with the 20000 track limit solved. Conclusion: it is possible to set a higher value for qobuz tracks, i found a lot of differences comparing 1.6 and 2.2, but not this one. Even the changes i made took effect, everything done with shanling tool and notepad++.
Happy modding!
 
Apr 5, 2023 at 11:06 AM Post #1,967 of 2,094
I also see, that there is already a custom version of 2.2 with the 20000 track limit solved
The idea was decompile (e.g. with Ghidra decompiler) /usr/bin/hiby_player application then find limit constant 4e20 hex (20000 dec) that related to specific function (you'll find more than one) and replace it with another constant you want (little-endian byte ordering).
I guess in general Qobuz limit can be found in similar way.
 
Apr 5, 2023 at 11:15 AM Post #1,968 of 2,094
The idea was decompile (e.g. with Ghidra decompiler) /usr/bin/hiby_player application then find limit constant 4e20 hex (20000 dec) that related to specific function (you'll find more than one) and replace it with another constant you want (little-endian byte ordering).
I guess in general Qobuz limit can be found in similar way.
How do you go about mounting the Linux file system? Is there a tutorial for that somewhere? TIA
 
Apr 5, 2023 at 11:39 AM Post #1,969 of 2,094
How do you go about mounting the Linux file system? Is there a tutorial for that somewhere? TIA
Yes, there is tutorial https://github.com/SuperTaiyaki/hiby-firmware-tools/blob/master/unpack.md
and pack/unpack scripts https://github.com/SuperTaiyaki/hiby-firmware-tools
But I prefer ubireader https://github.com/jrspruitt/ubi_reader to extract system.ubi instead of mounting UBI image.

r3pro.upt is ISO file. To extract the content I use command
Code:
7z x r3pro.upt
After unpacking, we have an image of the system partition SYSTEM.UBI, Linux kernel image UIMAGE.BIN (which I don't touch), and service files UPDATE.TXT, VERSION.TXT, _GITIGNO.
If some of the files changed during customization (nobody touches the kernel, therefore we are only talking about SYSTEM.UBI), you need to recalculate and change MD5 for the new SYSTEM.UBI in the UPDATE.TXT file. You can edit the file manually or with the command
Code:
sed -i '7,$s/md5=.*/md5='"$(md5sum unpacked_fw/SYSTEM.UBI | cut -d\ -f1)/" unpacked_fw/UPDATE.TXT
You can pack back into r3pro.upt using mkisofs or genisoimage :
Code:
genisoimage -l -o r3pro.upt unpacked_fw/{SYSTEM.UBI,UIMAGE.BIN,UPDATE.TXT,VERSION.TXT,_GITIGNO}
Unpacking the SYSTEM.UBI image in Linux
Code:
sudo ubireader_extract_files SYSTEM.UBI -o SYSTEM -k
Packing SYSTEM directory to SYSTEM.UBI image in Linux
Code:
mkfs.ubifs -x lzo -d SYSTEM -e 0x1F000 -c 480 -m 0x800 -o SYSTEM.UBI
"Theme editor" for Windows contains standalone assemblies ubireader_extract_files and mkfs.ubifs
I usually compare the contents of the system folders (file differences) of different firmware in the WinMerge program.

There is also python tool by snoopy112 https://github.com/snoopy112/FW-tool It can pack/unpack firmware, optimize png theme's files and strip binaries.
 
Last edited:
Apr 5, 2023 at 12:02 PM Post #1,970 of 2,094
Yes, there is tutorial https://github.com/SuperTaiyaki/hiby-firmware-tools/blob/master/unpack.md
and pack/unpack scripts https://github.com/SuperTaiyaki/hiby-firmware-tools
But I prefer ubireader https://github.com/jrspruitt/ubi_reader to extract system.ubi instead of mounting UBI image.

r3pro.upt is ISO file. To extract the content I use command
Code:
7z x r3pro.upt
After unpacking, we have an image of the system partition SYSTEM.UBI, Linux kernel image UIMAGE.BIN (which I don't touch), and service files UPDATE.TXT, VERSION.TXT, _GITIGNO.
If some of the files changed during customization (nobody touches the kernel, therefore we are only talking about SYSTEM.UBI), you need to recalculate and change MD5 for the new SYSTEM.UBI in the UPDATE.TXT file. You can edit the file manually or with the command
Code:
sed -i '7,$s/md5=.*/md5='"$(md5sum unpacked_fw/SYSTEM.UBI | cut -d\ -f1)/" unpacked_fw/UPDATE.TXT
You can pack back into r3pro.upt using mkisofs or genisoimage :
Code:
genisoimage -l -o r3pro.upt unpacked_fw/{SYSTEM.UBI,UIMAGE.BIN,UPDATE.TXT,VERSION.TXT,_GITIGNO}
Unpacking the SYSTEM.UBI image in Linux
Code:
sudo ubireader_extract_files SYSTEM.UBI -o SYSTEM -k
Packing SYSTEM directory to SYSTEM.UBI image in Linux
Code:
mkfs.ubifs -x lzo -d SYSTEM -e 0x1F000 -c 480 -m 0x800 -o SYSTEM.UBI
"Theme editor" for Windows contains standalone assemblies ubireader_extract_files and mkfs.ubifs
I usually compare the contents of the system folders (file differences) of different firmware in the WinMerge program.

There is also python tool by snoopy112 https://github.com/snoopy112/FW-tool It can pack/unpack firmware, optimize png theme's files and strip binaries.

That answers the question in freaking awesome detail! Thanks again.
 
Apr 5, 2023 at 12:31 PM Post #1,971 of 2,094
Note: to flash new firmware there is two ways - from working player in Settings menu or from powered off state.
The second way is:
- place new firmware to root of microSD card as r3pro.upt
- turn off the player
- press and hold together two buttons "Volume Up" and "Power" for about 3 sec

You don't need to repack the firmware every time to apply change in single file. There is the way to use adb to transfer files.
But adb service is disabled in released firmwares by default. To use it you need to repack firmware.
The modification is just rename file /etc/init.d/K90adb to /etc/init.d/S90adb then repack system.ubi , pack new r3pro.upt and flash modded firmware.
To turn on adb you need go to Settings - USB mode - Dock
Then you can use "adb shell" command from your PC.
 
Last edited:
Apr 5, 2023 at 2:04 PM Post #1,972 of 2,094
i have the R3 Pro Saber (old) and primary using qobuz. Like many others i don't like newer firmwares with their 50 tracks limit. After many hours and lot of testing, the last version with no 50 track bug is 1.6.
Can you explain in details what limit are you mean? Is it playlist related? I don't see that limit in playlists.
 
Apr 5, 2023 at 2:12 PM Post #1,973 of 2,094
Can you explain in details what limit are you mean? Is it playlist related? I don't see that limit in playlists.
For me is in my qobuz own playlists, the ones I make, if o do a playlist with 70 tracks for example, when I loaded my playlist it only shows the first added 50 tracks, also my favorite albums max out at 150 so only shows my latest added 150 albums, this limit I think also apply for favorite tracks but i didn't test it yet. It's wierd cuz in the discovery page o can load curated playlist whit more than 50 tracks without a problem
 
Apr 5, 2023 at 2:46 PM Post #1,974 of 2,094
For me is in my qobuz own playlists, the ones I make, if o do a playlist with 70 tracks for example, when I loaded my playlist it only shows the first added 50 tracks, also my favorite albums max out at 150 so only shows my latest added 150 albums, this limit I think also apply for favorite tracks but i didn't test it yet. It's wierd cuz in the discovery page o can load curated playlist whit more than 50 tracks without a problem
Hmm. I've just found something related to 150 and 75 in context of Qobuz lists in pseudocode magic. But don't see anything related to 50.
 
Apr 7, 2023 at 3:03 PM Post #1,977 of 2,094
Where have you found these values? I'm checking this now for about 30 hours, getting more knowledge of the whole system, but this 50 track bug is frustrating...
Maybe 50 is on hexadecimal In the code as 32.and only under favorites playlists inside a playlist directory. I didn't saw the code yet I'm just speculating.
 
Apr 7, 2023 at 3:10 PM Post #1,978 of 2,094
Maybe 50 is on hexadecimal In the code as 32.and only under favorites playlists inside a playlist directory. I didn't saw the code yet I'm just speculating.
That's where i'm looking for. Like losber said he found the 20000 limit as 4e20 in hex. But now i have 617 lines of code to check. It is not easy, but human readable text, sure that we soon have our perfect firmware, spending my whole time now for it, but it is fun and i want it :wink:
 
Apr 7, 2023 at 3:14 PM Post #1,979 of 2,094
Maybe 50 is on hexadecimal In the code as 32.and only under favorites playlists inside a playlist directory. I didn't saw the code yet I'm just speculating.
btw, can you confirm that the 50 track limit first appears in 1.7 and above? Thats why i am still on 1.6, even i see some advantages in 2.2 and want to fix it by that reason.
 

Users who are viewing this thread

  • Back
    Top