I am trying to display opencore logs. I have already tried the ff. but still logs are not showing in the logcat.
1. created pvlogger.txt in sdcard and still no use.
# echo 8 > /sdcard/pvlogger.txt
2. Edited the PV_LOG_INST_LEVEL from 0 to 5 in the pvlogger.h file but it causes the compilation to fail.
"/android_log_appender.h:75: error:" format not a string literal and no format argument"
So I have just commented out Line 75, although it compiled successfully, opencore logs are still not showing in the logcat.
Is there anyone who were able to display the opencore logs?
Thanks in advance.
artsylar
I had this issue three months ago. Please don't comment out LOGE(stringbuf) in /android_log_appender.h, otherwise there is no log out.
LOGE("%s", stringbuf) instead of LOGE(stringbuf).
1. created pvlogger.txt in sdcard and still no use.
`# echo 8 > /sdcard/pvlogger.txt`
2. Edited the PV_LOG_INST_LEVEL from 0 to 5 in the pvlogger.h.
3. ENABLE_PV_LOGGING from 0 to 1 in the pvlogger.h.
4. LOGE("%s", stringbuf) instead of LOGE(stringbuf) in /android_log_appender.h.
Wish you success!
After trial and errors, I was finally able to show the OpenCore log messages! Here's what I did although I do not know yet if steps 4 and make options are needed.
Added #define PV_LOG_INST_LEVEL 5 to \android\external\opencore\android\thread_init.cpp file.
To solve the "/android_log_appender.h:75: error:" format not a string literal and no format argument" error, just edit \external\opencore\android\android_log_appender.h line 75 from LOGE(stringbuf) to LOGE("%s", stringbuf)
compile the code.
make ENABLE_PV_LOGGING=1
create pvlogger.txt in sdcard.
# echo 8 > /sdcard/pvlogger.txt
Related
I'm studying the android kernel as a beginner. I can read the messages thrown from the macro ERROR() inside the function main() at system/core/init/init.c using dmesg command through adb. I observed that after calling the function open_devnull_stdio() inside main(), dmesg no longer displays the messages thrown by ERROR().
To find the reason, I started digging into the declaration of open_devnull_stdio() inside system/core/init/util.c and I found this line I can't understand
static const char *name = "/dev/__null__";
Actually there was no file named __null__ inside /dev/ in the device, but there was a file named null and I was able to grab it using adb pull and it was a 0 byte (empty) file.
So why is a file name wrapped with double underscore (__) ?
Here is the link for the util.c
There is no special purpose of using double underscore before the start, after the end or both in C. From the point of view of C the file name is just a string, the operating system is free to interpret in whatever way it chooses. From the point of view of Linux, the same applies. Underscores in file names are just characters. They are not treated differently from the letters b and t.
If I guessed right and I'm reading the same file as you (it might be a good idea to link to the source code you're reading) then it should be pretty obvious what the code does on the lines after the one you mentioned. The next lines are:
if (mknod(name, S_IFCHR | 0600, (1 << 8) | 3) == 0) {
fd = open(name, O_RDWR);
unlink(name);
Which creates the null device which is then opened and immediately deleted again.
I suspect this is done so that programs can run without access to the root filesystem and still be able to open the equivalent of /dev/null.
I don't know the answer but I have an idea:
The following page shows an "strace" output where /dev/__null__ is used:
https://gist.github.com/tetsu-koba/1522515
Under Linux device files have a 33-bit (?) number which identifies the device. (At least under old Linux versions) you could delete some file in /dev and you could restore it or even create it in another directory (!) when you know the 33-bit number! (So you can delete the device /dev/sda2 and create the device (not file!) /home/myuser/sda2 instead.)
The trace in the link above shows the following three lines:
mknod("/dev/__null__", S_IFCHR|0600, makedev(1, 3)) = 0
open("/dev/__null__", O_RDWR|O_LARGEFILE) = 3
unlink("/dev/__null__") = 0
These lines will create the device file /dev/__null__ (with the 33-bit number identifying /dev/null). Then it opens that file and then it removes the file again.
Maybe this is done because the tool shall be able to run both on Linux installations where the device file "/dev/null" is present (in this case the file should not be overwritten) and on installations where that file is missing (in this case a replacement file must be created using the known 33-bit number).
As other people have pointed out this just tells it's the "null device", not a regular file called "null". null is supposed to act like an information sink, not like a normal file where you dump your data to. Hope this helps.
did anyone notice that on Android - Ti SDK 5.4.0.GA is showing many output at console on all modes like Trace, Debug, Info, Warning, Error.
I have not tried it for Wi-Fi off state, but it is showing such lines every second when the device is connected to Wi-Fi and my console filled up with 100 lines in just few seconds:
[INFO] : D/StatusBar.MSimNetworkController( 1166): getNumberOfActiveSim:0
[INFO] : D/StatusBar.MSimNetworkController( 1166): getPhoneSignalIconList: mMaxLevelOfSignalStrengthIndicator = 4 inetCondition = 0
[INFO] : D/StatusBar.MSimNetworkController( 1166): getDataSignalIconId: mMaxLevelOfSignalStrengthIndicator = 4 inetCondition = 0 iconLevel = 4
[INFO] : D/StatusBar.MSimNetworkController( 1166): updateTelephonySignalStrength: iconLevel=4
Can anyone suggest any solution as this is getting quite annoying and I cannot focus on the console output from code due to too many above logs?
Update
Finally I found a solution to this problem:
https://github.com/appcelerator/titanium_mobile/pull/8754
Logs that contain a dot (or any other character besides letters) won't be caught in the don't show part!
The PR will change the RegEx rule to match any character.
Old solution:
Check the output of ti config cli.logLevel and set it to info
Might solve the problem for you.
I'm facing the same issue and I use monitor with this custom filter:
^(?!(WifiStateMachine|WIFI_UT|AppOps|GraphicsStats|RegisteredNfcid2Cache|Wifi|NotifUtils|WIFI|usbnet|Ethernet|FaceDetectTask|RecentsTaskLoadPlan|MorningBundlePlugin|SocialManagerService|PhoneApp|LoadDialerReceiver|Icing|Herrevad|Finsky|StatusBarManagerService|DropBoxEntryAddedChimeraService|ClearcutLoggerApiImpl|AlarmManager|GCoreUlr|GCoreFlp|APSAnalyticsService|QCNEJ|NetworkStats|IpReachabilityMonitor|Nfcid2RoutingManager|ls|WifiManager|libc|dex2oat|ACRA|HtcMirrorLinkAmsListener|LOWI-Scan|DownloadManagerWrapper|wpa_supplicant|QCALOG|WIFI_ICON|HtcWrapCustomizationManager|gdlights|PowerUtils|ExtremePowerSave|WifiService|FrameworkListener|MediaRouterServie|DotMatrix|PowerUI|PMS|XTCC-5.1.0.7|NetworkManagement|HtcPowerSaver|BatteryControlle|NetLinkSocketObs|WifiController|NetlinkSocketObs|BatteryService|UsbnetService|DeviceIdleControler|Keyboard.Facilit|xiaomi|qdlights|SensorService|AutoSetting|HtcWifiRssiMonitor|HtcWifiDataStallTracker|WifiAutoJoinController|HtcWLD_v5.1.0|WifiMonitor|WifiConfigStore|StatusBar.NetworkController|CwMcuSensor|BrcmNfcJni|DATA_ICON|TelephoneCallback|ContactMessageStore|HtcUPManager|ScreenOnOffReceiver|DeviceIdleController|QSPanel|NetworkPolicy|GpsLocationProvider|SensorManager|SmartNS_PSService|PhoneStatusBar|ScrimController|Settings|LocationManagerService|getVisibilityByRssi|NetworkController.WifiSignalController|GAv4|IntegrityChecker|KernelCpuSpeedReader|KernelWakelockReader|BatteryStatsImpl|WeatherUtility|WeatherTimeKeeper|PNP_UPDATERD|DsService|PathParser|StatusBarManagerServiceHtcASN_1.1|SignalClusterView|SIGNAL_ICON|HtcSystemUPManager|ConnectivityService|HtcASN_1.1|SignalClusterView|SIGNAL_ICON|HtcSystemUPManager|ConnectivityService|WSP|Babel|CityCodeHelper|TetherStatsReporting|TelephonyCallback))
Put this in by Log Tag in a new filter. My device is a HTC A9, a very log-noisy device!
If you still see rows you don't want to just put attach the tags with |tagname
I want to access a android device from python to download some photos.
libmtp works from the CLI.
Than pymtp. It's been around for a while but it's designed for python 2 and i'm using python 3. Meanwhile fixed several minor issues but i'm stuck at an error from function get_filelisting
specially this section:
ret = []
next = files
while next:
ret.append(next.contents)
if (next(next.contents) is None):
break
next = next(next.contents)
The error is related to the "next".
That section looks strange to me, i've been coding in python for a while but i'm new to ctypes. Tried a lot of variants, they all failed. The "next" could be confusing with python buildin function so i renamed it to nextpointer and came to this code:
ret = []
nextpointer = files
while nextpointer:
ret.append(nextpointer.contents)
nextpointer = nextpointer.contents.next
It seems to work but did it work by accident ? does it have any design flaws ? Could anyone with experience on python ctypes confirm this a solution ? Any suggestion welcome.
From python2.7 documentation
next(iterator[, default])
Retrieve the next item from the iterator by calling its next() method. If default is given, it is returned if the iterator is
exhausted, otherwise StopIteration is raised.
from python3 documentation
next(iterator[, default])
Retrieve the next item from the iterator by calling its __next__() method. If default is given, it is returned if the iterator is
exhausted, otherwise StopIteration is raised.
Notice that next() method was removed from python3 but the function still exists.
This is all I can say about the next function and .next()/__next__() methods.
I downloaded the pymtp module and get_filelisting() is slightly different from what you posted in your ported code, here it is:
ret = []
next = files
while next:
ret.append(next.contents)
if (next.contents.next == None):
break
next = next.contents.next
If none of this helped you (which probably didn't :D), the version of pymtp library that I am using is 0.0.6 download using pip.
When running the Calabash tests I get an error during the Before phase but the report exits with 0 code. It says that all the tests were failed because all the steps were skipped but the HTML report is green.
How can I make the report show that there was an error?
Updated: The exit code is correct. If it fails it returns a non 0 code. The problem is the html formatter. I'm running it with the following flag:
--format=html --out ./target/calabash-reports.html
Use
screenshot_and_raise "Error description"
line in side ruby step definitions where you want to raise the error
Eg:
Then /^I (?:press|touch) list item number (\d+)$/ do |index|
index = index.to_i
screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
touch("tableViewCell index:#{index-1}")
sleep(STEP_PAUSE)
end
I have a self-coded kernel module in Android which I open with O_RDONLY|O_NONBLOCK.
O_NONBLOCK is 2048 in both the user-program and the kernel module.
I checked that with
print..("O_NONBLOCK is %d", O_NONBLOCK)
in user- & kernel-space.
But now, when I try to check if O_NONBLOCK was set, I got a really strange problem:
static int my_open(struct inode *inode, struct file *filp) {
if (filp->f_flags & O_NONBLOCK) {
printk("O_NONBLOCK");
} else {
printk("NOT O_NONBLOCK");
printk("O_NONBLOCK in my_open is: %d", O_NONBLOCK); // -> prints 2048
printk("filp->f_flags in my_open is: %d", filp->f_flags); // -> prints 1, not 2048 or larger
}
..
}
I tried something else:
cat my_device
but again, filp->f_flags is 1.
I would assume maybe 0 for O_RDONLY but not 1 which means O_WRONLY.
Anyone an idea or explanation?
EDIT:
I also don't expect cat beeing O_NONBLOCK, but O_WRONLY is totally wrong.
I open it this way:
pcm->dfd=open(fname, O_RDONLY|O_NONBLOCK);
and there's no fcntl later (and that shouldn't affect my_open at all.
But of course I also tried to "re-set" O_NONBLOCK with fcntl without luck.
You need to make sure that the userspace, indeed, passes what you think it must be passing. I find it hard to believe, for example, that "cat" would pass "NONBLOCK". It has no reason to.
Use strace on the userspace end to test what actually gets passed in.
Also, and a bit offtopic, are you sure you care whether O_NONBLOCK is set during open? Please remember that it may also be set using fcntl later on.
Shachar