View Full Version : Bulding USB to serial kernel module
D-rock
11-17-2007, 05:57 PM
Okay, My goal it to get my arduino (http://www.arduino.cc/) board talking to my 770 but I'm having a hell of a time trying to build this Virtual COM Port (http://www.ftdichip.com/Drivers/VCP.htm) kernel module. Source is here (http://www.ftdichip.com/Drivers/VCP/Linux/ftdi_sio.tar.gz) if you are interested.
I think I've got scatchbox setup correctly and I've got the kernel headers installed. But when I try to build the kernel module I get this:
[sbox-SDK_ARMEL: ~/ftdi_sio.tar.gz_FILES] > KERNELDIR=/usr/src/rx-34-kernel-headers make
gcc -Wall -D__KERNEL__ -DMODULE -I/usr/src/rx-34-kernel-headers/include -I/usr/src/linux-2.6.20-16-generic/drivers/usb/serial/ -O -c -o ftdi_sio.o ftdi_sio.c
ftdi_sio.c:253:24: usb-serial.h: No such file or directory
There is a "usb-serial.c" in the kernel sources dir but no "usb-serial.h" in the kernel headers dir.
Any ideas on where to go next would be much appreciated.
jgallen23
11-27-2007, 08:49 PM
any update on this? I want my n800 to interface with my arduino as well.
D-rock
11-28-2007, 01:23 AM
I still haven't gotten the kernel modules to compile. I found a thread (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1172471904) on the arduino forums about trying to make the arduino act as a human interface device (HID). Which would remove the need for the FTDI driver but it looks like that thread has died.
My last idea is to build something like this (http://www.tinker.it/en/Products/Tastiera) to act as a fake keyboard and put it in between the arduino and my 770. But I haven't had time to look into it further.
lardman
11-28-2007, 06:12 AM
Did you read the blurb on the download page?:
Required for 2.4 kernels that require FT2232 support only. FT2232 support included in kernel 2.6.9 or greater. Developed by Bill Ryder. Instructions in ReadMe file.
All other devices included in kernel 2.4.20 or greater (see ReadMe for 232R device support).
Sounds like a kernel re-compile may produce a module that does what you want. From the instructions linked on that page (to the README.DAT) it looks like it's going to build a 2.4.x kernel module (i.e. *.o) rather than a 2.6.x module (*.ko).
fanoush
11-28-2007, 08:02 AM
For N800 with OS2008 you can try to get my archive of various modules and try to insmod the drivers/usb/ftdi_sio.ko from it.
http://fanoush.wz.cz/maemo/modules-2.2007.50-2-custom.tar.gz
For N800 with OS2007 it is here
http://fanoush.wz.cz/maemo/4.2007-usbhost-kernel.tar.gz
http://fanoush.wz.cz/maemo/4.2007-usbhost-modules.tar.gz
See also N800 usb-host thread (http://www.gossamer-threads.com/lists/maemo/developers/28711#28711) in mailing list for details.
For 770 I currently don't have ftdi_sio.ko but could make one easily if there is a need. However there is usbserial.ko and pl2303.ko in /mnt/initfs/lib/modules/current which should be enough for pl-2303 based usb to serial converters (which are fairly common in various mobile phone cables).
fanoush
11-28-2007, 09:01 AM
I have added ftdi_sio.ko to http://fanoush.wz.cz/maemo/modules-3.2006.49-2.tar.gz for 770
D-rock
11-29-2007, 06:26 PM
I have added ftdi_sio.ko to http://fanoush.wz.cz/maemo/modules-3.2006.49-2.tar.gz for 770
This worked perfectly! Thanks for your help.
jgallen23
11-29-2007, 06:53 PM
so you got it working with your arduino?
D-rock
12-04-2007, 06:31 PM
so you got it working with your arduino?
Yup. I just downloaded and extracted fanoush's modules to my 770. Then ran
#insmod drivers/usb/serial/ftdi_sio.ko
I can send and receive data over serial. I have only tested using pyserial (http://pyserial.sourceforge.net/) but it seems to work perfectly.
jgallen23
12-07-2007, 05:41 PM
anybody know if this will work with n810 or n800?
bluehash
01-05-2008, 02:24 AM
Im getting a 404 error for this file
http://fanoush.wz.cz/maemo/modules-rx-34-2.6.21.0.tar.gz
fanoush
01-05-2008, 04:15 AM
Yes, sorry, I have updated it as a part of new kernel for latest firmware, get this one
http://fanoush.wz.cz/maemo/modules-2.2007.50-2-custom.tar.gz
tuxSlayer
02-15-2008, 06:33 AM
Yes, sorry, I have updated it as a part of new kernel for latest firmware, get this one
...
Fanoush, is it possible to use your modules without custom kernel? When I trying to insmod usbserial.ko on N800 (using latest official OS image - RX-34_2008SE_2.2007.50-2_PR_COMBINED_MR0_ARM.bin) the device are just rebooting...
Maybe I've missed something, but can you give a hint how to compile ftdi_sio and usbserial for official kernel?
Thanks.
cmdowns
04-08-2008, 09:55 AM
Hello . . .is anyone still reading this thread?
I'd like to get my n800 to talk to my arduino. I'm not a developer, and I'm a total linux and arduino noob. So I didn't exactly follow the disscussion so far. Are you all attempting to port the Arduino IDE to the nokia? And if not, what type of nokia/Arduino application are you all working on?
rbrewer123
04-08-2008, 11:18 AM
I'm still getting my n810 setup at this point, but as a thought experiment, buying a 770 or n800 and interfacing to arduino or the irobot platform via serial seems like a nice way to do some mobile robotics. With the NITs you've got a lot of benefits in a very cost-effective package:
+ sound output, even speech synthesis via flite
+ ready-to-use wireless comms
+ easily runs sophisticated control logic in a high level language like python
+ nice touchscreen UI ready to use via standard toolkits
+ good battery life
+ small form-factor
+ webcam for additional sensing on n800
Personally I would try to minimize the amount of code I had to write for arduino, using it as a "dumb" interface board and writing most stuff in python or something similar on the NIT. That also makes it easier to "stub out" the arduino and do testing on a desktop box.
cmdowns
04-08-2008, 11:47 AM
Hmmmmm. . .I guess I'm not really clear on what your setup would entail. It sounds like you maybe would want to enterface the tablet and arduino, and then have the the two talking to each other via a preestablished program. Like maybe you build a robot, and then attach both the tablet and arduino to said robot, then the table is like the big brain for the robot and it sends instructions to the arduino.
Does that sound similar to what you had in mind?
qwerty12
04-08-2008, 11:49 AM
I don't know if this would help:
http://blog.locationist.net/2008/03/16/arduino-interaction/
rbrewer123
04-08-2008, 04:47 PM
Hmmmmm. . .I guess I'm not really clear on what your setup would entail. It sounds like you maybe would want to enterface the tablet and arduino, and then have the the two talking to each other via a preestablished program. Like maybe you build a robot, and then attach both the tablet and arduino to said robot, then the table is like the big brain for the robot and it sends instructions to the arduino.
Does that sound similar to what you had in mind?
Yes... exactly. The arduino can control servo motors and things, like in qwerty12's link. So the NIT might command the arduino "servo position 120" and arduino does it. Arduino might provide sensor readings to the NIT like "ultrasound sensor reading 20".
Here's a much more complicated example with the irobot create:
http://www.instructables.com/id/ServerBot---for-serving-food-and-drinks/
http://www.instructables.com/id/S34USUFF5Y3YQT8/
The NIT could replace items like the speech synthesizer (with flite) and xbee radio link (with wifi or bluetooth) and provide some convenient interface buttons.
cmdowns
04-09-2008, 01:55 PM
Yes... exactly. The arduino can control servo motors and things, like in qwerty12's link. So the NIT might command the arduino "servo position 120" and arduino does it. Arduino might provide sensor readings to the NIT like "ultrasound sensor reading 20".
Here's a much more complicated example with the irobot create:
http://www.instructables.com/id/ServerBot---for-serving-food-and-drinks/
http://www.instructables.com/id/S34USUFF5Y3YQT8/
The NIT could replace items like the speech synthesizer (with flite) and xbee radio link (with wifi or bluetooth) and provide some convenient interface buttons.
That sound pretty cool and certainly feasible. Although, I am a true noob when it comes to all this stuff, so I honestly don't know for sure.
Do you have any idea if the Arduino BT could be made to communicate with the tablet via Bluetooth?
rbrewer123
04-10-2008, 12:11 AM
I'm still a bit of a noob too, but it sounds like the Arduino BT uses the bluetooth serial port profile (SPP) and there seem to be other references that SPP is supported on maemo. So I would say that it sounds doable.
cmdowns
04-10-2008, 06:26 AM
I was wondering if it would be possible to use the nokia as a transmitter (via bluetooth) and the arduino bt as a receiver, and use that set up as a diy RC system.
I'm not sure what the best way to send info to the arduino, other than it needing it to be serial. I wonder what app on the nokia would be simplest to send out some serial instructions through the nokia's bt. And I don't really know how the arduino bt works.
From what I understand, the arduino IDE (running on a terminal on some machine) can send and receive info from the arduino bt. But something tells me that this is not the best way to set up controlling the arduino. It seems like it would require constant reprogramming in the IDE, which in turn would require the time involved in recompiling and reuploading to the uC.
It seems like most of the folks out there that have gotten the nokia to talk to the arduino have done so using Python. I don't know anything about Python, but I am willing to learn.
Is there any reason that setting up the serial communication through bt couldn't work with the nokia-as-super-robot-brain idea? Obviously, one would loose some of the functionality described before, such as the nokia's camera and voice synthesis capabilities (or lose them as a useful feature on the robot).
However, if one could use the bt to communicate between the nokia and the arduino, and retain the nokia's role as the superlogic that interprets the info it gets from the arduino, that might be interesting.
rbrewer123
04-10-2008, 03:04 PM
I think you have a nice idea. I don't see any reason why the superbrain wouldn't work over bluetooth. The only gotcha is that there is one more thing (bluetooth) to configure and get working before you see anything happen.
Here's some example code that opens a bluetooth serial connection:
http://wiki.bluez.org/wiki/HOWTO/SerialConnections
I think the "device" it mentions is going to be something like "/dev/rfcomm0" on the NIT. Once the example code has created that, then you need a program to use it. Probably a terminal program like minicom or something would be good to start with. Then you could try stuff out just by typing in the window and see any responses the arduino sends back.
Later you start writing your "brain" program that does commands automatically.
One thing to mention... I think it's very important to take baby steps in a project like this with a lot of unfamiliar stuff. For example... Hook up arduino and get the simplest thing to happen with the IDE. Make an LED flash with the arduino or something. Fiddle with bluetooth serial and make the simplest thing happen so you know it's working. etc...
cmdowns
04-11-2008, 10:00 AM
I think you have a very good point about baby steps, taking things slowly etc.
So, if one wished to hook up the tablet to the arduino and send the most basic serial info from the tablet to the arduino, where would on start? Does one need to do anything fancy to get the tablet to send serial info over the usb port?
It sound like maybe that was the inital subject of this thread. Does anyone know if any progress was made?
D-rock
04-11-2008, 01:49 PM
I think you have a very good point about baby steps, taking things slowly etc.
So, if one wished to hook up the tablet to the arduino and send the most basic serial info from the tablet to the arduino, where would on start? Does one need to do anything fancy to get the tablet to send serial info over the usb port?
It sound like maybe that was the inital subject of this thread. Does anyone know if any progress was made?
I was able to talk to my arduino over serial from my 770 (See my post on page 1). You'll need a USB power injector (http://tabletblog.com/2006/01/usb-power-injector-2.html) because the 770 wasn't meant to be used as a USB host. Then use the FTDI driver fanoush complied on the first page of this thread.
In my project I used vnc to connect to the 770 over wifi. Then when I pressed the up key in the vncviwer the 770 would send a command to the arduino over serial which would turn on 2 motor controllers.
Below is the simple python code that I used to talk to the ardino. It uses pygame to see when a key is pressed and pyserial to send commands to the arduino.
import serial
import time
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Pygame Caption')
pygame.mouse.set_visible(0)
done = False
ser = serial.Serial('/dev/tty.usbserial-A4001u0a', 9600, timeout = 1)
while not done:
for event in pygame.event.get():
if (event.type == KEYUP) or (event.type == KEYDOWN):
print event
if (event.key == K_ESCAPE):
done = True
elif (event.key == K_UP):
if (event.type == KEYUP):
ser.write('1')
else:
ser.write('0')
#print ser.readlines()
elif (event.key == K_DOWN):
if (event.type == KEYUP):
ser.write('3')
else:
ser.write('2')
If you are new to python check out http://diveintopython.org/. It is a great free online book about the basics of python. Also check out the pygame and pyserial tutorials.
Here is the arduino sketch I used:
/*Messing around with pygame and motor controller */
#define pwmPin 9
#define dirPin 10
#define forwardDown 48
#define forwardUp 49
#define backDown 50
#define backUp 51
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
pinMode(pwmPin, OUTPUT); // sets the digital pin as output
pinMode(dirPin, OUTPUT);
}
void loop() // run over and over again
{
if (Serial.available() > 0) {
// read the incoming byte:
int incSerialByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.print(incSerialByte, DEC);
if(incSerialByte == forwardDown)
{
analogWrite(pwmPin, 255);
Serial.println(" forwardDown");
}
else if(incSerialByte == forwardUp)
{
analogWrite(pwmPin, 0);
Serial.println(" forwardUp");
}
else if(incSerialByte == backDown)
{
digitalWrite(dirPin, HIGH);
analogWrite(pwmPin, 255);
Serial.println(" backDown");
}
else if(incSerialByte == backUp)
{
digitalWrite(dirPin, LOW);
analogWrite(pwmPin, 0);
Serial.println(" backUp");
}
}
}
A final note, I wouldn't try to get the arduino ide working on the 770. I think that is going to be a lot of work for nothing. You will need to get java and a bunch of c libraries working on the 770. Use your desktop to develop and send your sketches to the arduino. Then just talk to the the arduino over serial from the 770.
rbrewer123
04-11-2008, 02:10 PM
Great post! Very clear and useful.
cmdowns
04-19-2008, 04:23 PM
I promise I am making a good faith effort to figure this stuff out on my own. I appreciate all the assistance that I get from the various users on this forum.
I am trying to implement the instructions laid out in D-rock's post#24. Unfortunately, I'm not making much progress.
I have installed pySerial on my n800 (OS2008). I have copied and pasted D-rock's Python code into my pyGTKEditor and attempted to run it from there. This is what I get back:
/usr/bin/python_serial.py:4: RuntimeWarning: import cdrom: No module named cdrom
import pygame
/usr/bin/python_serial.py:4: RuntimeWarning: import joystick: No module named joystick
import pygame
Traceback (most recent call last):
File "/usr/bin/python_serial.py", line 14, in <module>
ser = serial.Serial('/dev/tty.usbserial-A4001u0a', 9600, timeout = 1)
File "/usr/bin/serial/serialutil.py", line 156, in __init__
self.open()
File "/usr/bin/serial/serialposix.py", line 141, in open
raise SerialException("Could not open port: %s" % msg)
serial.serialutil.SerialException: Could not open port: [Errno 2] No such file or directory: '/dev/tty.usbserial-A4001u0a'
Press ENTER to continue ...
Honestly, I don't even know what this means. But I get the impression that it means that the code isn't running correctly. Can any benevolent guru out there give me an idea what I am doing wrong and what I need to do in order to make this code run on my tablet? I will be eternally grateful.
jethro.itt
04-20-2008, 03:34 AM
ser = serial.Serial('/dev/tty.usbserial-A4001u0a', 9600, timeout = 1)
Honestly, I don't even know what this means. But I get the impression that it means that the code isn't running correctly.
Looks like D-rock's example directly references a serial port device under /dev. Unless you have the exactly same brand and model of USB-to-Serial adapter, the device name under /dev is different.
There are ways to find out which name the adapter has. I would look kernel messages after plugging in the device, i.e. typing dmesg on the shell prompt. There will be a lot of kernel output and the last few lines should mention something about a new USB device.
valtersboze
05-06-2008, 09:50 AM
ok, so you`ve been able to send messages to arduino. but can you receive messages like voltage? at a high speed? my aim is to create a multi channel voltmeter api and use it in Adobe Flash (preferred). is it even possible to receive volt measurements over arduino-> NIT serial connection? I need the 4channel data at least at 5-10 frames per second.. sounds possible?
jethro.itt
05-06-2008, 02:38 PM
is it even possible to receive volt measurements over arduino-> NIT serial connection? I need the 4channel data at least at 5-10 frames per second.. sounds possible?
4 channels * 10 samples/s * 2 bytes/sample/channel = 80 bytes/s
That's a very low amount of data, well within the capabilities of Arduino and the USB-to-Serial connection.
Disclaimer: I've never used Arduino myself, but I deal with microcontrollers daily. Atmel AVRs too, sometimes (it's what the Arduino is based on).
cmdowns
05-06-2008, 04:43 PM
I'm really glad this thread is still active. I'm still tyring to replicate D-rock's project as described in post 24 (http://www.internettablettalk.com/forums/showpost.php?p=168499&postcount=24). With the somewhat minor exception that I am using an n800 as opposed to the 770 he refers to.
My question is, do I still need to use the power injector as he describes:
I was able to talk to my arduino over serial from my 770 (See my post on page 1). You'll need a USB power injector (http://tabletblog.com/2006/01/usb-power-injector-2.html) because the 770 wasn't meant to be used as a USB host.
I've been reading up on the n8xx's USB host mode, and it seems it doesn't have too much problem supplying power to things like USB keys. Can anyone tell me if the n800 can supply enough power to run an Arduino?
Thanks in advance for the consideration.
Benson
05-06-2008, 04:47 PM
I don't know if it's enough power, but the 770 supplies no power; hence power injectors for anything. The N800 supplies some power, so it may work; if not, a powered hub is usually the best choice.
D-rock
05-07-2008, 03:24 PM
I didn't know the n800 could supply some power. I would suggest you switch the ardunio to external power instead of powering it off of usb. I would guess that it would then be possible to use the ardunio with the n800 without a power injector but I don't have an n800. So I can't test this.
valtersboze
05-19-2008, 08:55 PM
cmdowns, can you please tell me how do you install pyserial on n810??????? it says no such module "serial". but i guess i havent installed python serial. when i write "python setup.py install" it says i dont have some distutils.core or smth. wtf.
valtersboze
05-20-2008, 06:53 AM
i have python2.5, n810, latest soft.
doing python setup.py install throws an error
ImportError: No module named distutils.core
do i have to reinstall python? is there any other way that i could read the serial data?
one site suggested "screen /dev/ttyUSB0 9600", but screen is also not installed on n810, and typing just "/dev/ttyUSB0 9600" throws permission denied.
jethro.itt
05-20-2008, 08:08 AM
is there any other way that i could read the serial data?
one site suggested "screen /dev/ttyUSB0 9600", but screen is also not installed on n810, and typing just "/dev/ttyUSB0 9600" throws permission denied.
You can use stty to set serial port parameters and cat to echo characters on screen (unidirectional only, typed characters will not be echoed back to serial port):
$ stty -F /dev/ttyUSB0 9600 raw
$ cat /dev/ttyUSB0
Having said that, here's what it says on pySerial home page (http://pyserial.sourceforge.net/):
The files in this package are 100% pure Python. They depend on non standard but common packages on Windows (win32all) and Jython (JavaComm). POSIX (Linux, BSD) uses only modules from the standard Python distribution)
It should be possible to copy the serial directory of pySerial to your own project directory and import from there. Only three of the files in serial are really required on Linux:
myprog/
serial/
__init__.py
serialposix.py
serialutil.py
myprog.py
Disclaimer: I have not tested this on an actual N8x0. EDIT: Tested on an N810, works fine.
valtersboze
05-20-2008, 09:47 AM
ok, im total noob. i guess you didnt write "python setup.py install"? anyways that wont work for me.
i copied miniterm.py one directory up from examples, so i write "python miniterm.py -port/dev/ttyUSB0", it throws "could not open port" but i guess it means the python side works ok?
as for the code
"$ stty -F /dev/ttyUSB0 9600 raw
$ cat /dev/ttyUSB0"
it works wonderfully outputing all my serial output! thanks!
valtersboze
05-20-2008, 09:52 AM
ok i didnt get the python script working, but my nokia gets the serial data from Arduino! btw, n810 powers the device by itself, no injector required. Though i will add external power source, since i`m going to attach a lot of stuff to Arduino!
jethro.itt
05-20-2008, 02:04 PM
i guess you didnt write "python setup.py install"? anyways that wont work for me.
No, I just moved the serial directory under the examples directory and tested some of the examples.
i copied miniterm.py one directory up from examples, so i write "python miniterm.py -port/dev/ttyUSB0", it throws "could not open port" but i guess it means the python side works ok?
The syntax is:
$ python miniterm.py --port=/dev/ttyUSB0
as for the code
...
it works wonderfully outputing all my serial output! thanks!
Good to hear!
valtersboze
05-20-2008, 03:40 PM
The syntax is:
$ python miniterm.py --port=/dev/ttyUSB0
oh comon, you`re like jesus! it works perfectly, THANK YOU SO MUCH!!!
cmdowns
05-28-2008, 07:56 AM
I'm sorry I missed the action in this thread over the last week, particularly when valtersboz asked for my assistance with PySerial. It's not often that I can be on the giving end of info in this forum.
But it looks like several people are making good progress interfacing their nokias and arduinos. Last night I finally got D-rock's scripts to work and my arduino can receive serial from the nokia's usb.
I haven't developed any application of this yet, but I intend to use it to control a couple of motors driving some small wheels. I'll be using some simple h-bridges to control the motor. After I get my this working with the usb cable, I plan on switching to a bluetooth connection and eliminate the wiring between the nokia and the arduino.
I'd like to hear what other people are doing with their nokia/arduino set up and what progress they're making. Particularly, I'd like to hear about how people are getting the nokia to receive serial from the arduino and what they intend to do with that.
valtersboze
05-28-2008, 09:00 AM
I use this to build a display for my car, since i dont have obd2 port. i started discussion at http://www.internettablettalk.com/forums/showthread.php?t=19671
Currently i have Flash talking to Arduino using python proxy. havent gotten this to work with AS2, but AS3 works. there are definitely problems with Flash > Firmata > Arduino. i`m trying Actionscript2 to get working with xmlsocket, since i`m pretty new to AS3 and dont have time to learn it..
Bluetooth version is also welcome, but for now there are too many problems with current setup to deal with..
cmdowns
05-28-2008, 11:57 AM
I use this to build a display for my car, since i dont have obd2 port. i started discussion at http://www.internettablettalk.com/forums/showthread.php?t=19671
Currently i have Flash talking to Arduino using python proxy. havent gotten this to work with AS2, but AS3 works. there are definitely problems with Flash > Firmata > Arduino. i`m trying Actionscript2 to get working with xmlsocket, since i`m pretty new to AS3 and dont have time to learn it..
Bluetooth version is also welcome, but for now there are too many problems with current setup to deal with..
Am I correct in interpreting that you are trying to make a diy obd for your car?
valtersboze
05-28-2008, 04:15 PM
well kind of.. part of analog inputs will be bound to car ECU pinouts, other part to external sensors, since i haven`t got oil pressure and temp sensors on car by default..
cmdowns
06-06-2008, 09:48 AM
I have finally succeeded in replicating D-rock's project (http://www.internettablettalk.com/forums/showpost.php?p=168499&postcount=24). I used his Python code with no changes other than reducing the display size to half. And I used Fanoush's drivers (http://www.internettablettalk.com/forums/showpost.php?p=101312&postcount=5), specifically his ftdi_sio.ko and usbserial.ko drivers. In addition, I had to download and install pySerial (http://pyserial.sourceforge.net/). This was all almost exactly as D-rock had specified.
I connected my Arduino Diecimila to both my laptop running Ubuntu and my n800 with identical results. To work on the n800, i used the mini-usb to type A usb OTG adapter that jolouis produced (http://www.internettablettalk.com/forums/showpost.php?p=133753&postcount=1).
Instead of using D-rock's Arduino code as-is, I modified it to control an h-bridge (http://itp.nyu.edu/physcomp/Labs/DCMotorControl) chip that is controlling a couple of small fa-130 motors in a gearbox made by Tamiya (http://www.tamiyausa.com/product/item.php?product-id=70168). The code in incredibly simple, so I won't bother to post it. But if anyone wants to see it, just let me know.
Soooo. . .now I want to do a couple of things. I want to replace the serial cable with a Bluetooth connection, most likely using a bt device made by Sparkfun, such as their DIP module (http://www.sparkfun.com/commerce/present.php?p=The%20DIP) or their Blue SMiRF (http://www.sparkfun.com/commerce/present.php?p=Blue%20SMiRF).
And I want to alter D-rock's python code to register a couple more buttons, specifically the L and R buttons on the n800's d-pad.
At this point I'm just fishing for useful info. For example, can anyone tell me what it will take for the n800 to send the serial data to the Arduino via BT? And can anyone experienced with Pygame tell me how to modify the code to recognize the L and R buttons on the d-pad as event cues?
I'd like to thank everyone who has contributed to this thread, as well as all the other helpful users in this forum. In particular, I'd like to thank D-rock for posting the step-by-step info that allowed me to replicate what he had had already done.
valtersboze
06-06-2008, 10:26 AM
doesnt the bluetooth module work like serial? someone mentioned that it might work, no idea. just try to direct python code to bluetooth port (device). i`m still doing a lot of things with n810 + flash + arduino and bluetooth priority is way too low for now, but definitely on the list!
kudos for great writeup with links, it will definitely help others!
jethro.itt
06-06-2008, 02:00 PM
At this point I'm just fishing for useful info. For example, can anyone tell me what it will take for the n800 to send the serial data to the Arduino via BT?
Bluetooth readily provides a cable-free replacement for a standard serial port. From a low-level point of view there are similarities to how USB devices emulate a serial port.
You can use the stand-alone rfcomm program to create a virtual serial port attached to a device, which is automatically connected when a program requires serial port access. You create such a virtual serial port with the bind command of rfcomm. Sadly, rfcomm is not included in the tablet by default, you need to install package bluez-utils-test yourself.
You don't necessarily need a virtual serial port. PyBluez can directly connect to RFCOMM ports of Bluetooth devices. See the PyBluez-provided rfcomm-client.py (http://code.google.com/p/pybluez/source/browse/trunk/examples/simple/rfcomm-client.py) for a working example.
valtersboze
06-08-2008, 03:16 AM
a bit offtopic, but can anyone help out with two things?
1. write a script that would do insmod operations on tablet startup (i dont know linux much, please be kind) and maybe also go in usb host mode. i guess insmod operations also require "sudo gainroot"?
2. write a script that would start a python program as soon as the arduino is connected to /dev/ttyUSB0 (like with usb flash drive - as soon as you insert flash drive the file manager is started)
st5150
07-03-2008, 11:47 PM
For N800 with OS2008 you can try to get my archive of various modules and try to insmod the drivers/usb/ftdi_sio.ko from it.
http://fanoush.wz.cz/maemo/modules-2.2007.50-2-custom.tar.gz
For N800 with OS2007 it is here
http://fanoush.wz.cz/maemo/4.2007-usbhost-kernel.tar.gz
http://fanoush.wz.cz/maemo/4.2007-usbhost-modules.tar.gz
See also N800 usb-host thread (http://www.gossamer-threads.com/lists/maemo/developers/28711#28711) in mailing list for details.
For 770 I currently don't have ftdi_sio.ko but could make one easily if there is a need. However there is usbserial.ko and pl2303.ko in /mnt/initfs/lib/modules/current which should be enough for pl-2303 based usb to serial converters (which are fairly common in various mobile phone cables).
Anyone know if the OS2008 usb to serial .ko's here work with Diablo ?
fanoush
07-04-2008, 01:09 AM
Most probably yes, just try. Diablo kernel has same version as before. There are only with few additional patches/bugfixes. Those patches should not affect buiding most/all external modules.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.