Knives & Forks
WHAT IS IT?
Knives & Forks is a set of Android tools for everyone. Every operating system, every device.
This cross-platform Android toolkit, written in Python, that is designed to work in Linux, Mac OS X or Windows. I wanted to create something that was unique, and offered a consistent and feature-filled set of tools for Android devs no matter what operating system they use, and for as many Android devices as possible.
WHAT DOES IT DO?
I just started work on this project, so it doesn't do very much yet. Right now we are just focusing on getting drivers and adb installed for as many devices as we can on all three platforms. Once we have adb working for everyone, the real fun can begin as we start to add more device tools that will make use of adb, such as rooting. Eventually ROM customization tools will be added, but we are focusing on device tools and cross-platform compatibility at this time.
View the changelog to see a list of included drivers. The only device that I can confirm is compatible with this script in Linux, Mac OS X, and Windows is the Samsung Galaxy S II, Sprint Epic 4G Touch. This just so happens to be my personal phone, but as I gather feedback I will create an official list of supported devices.
WHERE DO I GET IT?
This project is now being hosted by the Android Creative Syndicate. An up to date link to the most current version of the script, installation instructions for Linux, Max OS , and Windows, and other information can be found HERE. Registration is not required at the ACS forum to download or view installation instructions. You are free to reply in the thread you are reading right now if you don't want to register for another forum.
I HAVE IT INSTALLED, NOW WHAT?
You should be able to open up your terminal application (or command prompt) and run some adb commands. In the future we will be automating adb commands for you, but for now you can try the following as a simple test:
Code:
adb reboot
If everything worked, your Android device should reboot. For further reading on what you can do with adb you can read THIS PAGE.
HOW TO SUPPORT THIS PROJECT
FEEDBACK
Download my script, test it, let me know what happens. Let me know what other features/tools I should add.
THANKS
Hit the thanks button if you like what I'm doing here.
DONATIONS - I don't currently have a link to send me money, but I could quickly set something up if somebody decides they want to help me feed my kid. I am recently unemployed, but I am not relying on my scripting skills to feed my family. Save your cash for a more worthy project, or tuck it away and wait until the project turns into something amazing.
INFORMATION
TELL ME ABOUT YOUR ANDROID DEVICES!
If my script isn't getting adb setup for your device, let me know where to download the correct Windows driver and/or what udev rules I need to add in Linux.
The next phase of this project will be automating the rooting process. If you know the process for rooting your device, please share the details.
HOW TO REPLY TO THIS THREAD
Please do not reply by saying something like "This looks awesome, I'm going to download it now!".
Just download it, test it out, and then tell me about it.
If my script works for you, please don't post something like "It worked for me, this is the best thing since sliced bread!".
At the moment all my script will do is install adb and drivers for your device. In order to test please uninstall any drivers you may have already installed, run my script, then reply with the following information:
Operating System (including version and 32-bit or 64-bit architecture)
Android Device
If you open up a terminal/command prompt window and enter the following command, does your device reboot? If not, do you receive any error messages (while running that command or at any phase of running the Kinves & Forks script)?
Code:
adb reboot
CHANGELOG
Code:
------------------------------------------------------------------------------------
Knives & Forks: Changelog
------------------------------------------------------------------------------------
The most current version is available for download from:
http://knivesandforks.info/releases/knives-and-forks-current.php
**** 12.02.04 ****
http://knivesandforks.info/releases/knives-and-forks-12.02.04.php
- LINUX CHANGES:
-- "python2" is now called by "Knives-and-Forks-Linux.sh" instead of "python" on Arch.
- This prevents starting the script with Python 3, which results in errors.
-- Changes to "scripts/linux/install-adb-linux.sh":
- "su" will be used if "sudo" is not installed, or user doesn't have permissions to use it.
- Added 32-bit libs for more 64-bit distros:
- Arch (new in this release)
- CentOS (new in this release)
- Debian
- Fedora (new in this release)
- Ubuntu, Kubuntu, Xubuntu
- Added Debian version of '/etc/udev/rules.d/99-android.rules'
- Added '/lib/udev/rules.d/92-permissions.rules' for Debian.
This should fix permissions, allowing adb to run without sudo or su.
- WINDOWS CHANGES:
-- Fixed a couple of missing quotes which were breaking things under Windows XP
- "%userprofile%" was coming back as "c:\documents" instead of "c:\documents and settings\username" in a couple of places
-- "c:\python27" is now the only directory where we look for python.exe
- It is faster to download and install Python to "c:\Python27" than it is to search for it elsewhere.
- This will also prevent issues where Python 3 was installed instead of Python 2, since the script currently gives errors under Python 3.
-- Updated amd64 and x86 versions of setx.exe for updating system PATH on XP/VISTA/7
-- PATH is updated with adb.exe location after Python is installed.
-- The computer will now reboot after updating the PATH, to make sure it will be updated before running the main program.
**** 12.01.27 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.27.php
- GENERAL CHANGES:
-- After adb is installed, adb will reset the android device by running "adb reboot" instead of displaying a list of attached devices with "adb devices".
adb was occasionally reporting no devices were attached, when they infact were. When this happened "adb reboot" still worked, so it is a better test to see if adb is setup properly.
-- Friendlier messages during adb install and testing
-- Added a startup check to make sure the script is running from the correct directory
-- Removed empty Project directory, as it is not being used yet.
- LINUX CHANGES:
-- Added support for "lxterminal" and "urxvt" in "Knifes-and-Forks-Linux.sh"
-- Changed idVendors for Linux udev rules to lowercase instead of uppercase.
- WINDOWS CHANGES:
-- Startup script searches for python in "C:\Program Files (x86)" then "C:\Program Files" and "c:\" last.
-- Drivers should now install even if the language is not English
-- Added drivers for Casio C771 G'zOne Commando
-- Added LG drivers
-- Replaced setx.exe
**** 12.01.25 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.25.php
- Replaced "Knives-and-Forks-Mac.sh" with "Knives-and-Forks-Mac.app".
Starting the script on a Mac should now be as simple as double-clicking the new .app file.
**** 12.01.24 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.24.php
- Fixed a typo which caused the script to crash when viewing the credits screen.
- Smarter python fix for Windows users.
-- "C:\" and all sub-directories are searched for python.exe.
-- If python is not not found, it will be downloaded from python.org and installed to c:\python27.
-- If python is found (in "C:\python27", "c:\python", "c:\xyz123", "c:\program files\python27" or in any directory with any name anywhere on drive c:) the main menu script will launch.
- Added changelog.txt to the release .zip file.
**** 12.01.23 ****
http://knivesandforks.info/releases/knives-and-forks-12.01.23.php
- Minor update to fix Python installation for Windows users, which was causing the script not to launch.
**** 12.01.22 ****
(FIRST PUBLIC RELEASE)
http://knivesandforks.info/releases/knives-and-forks-12.01.22.php
- Added option to install adb & fastboot for Linux, Windows, Mac
- Added Linux drivers for:
-- ACER
-- ASUS
-- DELL
-- FOXCONN
-- GARMIN-ASUS
-- Google
-- Hisense
-- HTC
-- HUAWEI
-- K-TOUCH
-- KT Tech
-- KYOCERA
-- LENEVO
-- LG
-- MOTOROLA
-- NEC
-- NOOK
-- NVIDIA
-- OTGV
-- PANTECH
-- PEGATRON
-- PHILIPS
-- PMC-SIERRA
-- QUALCOMM
-- SK TELESYS
-- SAMSUNG
-- SHARP
-- SONY ERICSSON
-- TOSHIBA
-- ZTE
- Added Mac drivers for:
-- Nothing. According to Google, "It just works." Let me know if they are right.
- Added a custom Windows installer with drivers for:
-- GOOGLE
-- HTC
-- HUAWEI
-- SAMSUNG
WHERE DID THE OLD POSTS GO?
In an attempt to reduce unnecessary clutter in my original thread, I created supporting threads in each Android device forum. The whole reason behind posting so many times was to keep certain information in the Chef Central post, and certain information out of it in an effort to reduce clutter. Who wants to read through 50 pages of how this, that, and the other thing is or isn't working on devices that you don't own? That system appeared to work very well, but apparently I broke the rules by posting in every Android device forum.
Learn from my mistakes, don't post similarly worded posts all over the place!
ATTENTION PYTHON PROGRAMMERS:
Any idea on what I can do to make the Python files work in Python 2 and Python 3? I have only tested in Python 2.7.2, but I have received reports that Python 3 gives errors. I'm not really doing anything all that fancy, so I'm not sure if something is just a matter or new syntax or something else needs to be imported or what. Any help would be appreciated.
The next release will call "python2" for Arch Linux users since "python" will use python 3.
ATTENTION LINUX USERS:
I am currently testing my Knives & Forks script in some virtual machines using VirtualBox, as well as my local Xubuntu installation.
For distro specific things (installing 32-bit libs, udev changes, etc) in the next release I will be detecting the distro using the following code:
Code:
echo " -- DETECTING LINUX DISTRO --"
if [ "`cat /etc/issue | grep Arch | wc -l`" == "1" ]; then
DISTRO_NAME="Arch"
elif [ "`cat /etc/issue | grep Cent | wc -l`" == "1" ]; then
DISTRO_NAME="CentOS"
elif [ "`cat /etc/issue | grep Debian | wc -l`" == "1" ]; then
DISTRO_NAME="Debian"
elif [ "`cat /etc/issue | grep Fedora | wc -l`" == "1" ]; then
DISTRO_NAME="Fedora"
elif [ "`cat /etc/issue | grep Ubuntu | wc -l`" == "1" ]; then
# DETECTS UBUNTU, KUBUNTU, XUBUNTU, ETC
DISTRO_NAME="Ubuntu"
else
DISTRO_NAME="UNKNOWN"
fi
echo " - $DISTRO_NAME"
Please let me know what other distros your using and if you are able to find the name using the "/etc/issue" method I am using in the above if statements.
I wrote a bash function to check if sudo is installed, and then to see if the current user has permissions to use sudo. If sudo is not installed, or if the current user does not have permission to use it, su will be used instead. This will be included in my next update, but I wanted to post it here first:
Code:
echo " -- CHECKING TO SEE IF 'SUDO' IS INSTALLED --"
CURRENT_USER=$USER
USE_SUDO="NO"
if [ -f "/usr/bin/sudo" ]; then
echo " - 'sudo' is installed."
echo ""
echo " -- CHECKING FOR PERMISSION TO USE 'SUDO' --"
echo ""
echo " If prompted, enter the password for the user '$CURRENT_USER'."
echo ""
if [ "$(sudo whoami)" != "root" ]; then
echo ""
echo " - Sorry, '$CURRENT_USER' does not have permission to use 'sudo'."
echo " - 'su' will be uses instead of 'sudo'."
echo ""
else
echo " - '$CURRENT_USER' has permission to use 'sudo'."
USE_SUDO="YES"
echo ""
fi
else
echo " - 'sudo' is not installed."
echo " - 'su' will be used instead of 'sudo'."
echo ""
fi
DO_SU()
{
echo ""
if [ $USE_SUDO == "YES" ]; then
# echo " -- USING 'SUDO' TO RUN '$1' --"
echo ""
echo " If prompted, enter the password for the user '$CURRENT_USER'."
echo ""
sudo $1
else
# echo " -- USING 'SU' TO RUN '$1' --"
echo ""
echo " If prompted, enter the password for the user 'root'."
echo ""
su -c "$1"
fi
echo ""
}
# EXAMPLE USAGE OF THE DO_SU() FUNCTION:
# NOTE THAT THE COMMAND TO RUN WITH SU OR SUDO HAS TO BE IN QUOTES
DO_SU "whoami"
I also found out why debian users were being forced to use sudo or su in order to use adb. The next release will include this fix, but for those who might be interested in making this change manually:
Open "/lib/udev/rules.d/91-permissions.rules" as root (su or sudo) in your favorite text editor and find this line
Code:
usbfs-like devices SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ MODE=”0664″
Change MODE to "0666"
Code:
usbfs-like devices SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ [B]MODE=”0666“[/B]
Instead of replacing or modifying your "/lib/udev/rules.d/91-permissions.rules" file, the next version of my script will actually create a "/lib/udev/rules.d/92-permissions.rules" for Debian users that contains only the following:
Code:
# usbfs-like devices
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
MODE="0666"
This file will load right after the 91-permissions.rules and replace just the usbfs-like devices settings. I'm just doing this with my script so I don't accidently break anything on your system. If you are making the changes manually, editing the 91-permissions.rules file should be all you need to do.
Save your changes and then restart udev as root (using sudo or su)
Code:
/etc/init.d/udev restart
-- or --
Code:
service udev restart
This assumes of course that you already have a working udev rule for your android device, and that adb is working only with su or sudo currently. Once this change is made you should be able to use adb without being forced to use su or sudo.
First post updated with latest release, version 12.02.04.
Lots of changes for XP and various Linux distros. See changelog for more information, but things should work better in Arch, CentOS, Debian, Fedora, and Ubuntu (including Kubuntu, Xubuntu, etc).
Hi, I just downloaded the latest file (12.02.04) but it's only 4 KB.
Could you check please?
Thank you!
Trying to unzip the file in Ubuntu 11.10 and this what I get:
Archive: knives-and-forks-12.02.04.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of knives-and-forks-12.02.04.zip or
knives-and-forks-12.02.04.zip.zip, and cannot find knives-and-forks-12.02.04.zip.ZIP, period.
Any help?
I had a typo in the .zip filename, so if you tried to download the file yesterday you basically just downloaded an error message that the .php counter script gave when it couldn't find the file. I will have to take a look at that later because it is supposed to display the message not make you download it.
The problem is now fixed, sorry about that.
Thanks for update.
Downloaded and installed.
Now I can adb from linux.
Have one more question. I hope you can help me with that as well.
I don't see my device (E4GT) as external hard drive or USB drive when debuging is on to copy files to it.
When debuging is off it shows 2 Android devices but when I click on them I'm getting this message:
Error initializing camera: -60: Could not lock the device
Any ideas?
My guess is maybe they didn't get unmounted properly that last time you had it plugged in, but I have no idea why you would get an error message about the camera. I have not seen that one.
Try installing Dropbox and backing up anything important, then formatting the sdcard and try mounting again.
Maybe somebody else has had that error and has a better idea,
I'll try to format sd card tonight when I get home.
But what would be the problem with internal storage?
And what should or could I try to proper mount it?
agat63 said:
I'll try to format sd card tonight when I get home.
But what would be the problem with internal storage?
And what should or could I try to proper mount it?
Click to expand...
Click to collapse
First thing to check is that it isn't ROM related. Boot into recovery and try to mount as a usb drive and see if it works or not. If it does, I would say wipe and flash another ROM. If it doesn't work from recovery, then it could be a result of not unmounting before unplugging from your computer.
Sometimes if you have your phone mounted as a USB drive, or even just a regular flash drive, and it you unplug it before it is done unmounting (or if you don't use the safely remove hardward feature of Windows) the filesystem can get trashed. It hasn't happened alot with me, and I have seen the problem happen mostly when a flash drive is unplugged before the OS can finish writing to it.
After you get all of your important stuff backed up somewhere like dropbox, reboot into your recovery and repartition the sd card and/or your internal storage, whatever is giving you the problem. When you reboot into android you should be able to use it as normal, and dropbox should automatically copy everything back that you backed up.
This problem isn't really related to my script, so I if you can't get the issue resolved make a new post in Android QA or somewhere else. PM me if you post elsewhere and I can see if I can help you out there.
I didn't mean to say that the problem is related to your script.
Your script works just fine and I'm able to adb.
I'm kinda new to linux and still learning it.
I needed help and advise for how to connect phone to pc in linux.
It works in windows for me.
When I get on my PC I'm gnats give this awhirl. Ad for your mounting disk drives if ur on any ics rom it wont and I don't know how to enlighten me someone but if its gingerb then make sure u mount with the phones option when u plug in on ur handset ther should be some kind of way to switch between teather, disk and charge only? Wat fone u got?
Does this knife and forks compile? What does it do? Sorry to sound like a knob.
Sent from my GT-I9100 using XDA Premium App
This worked for my att gs2.
Sent from my GT-I9100 using Tapatalk
By using the Android Font you are violating their copyright rules. But you are free to modify the Android Robot, as long as you refer to them and say that you have permission.
Bad-Wolf said:
By using the Android Font you are violating their copyright rules. But you are free to modify the Android Robot, as long as you refer to them and say that you have permission.
Click to expand...
Click to collapse
The post where I found the font said it was an Android logo inspired font, and not the actual android logo font.
I have changed the font I'm using, and have updated my logo graphic to fight off any further concerns.
Colliebudz said:
Does this knife and forks compile? What does it do? Sorry to sound like a knob.
Click to expand...
Click to collapse
At the moment it simply automates getting adb setup on Linux, Mac, and Linux.
I have plans to add support for device rooting next, followed by some other adb commands, then rom customization tools as the last stage of development.
Pushing files to the phone, running shell commands, etc, requires that adb is setup properly, so that is where the focus is at right now. Getting the adb & driver installation scripts setup to run on all three platforms is also helping take care of some general troubleshooting, which is good to get out of the way before the main script gets tons of extra features.
All of this info should be in the first post, I'll try to clarify things when I make the next update.
Waddle said:
This worked for my att gs2.
Sent from my GT-I9100 using Tapatalk
Click to expand...
Click to collapse
Thanks for the feedback. What OS?
Hi guys,
I am looking for some info about how to enable Diag Mode, in order to get to the phone through QPST+QXDM. But until now, I got Nothing...
I read some post, but most of them refer to HTC devices. Does anybody knows if we can get connected to the Sony's Qualcomm Chipset? I am trying to do something similar to what ASCOM TEMS Invertigation kit does, but using Qualcomm environment.
Link Here!
Also this is the info that I have from Sony's Neo V chipset: Link Here!
Thanks!
Bonzi
http://forum.xda-developers.com/showthread.php?t=1248514
Maybe this?
JoHnNy08PL said:
http://forum.xda-developers.com/showthread.php?t=1248514
Maybe this?
Click to expand...
Click to collapse
Good info, but the path that it mentions is not available in my ROM, It also doesn't specify which Rom should we use. (I am using 4.0.4 Pureness)
adb shell, su, echo 1 > /sys/devices/virtual/usb_composite/modem/enable
[email protected]:/ # find / -iname *modem*
/system/usr/share/alsa/pcm/modem.conf
/sys/devices/virtual/android_usb/android0/f_modem >> /device >> Link a > /sys/devices/virtual/android_usb/android0/f_modem/device
/sys/class/android_usb/f_modem
/sys/module/smd_pkt/parameters/modem_wait_timeout
/sys/module/msm_rmnet/parameters/modem_wait
....
# find ./ -iname *enable*
./platform/chargalg/power_supply/chargalg/enable_monitoring_ambient_temp
./virtual/timed_output/vibrator/enable
./virtual/android_usb/android0/enable
....
I found the path in 2.3.4 but when I activated the adb link fails and I have to reboot the phone. Could it be because the BootLoader is Locked?
Any DEv that could help me ?
Also there is a Diag folder on /sys/devices/virtual/usb_composite/ folder. I changed the enable flag to 1 and the phone disconnect the adb session...
Thanks
Bonzi
bonzi22 said:
Good info, but the path that it mentions is not available in my ROM, It also doesn't specify which Rom should we use. (I am using 4.0.4 Pureness)
adb shell, su, echo 1 > /sys/devices/virtual/usb_composite/modem/enable
[email protected]:/ # find / -iname *modem*
/system/usr/share/alsa/pcm/modem.conf
/sys/devices/virtual/android_usb/android0/f_modem >> /device >> Link a > /sys/devices/virtual/android_usb/android0/f_modem/device
/sys/class/android_usb/f_modem
/sys/module/smd_pkt/parameters/modem_wait_timeout
/sys/module/msm_rmnet/parameters/modem_wait
....
# find ./ -iname *enable*
./platform/chargalg/power_supply/chargalg/enable_monitoring_ambient_temp
./virtual/timed_output/vibrator/enable
./virtual/android_usb/android0/enable
....
I found the path in 2.3.4 but when I activated the adb link fails and I have to reboot the phone. Could it be because the BootLoader is Locked?
Any DEv that could help me ?
Also there is a Diag folder on /sys/devices/virtual/usb_composite/ folder. I changed the enable flag to 1 and the phone disconnect the adb session...
Thanks
Bonzi
Click to expand...
Click to collapse
dears please explain about "adb shell, su, echo 1 > /sys/devices/virtual/usb_composite/modem/enable"
because in my case dont work, i have the same problem with you
Me too Suffering
while executing this
[email protected]:/ # find / -iname *modem*
gives
/system/framework/modemwarmup.jar
/sys/kernel/debug/smd/modem_err_f3
/sys/kernel/debug/smd/modem_err
/sys/kernel/debug/modem_notifier
/sys/module/smd_tty/parameters/modem_wait
/sys/module/msm_rmnet/parameters/modem_wait
/sys/fih_sw_info/fih_modem_crash_info
/data/data_test/modem_port_timeout
/data/data_test/modem_port_status
/data/dalvik-cache/[email protected]@[email protected]
/data/mlog/20160530_090325/modem_oemdbg_0_log.txt
/data/mlog/20160530_090325/modem_err_data_index01_log00.txt
/data/mlog/20160629_175250/modem_oemdbg_0_log.txt
/data/mlog/20160629_175250/modem_err_data_index01_log00.txt
/data/mlog/20160718_224803/modem_oemdbg_0_log.txt
/data/mlog/20160718_224803/modem_err_data_index01_log00.txt
/data/mlog/20160528_014415/modem_oemdbg_1_log.txt
/data/mlog/20160528_014415/modem_err_data_index01_log00.txt
/data/mlog/20160814_175808/modem_oemdbg_0_log.txt
/data/mlog/20160814_175808/modem_err_data_index01_log00.txt
/data/mlog/20160522_101125/modem_err_data_index01_log00.txt
/data/mlog/20160523_185156/modem_oemdbg_0_log.txt
/data/mlog/20160523_185156/modem_err_data_index01_log00.txt
and no such path shows in my phone (Sony ST21i, Android 4.0.4, MSM7225AA Chipset)
Well, a week into my Nexus 5 and the dates on backups got to me. "Was that the one before or after I pooched my phone?"
I was doing rough conversions at first, then convinced myself that there was a reasonably fixed offset between "real time" and what TWRP was labeling things. @helicopter88 let me know that there was a missing ability in the chip, so I looked for a run-time solution. Unfortunately, adjtimex wouldn't take a large enough offset.
Since the reasonably useless date stamps on backups were, well, reasonably useless, I did write a little script that converted the dates on the backups to something that matched my local time, given the offset.
Looks like @Dees_Troy has saved me a bunch of coding inside TWRP as there is a going-forward fix in the TWRP sources now. Since he found the magic file where the offset is stored, you don't have to try to "guess" it from looking at your clock and your phone's (though $ date && adb shell date will get you the information you need).
For those backups you already have, here's how you can get the dates and times fixed up on them.
Edit -- Shell scripts made up for on-phone use:
sh birthday.sh while on the phone will give you offset and your phone's birthday (Yes, Korean time, of course!)
Code:
[email protected]:/ # sh /data/media/0/twrp-dates-tool/birthday.sh <
1386550085
Mon Dec 9 09:48:05 KST 2013
sh spew-twrp-rename.sh /path/to/TWRP/BACKUPS will write the commands to move the directories to the terminal (stdout)
The "spew" script finds the offset itself.
It will rewrite both old (20th century) dates and current ones, but only time-shift the older ones.
It will also convert spaces in the file names to underscore characters.
See attached files (.txt added to allow upload)
No, there isn't a "zip" for this -- checking that the right things are being done with your backups before they can't be undone is important
Read on only if you want to do this using perl.
Now, you can adb pull /data/system/time/ to get two files, ats_1 and ats_2 that have the offset in milliseconds as a 64-bit unsigned integer. Pick one or the other, get the human-readable output trim off the last three digits, and there is your offset (within a second). Mine drifts a second each week or so, but hey, this is a lot closer than 1970 something!
Once you have the offset, this script will take a list of files and spit out the commands to rename them, if they match a TWRP-format date in the 1970s. (Edit $offset to match yours.)
Code:
#!/usr/bin/perl
use strict;
use Date::Parse;
use Date::Format;
my $offset = 1386550084; # Edit this to match your offset
my $line;
my ($year,$mo,$day,$h,$m,$s);
my $twrp_time;
my $new_time_string;
my $before;
my $after;
LINE:
while ( defined ( $line = <> ) ) {
chomp $line; chomp $line;
next LINE unless $line =~ m/((197\d)-(\d\d)-(\d\d)--(\d\d)-(\d\d)-(\d\d))/;
$before = $`; $after = $';
$twrp_time = str2time("$2/$3/$4 $5:$6:$7 GMT");
$new_time_string = time2str("%Y-%m-%d_%H%M%S%z", $twrp_time + $offset);
$before =~ s/ /_/g;
$after =~ s/ /_/g;
print "mv '$line' ${before}${new_time_string}${after}\n";
}
Output looks like
Code:
mv '1970-02-22--23-02-13 omni_hammerhead-userdebug 4.4.2 KOT49H 128' 2014-01-30_155017-0800_omni_hammerhead-userdebug_4.4.2_KOT49H_128
mv '1970-02-23--13-50-29 omni_hammerhead-userdebug 4.4.2 KOT49H 128' 2014-01-31_063833-0800_omni_hammerhead-userdebug_4.4.2_KOT49H_128
mv '1970-02-23--15-22-06 omni_hammerhead-userdebug 4.4.2 KOT49H 126' 2014-01-31_081010-0800_omni_hammerhead-userdebug_4.4.2_KOT49H_126
mv '1970-02-23--16-10-01 omni_hammerhead-userdebug 4.4.2 KOT49H 126' 2014-01-31_085805-0800_omni_hammerhead-userdebug_4.4.2_KOT49H_126
mv '1970-02-25--17-11-08 omni_hammerhead-userdebug 4.4.2 KOT49H 127' 2014-02-02_095912-0800_omni_hammerhead-userdebug_4.4.2_KOT49H_127
which you can copy and paste into a shell on your device, or other places you have your TWRP backups backed up.
.
Whoa! Nice one man! A bit of extra work is just fine rather than renaming each of the backups! Thanks a bunch
Sent from my Nexus 5 using Tapatalk
good work bro.
Possible a zip file to flash for this ?
tks
jonata said:
Possible a zip file to flash for this ?
Click to expand...
Click to collapse
Let me look into what options there are in toolbox/busybox for the date parsing. As this was a quick-and-dirty solution, I didn't dive into trying to get it to run on the device.
Umm,, huh?
NEXUS 5
dave2metz said:
Umm,, huh?
Click to expand...
Click to collapse
To be clear, the perl scripts run on something that has perl installed, like your laptop or desktop. The output runs just fine over adb shell to rename files on your phone. It also works just fine to rename the backup copies that you are keeping on your Mac, Linux, FreeBSD box. For Windows without Cygwin or similar, you'd want to change "mv" to "move"
Edit -- shell scripts for on-phone use added to lead post
So open in terminal on phone and run ?
sent from my hammerhead
Yes, or over "adb shell" which makes cut-and-paste a lot easier.
Posted from whatever phone booted today.
Mine has it on the box!
Sent by mobile telephone.
GIT CONFLICT FIXER
I made this little script called Git Conflict Fixer, the name says all I guess. The script does not have a brain that can solve REAL issues in the code, what it does is the following:
- Search in current dir for merge derps inside the files (usually happens after merging a branch or maybe just 1 commit)
- Edits the derped files by the standard procedure:
<<<<<<< HEAD
OLDCONTENT GETS REMOVED
UNTIL THIS LINE
=======
NEW CONTENT WILL BE USED
UNTIL THIS LINE
>>>>>>>
Click to expand...
Click to collapse
- Commits if wanted
In 90% of the cases this easy way is the right way to fix it (luckily). so the 10% that's left is up to yourself to fix
This is not a wonder tool from outer space that will fix all your problems, but it will definitely help you when doing merges. So don't blame me if your code is not working
Github Repository:
https://github.com/broodplank/GitConflictResolver
The main script
Code:
#!/bin/bash
#Auto fix git merge/cherry-pick conflicts in files
#Revision 1
#Startup check
if [[ -e /tmp/conflicts ]]; then
rm -f /tmp/conflicts
fi;
#HEADER
echo "--- GIT Conflict Resolver v1.0"
echo "-- Created by broodplank"
echo "- broodplank.net"
echo
echo "-> Checking for .git folder"
echo -n "Result: "
#Check for .git folder for behavior
if [[ -d ${PWD}/.git ]]; then
echo "found, using git diff"
echo
echo "-> Finding conflicts..."
git diff --name-only --diff-filter=U > /tmp/conflicts
else
echo "not found, using native tools"
echo
echo "-> Finding conflicts..."
grep -l -H -r '<<<<<<< HEAD' ${PWD}/* | awk '!a[$0]++' > /tmp/conflicts
fi;
#Check if conflicts exist
if [[ `cat /tmp/conflicts` != "" ]]; then
echo
echo "-> Conflicts found in files:"
while read F ; do
echo '- '$F
done </tmp/conflicts
else
echo "STOP, No conflicts found!"
exit
fi;
#Start executing standard conflict resolve strategy
echo
echo "-> Fixing conflicts..."
echo
while read G ; do
echo "--> Working on file: $G"
echo "Removing text between HEAD and middle"
sed -i -s '/<<<<<<< HEAD/,/=======/d' $G
echo "Removing conflict footer"
sed -i -s '/>>>>>>>/d' $G
echo
done </tmp/conflicts
#Assume conflicts are actually solved
echo "--> Conflicts have been automatically fixed!"
echo
echo "Please note:"
echo "Although most of the conflicts can be resolved this way, It does not count for all conflicts."
echo "If you experience errors on compiling please review the changes made"
echo
#Stage commit?
if [[ -d ${PWD}/.git ]]; then
echo "Would you like to stage the commit? () [Y/n]"
echo -n ": "
read choice
if [[ $choice != "n" ]]; then
git add .
git commit
fi
fi;
echo
echo "All done!"
Example output:
Merging AOSP master in frameworks/av:
[email protected] ~/repos/platform_frameworks_av $ fixmerge
--- GIT Conflict Resolver v1.0
-- Created by broodplank
- broodplank.net
-> Checking for .git folder
Result: found, using git diff
-> Finding conflicts...
-> Conflicts found in files:
- cmds/screenrecord/screenrecord.cpp
- media/libmedia/AudioTrack.cpp
- media/libmediaplayerservice/Android.mk
- media/libstagefright/AwesomePlayer.cpp
- media/libstagefright/MPEG4Extractor.cpp
- media/libstagefright/TimedEventQueue.cpp
- media/libstagefright/Utils.cpp
- media/libstagefright/httplive/LiveSession.cpp
- media/libstagefright/wifi-display/source/TSPacketizer.cpp
- services/audioflinger/Threads.cpp
-> Fixing conflicts...
--> Working on file: cmds/screenrecord/screenrecord.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libmedia/AudioTrack.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libmediaplayerservice/Android.mk
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libstagefright/AwesomePlayer.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libstagefright/MPEG4Extractor.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libstagefright/TimedEventQueue.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libstagefright/Utils.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libstagefright/httplive/LiveSession.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: media/libstagefright/wifi-display/source/TSPacketizer.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Working on file: services/audioflinger/Threads.cpp
Removing text between HEAD and middle
Removing conflict footer
--> Conflicts have been automatically fixed!
Please note:
Although most of the conflicts can be resolved this way, It does not count for all conflicts.
If you experience errors on compiling please review the changes made
Would you like to stage the commit? () [Y/n]
:
[kk-4.4 6ffce17] Merge remote-tracking branch 'a/master' into kk-4.4
All done!
Click to expand...
Click to collapse
his sir, is there a way to use that tool for kernel instead git?
i mean to merge all from old kernel to new virgen kernel?
desalesouche said:
his sir, is there a way to use that tool for kernel instead git?
i mean to merge all from old kernel to new virgen kernel?
Click to expand...
Click to collapse
Well it just "fixes" all conflict merges that are made by the way git marks it (<<<<<< ,=====, >>>>)
So the title says git but that just means it's only fixes that kind of conflicts. if you merge the old kernel to new kernel (with git I assume, what else, copy paste is not an option). and you remove the .git folder afterwards it will also works, it's just a matter of conflict types.
so basically:
in new kernel folder
Code:
git remote add old https://github.com/desalesouche/yourrepo
git fetch old
git merge old/branchname (now you will get the errors)
fixmerge (choose not to commit it)
Now try to compile the rom, if it works you can commit it, if not you will have to do some fixing yourself, since it just do basic replacing, in 90% of the cases this enough and will fix the problem but it's not guaranteed!
OMG. You offer blind-fix for problems? Good it's not Nuclear plant firmware
Never ever do this if you want quality software. Everything which can be automatically solved is already solved by git. Everything else should be manually examined before commit.
Git is more strict than patch app while cherry-picking, so it may produce such false-conflicts. In this case i suggest to make format-patch and then apply it through patch app. This way is also "automatic" conflict fixer, but in more proper (read: more success chances) way. This will eliminate false-conflicts and will adjust patch lines where possible, although you won't be able to use 3-way mergetool option (which you won't use anyway according to OP).
sorg said:
OMG. You offer blind-fix for problems? Good it's not Nuclear plant firmware
Never ever do this if you want quality software. Everything which can be automatically solved is already solved by git. Everything else should be manually examined before commit.
Git is more strict than patch app while cherry-picking, so it may produce such false-conflicts. In this case i suggest to make format-patch and then apply it through patch app. This way is also "automatic" conflict fixer, but in more proper (read: more success chances) way. This will eliminate false-conflicts and will adjust patch lines where possible, although you won't be able to use 3-way mergetool option (which you won't use anyway according to OP).
Click to expand...
Click to collapse
I do not offer a real fix, just a replacement, the script has no brain as described and only does basic replacement. I know this is not a real problem solver, but when I look at my history of merge conflicts when doing mass merges I can say that 99% of the case it was just the standard replacement procedure that was the solution. Only in some rare cases (in my experience) the default replacement does not fix the code but break it instead.
The actual reason why I post shell scripts in this section, because mostly I've just found out how some function works in shell script (in this case it was reading ranges), and then I write an script that is related to android. I have a lot of little scraps like these floating around on my pc and I usually share them once in a while.
And thanks explanation on the "real" conflict solving way, I will take a look in it sometimes whether it allows automation
--- This is not made by me. This is an repost to XDA. ---
This is 32-bit, so you can use offical TWRP.
Made by hacker12455 and Lukapanio
Bugs:
Camera and minor bugs
Installation:
(Requires ADB + Fastboot, Linux on the PC and Git)
1. Format the data partition with ext4 (Format != Wipe)
2. Download the latest halium-boot.img from https://sourceforge.net/projects/ubports-cedric/files
3. Run
Code:
fastboot flash boot halium-boot.img
4. Download the latest ubports-touch.rootfs-xenial-armhf.tar.gz from https://ci.ubports.com/job/xenial-rootfs-armhf/
5. Download the latest system.img from https://sourceforge.net/projects/ubports-cedric/files
6. Clone https://gitlab.com/JBBgameich/halium-install git repository and go into that folder
7. Run
Code:
./halium-install -v -p ut path/to/ubports-touch.rootfs-xenial-armhf.tar.gz path/to/system.img
8. Reboot your phone.
9. Run
Code:
dmesg -w
and look for an GNU/Linux device.
10. Connect your computer to the RNDIS network that appeared when you rebooted your phone. (If not already happened.)
11. SSH onto the device:
Code:
ssh [email protected]
12. Follow that guide: http://docs.ubports.com/en/latest/porting/running-ut.html
You made it!
Source: https://github.com/ubports-on-cedric
Download: http://ubports-cedric.sf.net
Fail, ignore
Screenshots!
Note: Visual glitch already fixed, old screenshots.
About this device is coming soon.
Nice, i will try it tomorrow
[censored because imei leak, looking for new screenshot]
@nift4 the broken things are fixable?
lucki1000 said:
@nift4 the broken things are fixable?
Click to expand...
Click to collapse
Sound yes
Why authors are redacted?
nift4 said:
Why authors are redacted?
Click to expand...
Click to collapse
Follow the xda rules - telegram is not allowed on xda nor is the promotion of any other social media
XDA is a place for discussion and building of android projects - if everyone went to telegram the forums would be empty
I'd advise you remove all references to telegram
Done
EDIT: I did not want to break the rules I simply did not made it
Ok, I:
- Flashed the boot image from fastboot mode
- Booted into TWRP because the halium-install script tried to use ADB (there's no ADB in fastboot mode!)
- image flashed, i rebooted and the RNDIS appeared with
Code:
sudo dmesg -w
but ssh connection is refused on port 22, and when I connected with telnet the commands from the last guide (had to use the Wayback Machine, since the actual page doesn't exist anymore) but
Code:
/ # cat /var/lib/lxc/android/rootfs/ueventd*.rc|grep ^/dev|sed -e 's/^\/dev\///'|awk '{
printf "ACTION==\"add\", KERNEL==\"%s\", OWNER=\"%s\", GROUP=\"%s\", MODE=\"%s\"\n",$1,
$3,$4,$2}' | sed -e 's/\r//' >/usr/lib/lxc-android-config/70-cedric.rules
cat: can't open '/var/lib/lxc/android/rootfs/ueventd*.rc': No such file or directory
/bin/sh: can't create /usr/lib/lxc-android-config/70-cedric.rules: nonexistent directory
/ #
So, what am I doing wrong? Is there a more recent version?