Android USB Accessory JAR copy to system folders, does it need the odex file too? - arduino

I am trying to get my phone to accept USB Accessory mode and run the DemoKit connected to the Arduino ADK. My ROM did not contain the appropriate files so, I decided to do it myself.
First the specs
My phone: Samsung GT-I9100
My ROM: 2.6.35.7-I9000XWJVZ (rooted)
Firmware: 2.3.6
I've succeeded before in copying the .jar .odex and .xml file to the appropriate folders. Although it completely bricked my phone and was stuck in a boot loop. Now, recovered, I want to give it a second try.
What is this .odex file that every other .jar file has in the /system/framework folder?
Do I need to build/copy the .odex file myself (read something that Dalvik does JIT compiling)?
Is it possible that in my previous attempt, the copying of the .odex (that I got from another phone I9100), bricked mine?
I know I was careless in my previous attempt. Now, I want to approach the subject with a bit more knowledge...

Related

Programmatically access files in a device showing up in 'This PC'

I am on Windows 10. I want to write a function (in R) to copy the files stored in a camera (actually in the SD of the camera, but I cannot just read the memory card in the PC), to a different storage unit (say, the pc or an external HDD).
The camera is connected to the PC via an USB cable.
The problem I am facing is that, when opening the File Explorer, the camera is showing up as a link under "This PC" with no letter to indicate the drive (e.g., 'G:/').
While I can see the files using the file explorer window, I cannot find a way to get to those file from a cli type of interface (e.g., the command prompt, or the R console).
Googling, I found that 'This PC' is not a folder but rather a link to something in the registry called CLSID for which the identifier should be {20D04FE0-3AEA-1069-A2D8-08002B30309D}. However this is very confusing to me and I cannot figure out how to use this information.
Is there a way to do it? And if so: how?
Please consider I do not know much of commands from prompt (way better off in R).
A CLSID is just a GUID. My computer is a implementation of IShellFolder.
My Computer is part of the shell namespace. Several entries in the shell namespace are virtual (Control panel, scheduled tasks etc.) and cannot be accessed with low-level file functions nor cmd.exe.
While it would be possible to develop a tool that does something like shellcopy Computer\MyCamera\*.jpg x:\backup, I'm not aware of any existing tools that do this. You might have to code it yourself.
In the old days you would call SHGetDesktopFolder to get the root and then use the returned IShellFolder to navigate but these days it is simpler to use IShellItem instead.
To do this it is crucial to understand how IShellFolder and PIDLs work. See Introduction to the Shell Namespace for more information...

is it possible to upload several sketches to an Arduino board

I have a project that is divided into two sections
each one of them requires an independent sketch,
I wanna upload the two sketches into the same Arduino card without one of them ruining the other's work, is that possible? if yes how to please
if no any other alternatives
No.
But you could combine both rather independent parts and add some logic to find out which part should be active, currently.
E.g. When a button (-combination) is pressed at restart, Arduino runs the test mode, else it runs in standard mode.
You can have multiple tabs in the Arduino IDE to handle the modes more independently, but all code is coexisting in flash memory after upload.
What you can do is have two seperate bin files (IDE menu Sketch / Export compiled binary) and have both of them include OTA code so you can update the binary as needed. The bin files can be stored locally on an SD card or remotely on a web server if the board has networking capabilities. Once updated the processor will reboot and start with updated code.
Look at ArduinoOTA for more information.

Arduino distributable program file

Similar to an .exe file, is there a way to make a 'distributable' of an Arduino program? Some sort of ready-to-upload file... I'd like to share the program but the code should be kept the most secret as possible, or at least make it hard to know.
You can distribute the .hex binary file, and then let the users upload the binary on the Arduino themselves.
The ordinary Arduino IDE already does that for you when you click on the button verify & upload, so you simply have to take the generated .hex file and give it away.
Or you can use Arduino Makefile to get your .hex binaries using any other development environment.
Note: even though the source code is not included nor displayed, it is possible to reverse engineer an .hex binary as much as it is possible to do it with an .exe binary.

CC2540 DK Program SimpleBLE Peripheral Application

I have purchased the CC2540 EK I am trying to program the SampleBLE peripeheral onto the CC2540EM. I am using the IAR tool chain and the USB cable is connected directly to the SMARTRF05EB (not using the CC debugger) In IAR I can download the code but the SimpleBLEperipheral does not seem to run.
Looks like the App that came with the CC250EM from the factory has been erased and I am unable to reload that application again.
What is the exact project workspace that I shoud open?
Are there any changes that need to be made to the IAR project so that it can be run on the CC2540EM?
The IAR project name is SimpleBLEPeripheral - CC2540DK- MiniKeyfob - this seems to suggest that it is meant for the keyfob and not the CC2540EM.
It's due to the build option.
You got to set the build option to "cc2540", instead of "cc2540df-mini keyfob"...
In IAR, you can set the build option in the drop-down menu in the Workspace area. (it's right under the word "Workspace")
After doing this, compile and reload the hex file to the module.
It should be able to solve the problem.

Monitor unlimited files/folders under Mac osx with Qt

I am working on an application targeted to Mac OSX 10.6+ using Qt 4.7.4
I have a folder with as much as 1000 files + and some or many or even all of these files may be renamed or moved or deleted, so I want to report to my application if:
File is renamed (report original and renamed filename)
Folder renamed (report original and renamed folder name)
File/folder is deleted (just report it as deleted)/moved (report the moved location)
PROBLEM: is the underlying system may (its MAY) only allow 256 descriptors to be monitored so at most 256 files! How can I over come this?
Note: used QFileSystemWatcher interface (it has the above stated problem)
ALSO : How to handle in case of version lower than OSX 10.5
Do mention how do i get renamed filename/foldername
From the QFileSystemWatcher docs:
On Mac OS X 10.4 and all BSD variants, for example, an open file descriptor is required for each monitored file. Some system limits the number of open file descriptors to 256 by default. This means that addPath() and addPaths() will fail if your process tries to add more than 256 files or directories to the file system monitor. Also note that your process may have other file descriptors open in addition to the ones for files being monitored, and these other open descriptors also count in the total. Mac OS X 10.5 and up use a different backend and do not suffer from this issue.
So you should not need to worry about this at all in your case.
QFileSystemWatcher doesn't provide the information you requested in your edit. It will emit signals when one of the paths it monitors changes, but in case of a rename, you won't get the new name. It's intended more for things like file manager programs that will just update/reload their current view on receipt of such events.
If you need more information than that, you'll need to use OS specific APIs. You can look at the code Qt uses for different platforms in the Qt source. It's in src/core/io/qfilsystemwatcher_*.[h|cpp].
For Mac OS X 10.5 or greater, the underlying API used is the FSEvents API. You can read in the Technology Overview page:
The important point to take away is that the granularity of notifications is at a directory level. It tells you only that something in the directory has changed, but does not tell you what changed.
So that OS-level API doesn't provide what you want either directly.
For older versions of Mac OS X and FreeBSD, Qt uses the kqueue API, with the EVFILT_VNODE event filter. That API doesn't provide the new name of a renamed file either.
In short, either you'll need to code something yourself based on one of those APIs, find a library that does it (with guarantees that meet your needs), or you'll need to redesign your application. "Watching" a directory in a portable manner is at best very tricky, and generally race- and error-prone. If I were you, I wouldn't be too optimistic especially if your design requires that no "event" be missed.

Resources