Building i2c-tools on android - android-build

I'm trying to integrate i2-tools on Android build system. I have modified the Android.mk as referred from the blog on internet but I could not see my files getting compiled.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
LOCAL_SRC_FILES := tools/i2cbusses.c tools/util.c
LOCAL_MODULE := i2c-tools
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:=tools/i2cdetect.c
LOCAL_MODULE:=i2cdetect
LOCAL_CPPFLAGS += -DANDROID
LOCAL_SHARED_LIBRARIES:=libc
LOCAL_STATIC_LIBRARIES := i2c-tools
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:=tools/i2cget.c
LOCAL_MODULE:=i2cget
LOCAL_CPPFLAGS += -DANDROID
LOCAL_SHARED_LIBRARIES:=libc
LOCAL_STATIC_LIBRARIES := i2c-tools
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:=tools/i2cset.c
LOCAL_MODULE:=i2cset
LOCAL_CPPFLAGS += -DANDROID
LOCAL_SHARED_LIBRARIES:=libc
LOCAL_STATIC_LIBRARIES := i2c-tools
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:=tools/i2cdump.c
LOCAL_MODULE:=i2cdump
LOCAL_CPPFLAGS += -DANDROID
LOCAL_SHARED_LIBRARIES:=libc
LOCAL_STATIC_LIBRARIES := i2c-tools
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
include $(BUILD_EXECUTABLE)
Any help is appreciated.
Thanks,
Nanda

I had test it on my environment, it can compile i2c-tools, using the following site for reference:
http://boundarydevices.com/i2c-tools-under-android/
The steps to compile are:
1.enter AOSP.
2.$ source build/envsetup.sh
3.$ lunch xxxxx
4.copy i2c-tools-3.1.0 folder to AOSP/tools/external
5.create Android.mk file (content same as your) in i2c-tools-3.1.0
6.enter i2c-tools-3.1.0 folder,then type $mm
7.you will see the i2ctools was builded in out/target/product/xxxx/system/bin/i2cset

If you want appiled them into existing system using adb:
after compile use:
adb root
adb push i2cdetect \system\bin
...
for all other apps i2c*
Regards
MikoĊ‚aj

Related

How can I add the XML tag and data to an existing XML in PL-SQL?

The xmldom usage in the package is as follows. I specify the next line to be added. But I can't find a solution on how to convert the line to xmldom format and add it.
vc_xml := '<'||cs_KEY_TAG||'>'|| pin_xml ||'</'||cs_KEY_TAG||'>';
parser := xmlparser.newParser;
xmlparser.parseclob(parser, vc_xml);
doc := xmlparser.getDocument(parser);
nl1 := xmldom.getElementsByTagName(doc, cs_KEY_TAG);
node := xmldom.item(nl1, 0);
nl2 := XMLDOM.getchildnodes(node);
len1 := xmldom.getLength(nl2);
FOR i in 0..len1-1 LOOP
node := xmldom.item(nl2, i);
nl3 := xmldom.getchildnodes(node);
len2 := xmldom.getLength(nl3);
FOR j in 0..len2 -1 LOOP
node := xmldom.item(nl3, j);
element := xmldom.makeElement(node);
node := xmldom.getFirstChild(node);
'<device_count>' || vs_d_count || '</device_count>' ->this is the line to add to the XML

InnoSetup v6 ARC Extraction, Minimize Broken

