External touch screen input only uses cursor coordinates - android

I have a ViewSonic touch screen display connected to an Android PC (kernel 3.0.36+) via HDMI & USB. The display shows everything correctly. Furthermore, the Linux kernel recognizes it.
dmesg:
<6>[ 99.699034] usb 2-1.2.3: new full speed USB device number 8 using usb20_host
<6>[ 99.800896] usb 2-1.2.3: New USB device found, idVendor=0408, idProduct=3008
<6>[ 99.800993] usb 2-1.2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=4
<6>[ 99.801099] usb 2-1.2.3: Product: OpticalTouchScreen
<6>[ 99.801169] usb 2-1.2.3: Manufacturer: Quanta
<6>[ 99.801226] usb 2-1.2.3: SerialNumber: 0000
<4>[ 99.805402] quirks: 0x00000000
The problem is that the screen, while I can touch anywhere, only registers the tap at the curser location (wireless keyboard/mouse connected). If I move the cursor and tap anywhere on the screen, the new location receives the tap. If I remove the keyboard/mouse dongle the behavior remains, but now I can't move the cursor.
The USB connection to the monitor is being displayed (highlighted) in dev/usb:
Input device configuration file located in /system/usr/idc/Vendor_0408_Product_3008.idc
# Input device configuration file.
# This is an external device, attached to the USB or Bluetooth bus.
device.internal = 0
# The device should behave as a touch screen, which uses the same orientation
# as the built-in display.
touch.deviceType = touchScreen
touch.orientationAware = 0
touch.gestureMode = spots
# Orientation
touch.orientation.calibration = vector
# Output Ranges
output.width = 1920
output.height = 1080
output.diag = sqrt(output.width ^2 + output.height ^2)
Any guidance or suggestions are appreciated!

Related

Android: Programmatically detect if device has hardware touchscreen connected

I need to write a script to detect if the physical touchscreen is connected to my Android device at boot time.
I tried to list the content of the folder /dev/input via adb and I obtain the following output:
root#q88:/dev/input # ls
event0
event1
event2
event3
event4
mice
If I am not mistaken, event0 identifies the touchscreen, but it is visible in both case the touchscreen is connected or not.
Is there a way to detect if the touchscreen is connected to the device?
Thanks in advance.
You can read /proc/bus/input/devices to get details of your existing input devices.
Depending on your hardware's name, you could do something like that and check if there is any output:
cat /proc/bus/input/devices | grep "Name=" | grep "Touch"
This is the full output of /proc/bus/input/devices:
I: Bus=0011 Vendor=0002 Product=0008 Version=2222
N: Name="AlpsPS/2 ALPS DualPoint TouchPad"
P: Phys=isa0060/serio1/input0
S: Sysfs=/class/input/input2
H: Handlers=mouse1 event2 ts1
B: EV=f
B: KEY=420 0 70000 0 0 0 0 0 0 0 0
B: REL=3
B: ABS=1000003
[...] (blank line, next device)
The B in front stands for bitmap, N, P, S, U, H are simply first
letter in corresponding name value and I is for ID. In ordered
fashion:
I → #id: id of the device (struct input_id)
Bus → id.bustype
Vendor → id.vendor
Product → id.product
Version → id.version
N → name of the device
P → physical path to the device in the system hierarchy
S → sysfs path
U → unique identification code for the device (if device has it)
H → list of input handles associated with the device
B → bitmaps
PROP → device properties and quirks
EV → types of events supported by the device
KEY → keys/buttons this device has
MSC → miscellaneous events supported by the device
LED → leds present on the device
REL → relative address
ABS → absolute address
To test if the device is actually attached, you can try simulating events and see if you get any errors:
input tap [x] [y]
Android comes with an input command-line tool that can simulate miscellaneous input events.
input → The command line tool to send events
tap → the action
[x] → X coordinate on the screen
[y] → Y coordinate on the screen
Find a driver name for the touch controller of your device. Then check its sysfs location. There will be few files mapped to the internal variables which were populated with data read from the physical touchscreen device during its initialization. For example most touchscreen controllers have updateable firmware and provide a way to query its current version.
One of my devices uses atmel_mxt_ts touchscreen controller and its sysfs location is /sys/bus/i2c/drivers/atmel_mxt_ts/1-004a/. There is a fw_version file in that folder. If the physical touchscreen is connected that file would contain the current firmware label. The empty file would mean that there is no touchscreen.

Is there anyway I can send SERIAL-USB data thru a HDMI port?

