I'm trying to communicate to a custom piece of hardware from a (userspace) C++ program. The device is an HID device, but not a mouse/keyboard.
On Windows, I can use HidD_SetOutputReport to send a report, and then HidD_GetInputReport to receive the reply. (There is more than one report being generated, but those calls let me specify which one I want.)
I'm not doing anything fancy, so it's nice and straightforward.
I am having trouble figuring out what the simple Linux alternative to those calls is.
If someone could point me towards documentation or a code example that illustrates equivalent operations on Linux, I would be very grateful.
Thank you.
If your device is a HID device then for sending the HID report you need to write to the corresponding /dev/hid* device. This will be HidD_SetOutputReport alternate.
Most of the devices now using EP0 for backward communication, so for getting the response you need to read from corresponding /dev/hid* device. This will beHidD_GetInputReport alternate.
If your hardware are not using the EP0 for communication then you can find the information from your Endpoint descriptor, in which it will be defined how to get the response back.
I have the CC2540 Keyfob Development Kit and I have established connections between the bluetooth dongle and the Keyfob and have been able to do simple read writes. Then I connected the CC Debugger and download the SmartRF Flash Programmer and the IAR Workbench. All I want to do is change a few values in the firmware so that it broadcasts indefinitely and so that I can change the name it advertises with. I have read the Getting started docs and the sample applications docs but the problem is I don't know how to edit/compile these files so I can upload it to the device with the SmartRF flash programmer. Is there any documents or tutorials or are there steps to do this? Thank you! Let me know if I can answer any other questions
All you have to do is:
Download the BLE stack from Texas Instruments website:
http://www.ti.com/tool/ble-stack
Then in the stack, open Projects\ble\KeyFob\CC2540DB\KeyFobDemo.eww file.
Programming CC2540 kit requires an IDE named IAR Embedded Workbench. You can download it and get access with 30-days trial:
http://www.iar.com/Products/IAR-Embedded-Workbench/8051/
Then open the project and find the keyfobdemo.c file in the APP folder. From line 200-213 there is a char array named deviceName[], which actually defines the advertising name as "Keyfobdemo". You just have to change that with correct hex values, and the length of the array as well.
Then in line 236, you have to change attDeviceName[] array as well, since this parameter defines the name of your device, when it is in connected state.
I have a 40x7 VFD that functions as a serial terminal. It has a dedicated keypad that provides hex-entry, however, I would like to use a keyboard for the standard input. Basically, I want to be able to use the VFD as a display for a Linux bash prompt, but use the keyboard connected to the computer as the means of input. Instead of connecting a monitor, the serial terminal will be the monitor. I can get the login prompt displayed on the VFD with agetty, but since it only has hex-entry, how can I change where the system is looking for standard input?
Thanks,
Core_Module
I think the best method would be to create a pseudo terminal. In doing so you create a fake terminal device with a /dev/pts/[n] name that acts like a real input/output device. A program could connect the console (keyboard) as input and the VFD as output and send and receive that data over the pseudo device. You can then point agetty at the /dev/pts/[0] device instead of a /dev/ttyS[n] device. Some ideas on doing this can be found in many tutorials online. From the link:
A pseudo-terminal is a pair of character mode devices also called pty. One is master and the other is slave and they are connected with a bidirectional channel. Any data written on the slave side is forwarded to the output of the master side. Conversely, any data written on the master side is forwarded to the output of the slave.
I found another StackOverflow question that may also be of assistance. See this link. It could be adapted to suit your needs.
I've built an interface from a digital Caliper to an Arduino board.
The Arduino sends the readings from the caliper to the computer via Serial port.
The data sent over the serial port is of course fully customizable.
I now want an option that when a certain command comes over the serial port (For instance generated by a button press in the caliper) the data of the caliper will be inputed into the current Cell in Excel and the tab key pressed in order to move to the next cell.
I wanted to know what is your recommended solution? What programming language? How to send the data to Excel? How to emulate the Tab key? etc.
I eventually used the following solution:
Downloaded and installed scaleProgrammer.com Rs-232 Monitor (for free) and using it translated the incoming serial incoming data to keyboard input.
To the incoming serial data I added the TAB key at the end of every transmition, which aids in working in Excel.
I'm not sure about your reqquirement, but I hope you can use an Ethernet shield and do some PHP coding to store your output in CSV format, which later you can read using the Excel.
Please give a proper description of your requirement so you can get some good answer. Any link/pics of you tool will work.
You can try php-serial.
I'm creating a very simple application to read the info from a GPS. The information is sent on the bluetooth (COM3) in the NMEA0183 format.
Everything works good except that I can't find my position because the RMC and GGA sentence are empty. I receive other sentence with the satellite informations and positioning, but all I want is my current position (long/lat)
Here is some example of what I currently receive:
$GPZDA,,,,,,*48
$GPGGA,,,,,,,,,,,,,,*56
$GPGLL,,,,,,,*7C
$GPRMC,,,,,,,,,,,*67
$GPGST,,,,,,,,,,,,,,*57
$GPGSA,M,3,09,18,22,14,,,,,,,,,12.2,11.8,3.0*31
$GPGRS,,,,,,,,,,,,,,*51
$GPVTG,30.124,T,30.124,M,0.067,N,0.125,K*49
$GPGSV,2,1,08,22,78,283,50,18,60,137,50,14,54,281,48,09,44,052,48*7F
$GPGSV,2,2,08,46,34,212,,51,28,222,,48,12,247,,35,06,254,*74
I tried with Putty, GPS .NET 3.0.2 and my own program and the result is the same. BUT when I connect with the proprietary software called eZField, the GPS gets a fix after 20 seconds and I can see the long/lat showing. In EZField, I can't see the raw format and since it is on a pocket PC, I don't know how to sniff the bluetooth data to see if the software send any information to the GPS.
My best guest is that EZField sends some information to the GPS receiver to tell him to start sending RMC and GGA. I've read somewhere that there are "Initialization strings" that can be sent to a GPS but I can't find information about this anywhere. My GPS is a ViaSAT L1-GPS Receiver/SBAS.
Anyone can help me? :)
Thank!
It looks like your GPS doesn't have a fix yet. It is odd though that the GPS doesn't simply start searching on its own. Most initilization strings are strictly for what type of data to send back (such as the SiRFstar III proprietary format).
Pair this to your PC and run the software on it after you have started up some serial port monitoring software. That way, you can see what the init. string is, if there is one.
I use this regularly: http://www.serial-port-monitor.com/