InnoSetup v6
Extracting from a FreeArc 0.67 (March 15 2014) Archive using temporary file unarc.exe, during the extraction process the minimize window button is broken.
Using FreeARC because it's the best compression software I can find to date.
During the archive decompression, the GUI window with the status message can't be minimized.
Clicking the window makes windows respond with a deny sound. How do I resolve this?
Something to do with "ProgressPage" or executing the arc command line?
Even with this page disabled, it does the same thing, so probably the setup waiting for the process to finish?
I am constantly working on improving and getting this fix because I got files that are in the 100 GB range that need to be compressed to save on disk space. Making a setup program for the extraction process makes it easier to install those files vs relying on the application that I must install first in order to do an extraction.
EDIT: I switch the extraction program from arc.exe to unarc.exe because arc.exe was crashing due to RAM issues.
#define ArcArchive "Test.arc"
[Setup]
AppName=Test App
DefaultDirName=Test App
AppVerName=Test App
WizardStyle=modern
Compression=lzma2
SolidCompression=yes
Uninstallable=no
DisableProgramGroupPage=yes
[Files]
Source: unarc.exe; Flags: dontcopy
[Code]
var
ProgressPage: TOutputProgressWizardPage;
ProgressFileName: string;
procedure ExtractArc;
var
ArcExtracterPath: string;
ArcArchivePath: string;
TempPath: string;
CommandLine: string;
ResultCode: Integer;
S: AnsiString;
Message: string;
begin
ExtractTemporaryFile('unarc.exe');
ProgressPage := CreateOutputProgressPage('Decompression', 'Decompressing archive...please wait');
ProgressPage.Show;
try
TempPath := ExpandConstant('{tmp}');
ArcExtracterPath := TempPath + '\unarc.exe';
ArcArchivePath := ExpandConstant('{src}\{#ArcArchive}');
ProgressFileName := ExpandConstant('{tmp}\progress.txt');
Log(Format('Expecting progress in %s', [ProgressFileName]));
CommandLine :=
Format('"%s" x -o+ -dp"%s" "%s" > "%s"', [
ArcExtracterPath, ExpandConstant('{app}'), ArcArchivePath, ProgressFileName]);
Log(Format('Executing: %s', [CommandLine]));
CommandLine := Format('/C "%s"', [CommandLine]);
if not Exec(ExpandConstant('{cmd}'), CommandLine, '', SW_HIDE,
ewWaitUntilTerminated, ResultCode) then
begin
RaiseException('Cannot start extracter');
end
else
if ResultCode <> 0 then
begin
LoadStringFromFile(ProgressFileName, S);
Message := Format('Arc extraction failed failed with code %d', [ResultCode]);
Log(Message);
Log('Output: ' + S);
RaiseException(Message);
end
else
begin
Log('Arc extraction done');
end;
finally
{ Clean up }
Log('Arc extraction cleanup');
ProgressPage.Hide;
DeleteFile(ProgressFileName);
end;
Log('Arc extraction end');
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
ExtractArc;
end;
end;

Go - how can i install selenium to use it in go language?

I am trying to run and test this code but the selenium is missing and i cant install it in my system, what should i do in that case please?
ERROR: while execute
test.go:8:2: import "bitbucket.org/tebeka/selenium": cannot find package
INSTALL the package i tried:
# apt-get install goisntall
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package goisntall
# apt-cache search goinstall
golang-src - Go programming language compiler - source files
CODE: testing
/* Selenium example goinstall bitbucket.org/tebeka/selenium */
package yahoo
import (
"strings"
"testing"
"bitbucket.org/tebeka/selenium"
)
func TestYahoo(t *testing.T) {
/* We want firefox, don't care about version much */
caps := selenium.Capabilities {
"browserName": "firefox",
}
wd, _ := selenium.NewRemote(caps, "", "")
defer wd.Quit()
/* Navigate to Yahoo */
wd.Get("http://www.yahoo.com")
/* Fill the search box */
input, err := wd.FindElement(selenium.ByName, "p")
if err != nil {
t.Error(err.String())
}
err = input.SendKeys("golang")
if err != nil {
t.Error(err.String())
}
/* Hit the search button */
button, err := wd.FindElement(selenium.ById, "search-submit")
if err != nil {
t.Error(err.String())
}
err = button.Click()
if err != nil {
t.Error(err.String())
}
/* See that we get expected result */
source, err := wd.PageSource()
if err != nil {
t.Error(err.String())
}
if !strings.Contains(source, "The Go Programming Language") {
t.Error("Google can't find Go")
}
}
For example, with GOPATH set appropriately,
$ env | grep '^GOPATH'
GOPATH=/home/peter/gopath
$ go get -v bitbucket.org/tebeka/selenium
bitbucket.org/tebeka/selenium (download)
bitbucket.org/tebeka/selenium
$
References:
Command go
Download and install packages and dependencies

.NET Framework as a pre-requisite for installation with Inno-Setup

