[linux-usb-devel] [RFC] g_serial: Real tty device passthrough.
felipebalbi at users.sourceforge.net
Fri Mar 9 20:25:58 CET 2007
Hello Again Stefan
On 3/9/07, Stefan Schmidt <stefan at datenfreihafen.org> wrote:
> [added cc's again]
> On Fri, 2007-03-09 at 14:19, Felipe Balbi wrote:
> > On 3/8/07, Stefan Schmidt <stefan at datenfreihafen.org> wrote:
> > >
> > >We have a linux smartphone here with the GSM modem on /dev/ttySAC0 .
> > >As now like to make this tty available to the host through g_serial.
> > >This allows us faster development and testing.
> > Ok, this can be done but g_serial was developed to use Major number
> > 127... I don't know that you could just pass another device to the
> > module
> You can't. That was just the idea. Sorry for confusing you.
Don't worry :-D
We're now getting there
> > you should write some glue module between g_serial and your
> > "GSM" module. And maybe you should modify g_serial a little bit for
> > this to work fine.
> I had two points asking here for suggestion:
> 1. Ask if code for something like this exists that we can use instead
> reinvent the wheel.
I don't think that we already have this implemented. So, this one is discarded.
> 2. Ask about opinions and suggestions for doing this in an elegant
> way. We don't like to write throw-away code. It should go into
> mainline and also be used for other projects.
> Just to get it right. You suggest to extend g_serial for communication
> with another driver and write some glue which communicates with
> g_serial on the one and ttySAC0 on the other side?
> I could life with that solution, but why not extend g_serial with a
> paramter to communicate directly with another tty?
Yep... this could be done... actually it's not that difficult, check
the code here:
#define GS_MAJOR 127
#define GS_MINOR_START 0
I think the first test here is to change this two defines for you
MAJOR and MINOR numbers, the ones for /dev/ttySACx
After that, if this is working... you could:
module_param(major, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(major, "Sets the Major Number for the tty port");
module_param(minor, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(minor, "Sets the Minor Number for the tty port");
And then you test it again.
Maybe you'll need some other work for this to work fine... I'll be
reading Samsung's s3c2410 serial code to check how to connect them...
Also, I'll try to take a look at the openmoko project and see what are
you guys doing...
Please let me know if this is working or not...
> > If you could show us some of the code that creates the /dev/ttySAC0
> > maybe we could point you something.
> It's the standard tty driver for this SoC (s3c2410). The GSM part of
> the phone is connected to the main CPU through a standard serial
> connection on the PCB. Nothing fancy.
If it's a standard TTY protocol I'm pretty sure the above suggestions
will work... :-)
I think g_serial is not Ok with standard tty terminals... it's more
reliable with ACM terminals... so maybe you should check this too...
Please, again, let me know about your test results :-)
> > Which smartphone are you using? Which model? Manufacturer? Which
> > linux-kernel? etc...
> It's the Neo1973 smartphone. First device using the OpenMoko open
> source mobile stack. http://openmoko.org/
> Atm we are running 18.104.22.168 and tracking newer versions. Harald Welte
> is already working with Ben Dooks to get some patches for the samasung
> SoC upstream. Other will follow once they are stable and we cleaned
> them up. You can track them here: (euilt patchset in svn)
I'm checking the above URLS
> > >modprobe g_serial device=ttySAC0
> > This you should implement... g_serial doesn't yet have a way for
> > Major/Minor number changing...
> Yeah, that was the idea. Main question was how to do this in an
> elegant way.
Once you set-up the major and minor parameters (and variables) you
should change the entire GS_MAJOR and GS_MINOR_START calling to use
the new variables...
Let us know about it :-D
felipebalbi at users.sourceforge.net
More information about the openmoko-kernel