Accidentally step into Android development: tpmini with big eyes using the PS3 Bluetooth handle (3) Development Environment

Source: Internet
Author: User

This is a set of serialized articles used to record the entire process of connecting a Bluetooth handle with big eyes. I would like to use this document to give my missing sleep that week.

This article is equivalent to a (public) personal diary. Do not repost it without your permission.

 

As mentioned above, we have found another way: linmctool. It seems that this is more reliable than hidd, because it is for SixAxis, and it certainly contains communication with SixAxis.

Okay, I need to try it.

I searched Google and did not find its Binary. You can only compile it yourself.

I spent a lot of time studying how to compile binary files. After searching, they found that the binary files directly run in the command line are called "Local code" or "Native code", formerly known as "Native code ". It turns out that. Continue Google.

First, I read these two articles:

Android Native C Development: Toolchain Environment Construction

Android C native development using the NDK under Windows

After reading this article, I realized that Android development is really troublesome. Unlike Windows, do a good job of software and install a runtime. Because Android runs on various platforms, the compilation environment is complex. Cross-compilation is required. Alas, I haven't completed this article for a long time, because google is too new to various sdks such as NDK, and some places are different from the tutorials, so I am very confused, no one taught me.

Later I read this article:

Android C native development-take full control!

Finally, we decided to run Ubuntu with a virtual machine, which is more reliable.

Important references:
Ubuntu12.10 install the cross compiler arm-none-linux-gnueabi-gcc

After a great deal of effort, we finally installed arm-none-linux-gnueabi-gcc. The name is really long!

Next, we will inevitably compile a HelloWorld. c program to test it, and push it to the big eyes to run it, which is normal.

adb push hello /data/local/tmpadb shell chmod 777 /data/local/tmp/helloadb shell /data/local/tmp/hello

Well, now we have the tools to work. Let's get started. Use the linmctool source code and compile it according to the instructions:

arm-none-linux-gnueabi-gcc --std=gnu99 -Wall -DWITHOUT_USB linmctool-20110304.c -o linmctool 

Because my Bluetooth has already been paired successfully, the-DWITHOUT_USB parameter is included to reduce the possibility of compilation errors. However, there are still a bunch of errors, and various. H files do not match. You can find it on the Internet to compile it successfully. Compiled. Please try pushing it to your big eyes.

adb push linmctool /data/local/tmpadb shell chmod 777 /data/local/tmp/linmctooladb shell /data/local/tmp/linmctool

Run successfully. After pressing the PS key on SixAxis, the miracle finally appeared. The button status report for one row is displayed on the screen. Although the indicator on the handle is still flashing, it will not stop, and it will respond to any key! Continue to be excited in the next article.

For a long time, I used arm-none-linux-gnueabi-gcc under the Ubuntu Virtual Machine to compile the program. Because VIM is not used, it is very tiring to edit text in Ubuntu. I had to use LAN sharing. It's really exhausting.

 

It was not until the end that I found a better tool that can be used directly in Windows.
CodeSourcery code=lite, which can run and compile Android local code in Windows.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.