I have an application I have to check if .NET FW 3.5 has already installed. If already installed, I want to open a messagebox that asks the user to download it from Microsoft website and stop the installation.
I found the following code. Can you tell me please:
a) Where should I call this function from?
b) Should I check if .NET FW 3.5 or higher version is already installed? e.g. If FW 4.0 installed - is that necessary to install 3.5?
Thank you
function IsDotNET35Detected(): Boolean;
var
ErrorCode: Integer;
netFrameWorkInstalled : Boolean;
isInstalled: Cardinal;
begin
result := true;
// Check for the .Net 3.5 framework
isInstalled := 0;
netFrameworkInstalled := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', isInstalled);
if ((netFrameworkInstalled) and (isInstalled <> 1)) then netFrameworkInstalled := false;
if netFrameworkInstalled = false then
begin
if (MsgBox(ExpandConstant('{cm:dotnetmissing}'), mbConfirmation, MB_YESNO) = idYes) then
begin
ShellExec('open',
'http://www.microsoft.com/downloads/details.aspx?FamilyID=333325fd-ae52-4e35-b531-508d977d32a6&DisplayLang=en',
'','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;
result := false;
end;
end;
If you want to perform your check when the installation starts but before the wizard form is shown, use the InitializeSetup event handler for it. When you return False to that handler, the setup will abort, when True, setup will start. Here's a little bit optimized script you've posted:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[CustomMessages]
DotNetMissing=.NET Framework 3.5 is missing. Do you want to download it ? Setup will now exit!
[Code]
function IsDotNET35Detected: Boolean;
var
ErrorCode: Integer;
InstallValue: Cardinal;
begin
Result := True;
if not RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5',
'Install', InstallValue) or (InstallValue <> 1) then
begin
Result := False;
if MsgBox(ExpandConstant('{cm:DotNetMissing}'), mbConfirmation, MB_YESNO) = IDYES then
ShellExec('', 'http://www.microsoft.com/downloads/details.aspx?FamilyID=333325fd-ae52-4e35-b531-508d977d32a6&DisplayLang=en',
'', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
function InitializeSetup: Boolean;
begin
Result := IsDotNET35Detected;
end;

One Step Installer

I'm looking for a way to create a one page installer in Inno Setup, just look at this screenshot:
Can anyone please give me the codes for doing this?
Or totally I would like to merge pages abilities in Inno Setup. For example merge Select directory page with Components page and etc
It's not easy to do by default. But it can be done, the following code
produced a page like this one.
[Setup]
AppName=Test
AppVersion=1.5
DefaultDirName={code:AppDir}
;Disable all of the default wizard pages
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyMemo=yes
DisableReadyPage=yes
DisableStartupPrompt=yes
DisableWelcomePage=yes
;May want this, after install.
DisableFinishedPage=no
[Messages]
ButtonNext=Install
[Files]
Source:"e:\test.txt"; DestDir: "{app}"
Source:"e:\test.txt"; DestDir: "{app}"; DestName: "test1.txt"; Check: Option1;
Source:"e:\test.txt"; DestDir: "{app}"; DestName: "test2.txt"; Check: Option2;
[Code]
var
MainPage : TWizardPage;
edtFolderToInstall : TEdit;
InstallLocation : String;
Opt1, Opt2 : Boolean;
ChkOption1 : TCheckBox;
ChkOption2 : TCheckBox;
function AppDir(Param: String): String;
begin
// Set Default if not set.
if InstallLocation = '' then
InstallLocation := ExpandConstant('{pf}') + 'test';
result := InstallLocation;
end;
function Option1 : Boolean;
begin
result := Opt1;
end;
function Option2 : Boolean;
begin
result := Opt2;
end;
procedure BrowseClick(Sender : TObject);
var
Dir : String;
begin
Dir := edtFolderToInstall.Text;
if BrowseForFolder('Select Folder',Dir,false) then
edtFolderToInstall.Text := Dir;
end;
procedure InitializeWizard();
var
lblFolderToInstall : TLabel;
btnFolderToInstall : TButton;
begin
MainPage := CreateCustomPage(wpWelcome,'Setup - Test App Name','This will install "Test App Name" to your computer');
lblFolderToInstall := TLabel.Create(MainPage);
lblFolderToInstall.Parent := MainPage.Surface;
lblFolderToInstall.Top := 10;
lblFolderToInstall.Left := 10;
lblFolderToInstall.Caption := 'If you would like to select a different folder, Click Browse.'
edtFolderToInstall := TEdit.Create(MainPage);
edtFolderToInstall.Parent := MainPage.Surface;
edtFolderToInstall.Top := 25;
edtFolderToInstall.Left := 10;
edtFolderToInstall.Width := 250;
edtFolderToInstall.Text := WizardDirValue;
btnFolderToInstall := TButton.Create(MainPage);
btnFolderToInstall.Parent := MainPage.Surface;
btnFolderToInstall.top := 25;
btnFolderToInstall.Left := 275;
btnfolderToInstall.Caption := 'Browse...';
btnFolderToInstall.OnClick := #BrowseClick;
ChkOption1 := TCheckBox.Create(MainForm);
ChkOption1.Parent := MainPage.Surface;
ChkOption1.Top := 50;
ChkOption1.Left := 10;
ChkOption1.Caption := 'Option 1';
ChkOption2 := TCheckBox.Create(MainForm);
ChkOption2.Parent := MainPage.Surface;
ChkOption2.Top := 75;
ChkOption2.Left := 10;
ChkOption2.Caption := 'Option 2';
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
result := True;
// Next pressed, better make sure selected items are correct.
if CurPageId = MainPage.ID then
begin
InstallLocation := edtFolderToInstall.Text;
Opt1 := ChkOption1.Checked;
Opt2 := ChkOption2.Checked;
end;
end;
To pull this off, I use {code:AppDir} as the default directory. This tells InnoSetup to use the function AppDir to retrieve the installation directory. I then can set it using my custom dialog.
Instead of using [Components] and/or [Tasks] I have to use Check in the [Files] Section.