I have been working on a project where our Android tablet has only 1 microUSB port.
Since we must communicate via serialUSB with an external device, it became a little fuzzy after we noticed that leaving the tablet powering the bus (Host Mode) drains it`s battery till death. Moreover, we still must supply enough energy to power the tablet.
After a lot of attempted fails, such as using a OTG-Y cable, modifying Kernel Battery Config and using a USB Hub, I need to discover a way to perform the communication and keep the tablet charging.
Thought about using the HDMI or even the audio/serial. Is there any solution I can look forward to solve this?
At this point, I'm getting out of ideas.
You can use an arduino, but not a normal one, you'll need a mega, i say this because the ardiono mega is the only arduino i know of with more than one serial UART. The Uno for example shares the RX/TX serial pins with the same UART as the USB interface.
If you DO have a mega, you can get a cheap USB to Serial module such as this: http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&_nkw=arduino+usb+to+serial&_sop=15
Now, you plug your PC into the mega's normal USB This will power the Mega from your PC.
Then you connect your tablet to the serial module.
All that's left to do is create a simple ino script for your mega to transfer data from serial (pc-USB) to serial2 (Tablet), and vice versa..
Example:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200); // PC <--> USB
Serial1.begin(115200); // Serial <--> Tablet
}
void loop() {
// put your main code here, to run repeatedly:
serialComs(); // Tells loop to execute the serialComs() function
}
// Serial Comunication function
void serialComs() {
// read from port 1 (Tablet), send to port 0 (PC):
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
// read from port 0 (PC), send to port 1 (Tablet):
if (Serial.available()) {
int inByte = Serial.read();
Serial1.write(inByte);
}
}
NOTE: You may need to add #DEFINE entries before void setup to define which pins are which on your serial to USB module.
I think your way througt the HDMI will not work. And you have only one other option:
You could also load your battery directly. You could open the case and power your tabled instead your battery. This should also work. I think ther is no other way.
Also you could try a OTG hub: http://www.miniinthebox.com/de/3-in-1-micro-usb-otg-host-adapter-kabel-hub-fuer-samsung-smartphone-tablet-n9000_p1996674.html?currency=EUR&litb_from=paid_adwords_shopping&litb_from=&adword_mt=&adword_ct=73333307802&adword_kw=&adword_pos=1o1&adword_pl=&adword_net=g&adword_tar=&adw_src_id=4196617767_313342362_22461529362_kwd-140182704282&gclid=CJqW-Na8zMcCFc8aGwodznEIZA
But not all tables allow charging and using USB at the same time.

is function tcsetattr() mapped to a file descriptor or a physical port

I've encountered a very strange problem in the developing of 232 communicaion between my android device and a 232 device. I want to set up the communication bewteen my MCU and a 232 device, the 232 device has baudrate 115200.
What i have done is as follows:
I open() a port ttyO0 and obtained a file descriptor fd1. I use tcsetattr(fd1,TCSAFLUSH,termiosA) to map termiosA to the fd1. The termiosA has baud rate 9600 so its not compatiable with my 232 device.
Later I destoried what has been created before and performed the above process again by changing fd1 to fd2, and termiosA to termiosB. And the termiosB has baud rate 115200.
However, I found it's still not working. I guess the reason is that tcsetattr() function actually does the map between physical port and settings, rather than the map between file descriptor and settings. So the actual physical port in my CPU was mapped to the setting of termiosA first and was not changed again to termiosB due to some reason. Thus the communicatoin between MCU and 232 device fails.

Android fails load driver touchscreen on Samsung Galaxy Tab 10.1

Can you help me with this:
My tablet Galaxy Tab 10.1, after reset pressing power button 15 seconds making a soft reset because freeze loading an app, not load touchscreen driver.
Dmesg message:
<6>[ 7.163493] mXT1386: mxt_probe
<6>[ 7.163501] maXTouch driver
<6>[ 7.163507] "sec_touch"
<6>[ 7.163513] addr: 0x004c
<6>[ 7.163519] irq: 220
<6>[ 7.163525] flags: 0x0000
<6>[ 7.163531] adapter:"Tegra I2C adapter"
<6>[ 7.163537] device: "(null)"
<3>[ 7.163685] tegra-i2c tegra-i2c.1: I2c error status 0x00000008
<3>[ 7.169602] tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
<3>[ 7.176023] tegra-i2c tegra-i2c.1: Packet status 0x00010009
<6>[ 7.182700] Warning: To wake up touch-ic in deep sleep, retry i2c communication!
<3>[ 7.222752] tegra-i2c tegra-i2c.1: I2c error status 0x00000008
<3>[ 7.228727] tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
<3>[ 7.235061] tegra-i2c tegra-i2c.1: Packet status 0x00010009
<3>[ 7.241798] sec_touch 1-004c: Failure accessing maXTouch device
<3>[ 7.247800] sec_touch 1-004c: Chip could not be identified
<6>[ 7.253434] p3_touch_exit_hw
<4>[ 7.253455] sec_touch: probe of 1-004c failed with error 255
<6>[ 7.253510] Successfully added driver sec_touch
How can I sure of if is a hardware issue or a configuration issue?
I clean cache, data, system folders from CWM and reinstall stock rom p7510uekmm and nothing happend
I had this problem with my Galaxy Tab and tried the ideas mentioned above but it just didn't work for me. I have, however, figured out what's really going wrong.
I always had this failure showing up in dmesg:
tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
So, it can't read from the touchscreen controller at address 0x4c because the chip isn't responding. One fix mentioned was to re-write the configuration, with the assumption that the device was somehow wedged. That doesn't work either, since you can't write to 0x4c - same lack of acknowledgement. So, if 0x4c is the right address, the chip must be dead, right?
I tried adding a reset. No change. Disconnected the battery overnight. Also no change.
Then, I realized what's going on. The MXT1386 has a "Firmware Update" mode. When you put it into update mode, the device address changes from 0x4c to 0x26! Once it gets into that mode, it doesn't respond to the original address. Since I don't have the docs for the device, and thus don't know how to get out of firmware update mode, I updated the Linux kernel to call the driver function that updates the firmware. Once that process is complete and the chip reset, it reverts to its original address. At that point (after a final reboot), all is well.
I have a replacement kernel that you can install and boot which re-enables the touchpad. I'd suggest making a nandroid backup first, installing my kernel, then restoring the nandroid once it's fixed.
It's trying to contact the touch controller over the I2C bus and failing. It does one retry and then gives up. The address 0x4C is correct for the mXT1386 on that unit.
You should try a hard power off/on by taking out the battery.
You could try taking apart the
unit and reseating the connector to the touch controller. It is
on a separate board connected with a flexi cable which might have become dislodged.
Another possibility is that the touch chip itself is damaged.

Smart Phone & Tablet - Plugged Into Computer

Is there a way to determine if a smart phone or tablet (iOS or Android), is plugged into a computer?
Either the phone/tablet perspective (i.e. isConnectedToComputer) or the computer perspective (i.e. connectedDevices) would be fine.
If it's from the computer perspective, it would specifically have to be via a Mac OS X app.
If it's from the phone/tablet perspective, it would need to be differentiated from simply charging.
The general idea is to determine when a user is at their computer.
Note: In order to make this determination, I need to identify the device. For iOS, the device UUID (similar to that used in APNS) is used. In Android, a combination hardware and software IDs are combined. So if the solution in from the computer perspective, I need to be able to obtain these strings. Otherwise, I need to be able to pass them to the computer.
Bonus: It would be fantastic if Wi-Fi syncing could also be taken into account as "connected".
Simple Solution
Consider using system_profiler SPUSBDataType through NSTask.
When my iPhone is connected the following is included in the result:
iPhone:
Product ID: 0x1292
Vendor ID: 0x05ac (Apple Inc.)
Version: 0.01
Serial Number:
Speed: Up to 480 Mb/sec
Manufacturer: Apple Inc.
Location ID: 0xfa140000 / 6
Current Available (mA): 500
Current Required (mA): 500
Extra Operating Current (mA): 500
Use system_profiler SPUSBDataType -xml to output the result in XML format:
<dict>
<key>_name</key>
<string>iPhone</string>
<key>a_product_id</key>
<string>0x1292</string>
<key>b_vendor_id</key>
<string>apple_vendor_id</string>
<key>c_bcd_device</key>
<string> 0.01</string>
<key>d_serial_num</key>
<string></string>
<key>e_device_speed</key>
<string>high_speed</string>
<key>f_manufacturer</key>
<string>Apple Inc.</string>
<key>g_location_id</key>
<string>0xfa140000 / 6</string>
<key>h_bus_power</key>
<string>500</string>
<key>j_bus_power_used</key>
<string>500</string>
<key>k_extra_current_used</key>
<string>500</string>
</dict>
Simply parse the XML to determine wether the device of interest is connected or not.

Categories

Resources