All of lore.kernel.org
 help / color / mirror / Atom feed
* PPPd ioctl, please help!
@ 2008-05-09 17:56 rketcham
  2008-05-09 18:06 ` James Carlson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rketcham @ 2008-05-09 17:56 UTC (permalink / raw)
  To: linux-ppp


Hello,
I wrote a char driver to interface with an SPI chip which will be connected
(via UART) to a cell modem. The SPI to UART chip works pretty well so far
with custom software (I can send SMS messages for intance) but I'm having
trouble with pppd (version 2.4.4) on the Gumstix distro. 

My question is what are the ioctl commands (including the expected
responses) that I need to support in my driver.   I have included what I
think are some of the ioctl commands into the driver and when they're called
I have the driver print the variable name as defined in ioctls.h. The driver
returns 0 unless it gets TCGETS at which point it returns the baud rate
(B115200). 

WRITE!  --  pppd is writing to the driver
READ! -- pppd is reading from the driver
INTERRUPT --- New data has arrived from the modem to the SPI

Here's the driver and chat print out of when PPPd tries to connect to the
internet via the SPI :

Dec 31 16:18:10 gumstix user.info kernel: Inserting the spi_uart module.
Dec 31 16:18:23 gumstix user.info kernel: PPP generic driver version 2.4.2
Dec 31 16:18:23 gumstix daemon.notice pppd[404]: pppd 2.4.4 started by root,
uid 0
Dec 31 16:18:23 gumstix user.info kernel: Device Open: 1
Dec 31 16:18:23 gumstix user.info kernel: The minor number: 0
Dec 31 16:18:23 gumstix user.info kernel: The device has been opened.
Dec 31 16:18:23 gumstix user.info kernel: TIOCMBIS
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix user.info kernel: TCSETSF
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix user.info kernel: TCSETS
Dec 31 16:18:23 gumstix user.info kernel: TCGETS
Dec 31 16:18:23 gumstix local2.info chat[406]: send (AT^M)
Dec 31 16:18:23 gumstix user.info kernel: WRITE!
Dec 31 16:18:23 gumstix user.info kernel: WRITE!
Dec 31 16:18:23 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:23 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: Interrrupt from somewhere else.
Dec 31 16:18:24 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix user.warn kernel: 15  14  13  12  11  10  9   8   7  
6   5   4   3   2   1   0
Dec 31 16:18:24 gumstix user.warn kernel: 1   1   1   1   1   1   1   1   1  
1   0   0   0   0   0   1
Dec 31 16:18:24 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: Interrrupt from somewhere else.
Dec 31 16:18:24 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix user.warn kernel: 15  14  13  12  11  10  9   8   7  
6   5   4   3   2   1   0
Dec 31 16:18:24 gumstix user.warn kernel: 1   1   1   1   1   1   1   1   1  
1   0   0   0   0   0   1
Dec 31 16:18:24 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix local2.info chat[406]: expect (OK)
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix local2.info chat[406]: AT^M^M
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix user.info kernel: READ!
Dec 31 16:18:24 gumstix local2.info chat[406]: OK
Dec 31 16:18:24 gumstix local2.info chat[406]:  -- got it
Dec 31 16:18:24 gumstix local2.info chat[406]: send (ATD*99***1#^M)
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: Interrrupt from somewhere else.
Dec 31 16:18:24 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix user.warn kernel: 15  14  13  12  11  10  9   8   7  
6   5   4   3   2   1   0
Dec 31 16:18:24 gumstix user.warn kernel: 1   1   1   1   1   1   1   1   1  
1   0   0   0   0   0   1
Dec 31 16:18:24 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:24 gumstix user.info kernel: WRITE!
Dec 31 16:18:24 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:25 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:25 gumstix user.info kernel: INTERRUPT
Dec 31 16:18:25 gumstix user.info kernel: Interrrupt from somewhere else.
Dec 31 16:18:25 gumstix user.warn kernel:
Dec 31 16:18:25 gumstix user.warn kernel: 15  14  13  12  11  10  9   8   7  
6   5   4   3   2   1   0
Dec 31 16:18:25 gumstix user.warn kernel: 1   1   1   1   1   1   1   1   1  
1   0   0   0   0   0   1
Dec 31 16:18:25 gumstix user.warn kernel:
Dec 31 16:18:24 gumstix local2.info chat[406]: expect (CONNECT)
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix local2.info chat[406]: ^M
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix local2.info chat[406]: ATD*99***1#^M^M
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix user.info kernel: READ!
Dec 31 16:18:25 gumstix local2.info chat[406]: CONNECT
Dec 31 16:18:25 gumstix local2.info chat[406]:  -- got it
Dec 31 16:18:25 gumstix local2.info chat[406]: send (dc^M)
Dec 31 16:18:25 gumstix user.info kernel: WRITE!
Dec 31 16:18:25 gumstix user.info kernel: WRITE!
Dec 31 16:18:25 gumstix user.info kernel: WRITE!
Dec 31 16:18:25 gumstix user.info kernel: TCSETS
Dec 31 16:18:25 gumstix user.info kernel: TCGETS
Dec 31 16:18:25 gumstix daemon.info pppd[404]: Serial connection
established.
Dec 31 16:18:25 gumstix user.info kernel: TIOCMBIS
Dec 31 16:18:25 gumstix user.info kernel: TCGETS
Dec 31 16:18:25 gumstix user.info kernel: TCSETSF
Dec 31 16:18:25 gumstix user.info kernel: TIOCEXCL
Dec 31 16:18:25 gumstix user.info kernel: TIOCSETD
Dec 31 16:18:25 gumstix user.info kernel: I don't know what the hell you
just sent... 0x80047437
Dec 31 16:18:25 gumstix daemon.err pppd[404]: Couldn't attach to channel 0:
No such device or address
Dec 31 16:18:25 gumstix user.info kernel: TIOCSETD
Dec 31 16:18:25 gumstix user.info kernel: TCSETSF
Dec 31 16:18:25 gumstix user.info kernel: The device has been closed.
Dec 31 16:18:25 gumstix daemon.info pppd[404]: Exit.


My pppd options are:
usepeerdns
defaultroute
noauth
local
hide-password
noipdefault
lcp-echo-interval 30
lcp-echo-failure 4

Thanks for your help!
Rich




-- 
View this message in context: http://www.nabble.com/PPPd-ioctl%2C-please-help%21-tp17153241p17153241.html
Sent from the linux-ppp mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PPPd ioctl, please help!
  2008-05-09 17:56 PPPd ioctl, please help! rketcham
@ 2008-05-09 18:06 ` James Carlson
  2008-05-09 18:34 ` rketcham
  2008-05-09 19:33 ` James Carlson
  2 siblings, 0 replies; 4+ messages in thread
From: James Carlson @ 2008-05-09 18:06 UTC (permalink / raw)
  To: linux-ppp

rketcham writes:
> Dec 31 16:18:25 gumstix user.info kernel: TIOCSETD
> Dec 31 16:18:25 gumstix user.info kernel: I don't know what the hell you
> just sent... 0x80047437

That last one looks to me like PPPIOCGCHAN.  You're getting this
because the TIOCSETD ioctl before it didn't set N_PPP mode.

Did you implement your new device on tty_io.c, or did you just break
out in your own direction?  If it's the latter (which is consistent
with your other problems with ioctls), you might want to reconsider
doing that.

But if not, then read through the tty subsystem and figure out what
TIOCSETD does.  You need to do the same.

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PPPd ioctl, please help!
  2008-05-09 17:56 PPPd ioctl, please help! rketcham
  2008-05-09 18:06 ` James Carlson
@ 2008-05-09 18:34 ` rketcham
  2008-05-09 19:33 ` James Carlson
  2 siblings, 0 replies; 4+ messages in thread
From: rketcham @ 2008-05-09 18:34 UTC (permalink / raw)
  To: linux-ppp


Hey James,

Yea, this SPI driver was my first adventure into linux drivers so I may need
you to lead me through some of this. When I first started I thought that a
char driver would be exactly what I needed. Now it seems that I should have
created a tty driver instead but I would rather try to get around that if
it's possible and not too hard.

Given my limited experience in driver design would you recommend rewriting
the driver as a tty driver (I'm guessing this would involve interfacing with
tty_io.c) or is there another way? I was hoping to handle the ioctl myself.
Would I need to include if_ppp.h?

Thanks,
Rich



James Carlson-2 wrote:
> 
> That last one looks to me like PPPIOCGCHAN.  You're getting this
> because the TIOCSETD ioctl before it didn't set N_PPP mode.
> 
> Did you implement your new device on tty_io.c, or did you just break
> out in your own direction?  If it's the latter (which is consistent
> with your other problems with ioctls), you might want to reconsider
> doing that.
> 
> But if not, then read through the tty subsystem and figure out what
> TIOCSETD does.  You need to do the same.
> 
> -- 
> James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

-- 
View this message in context: http://www.nabble.com/PPPd-ioctl%2C-please-help%21-tp17153241p17154119.html
Sent from the linux-ppp mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PPPd ioctl, please help!
  2008-05-09 17:56 PPPd ioctl, please help! rketcham
  2008-05-09 18:06 ` James Carlson
  2008-05-09 18:34 ` rketcham
@ 2008-05-09 19:33 ` James Carlson
  2 siblings, 0 replies; 4+ messages in thread
From: James Carlson @ 2008-05-09 19:33 UTC (permalink / raw)
  To: linux-ppp

rketcham writes:
> Yea, this SPI driver was my first adventure into linux drivers so I may need
> you to lead me through some of this.

I just diagnosed the problem; you should find someone with much more
Linux tty driver experience to help you out.

> When I first started I thought that a
> char driver would be exactly what I needed. Now it seems that I should have
> created a tty driver instead but I would rather try to get around that if
> it's possible and not too hard.

I doubt that'd be very easy.  You'd have to replicate most of what
tty_io already does, and that seems fairly pointless and fragile.  Any
change to that subsystem will likely blow your driver's duplicate
logic away.

> Given my limited experience in driver design would you recommend rewriting
> the driver as a tty driver (I'm guessing this would involve interfacing with
> tty_io.c) or is there another way? I was hoping to handle the ioctl myself.
> Would I need to include if_ppp.h?

If it were mine, I'd take a look at one of the existing tty hardware
drivers (drivers/serial/21285.c looks simple enough) and use that as a
template.

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-09 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-09 17:56 PPPd ioctl, please help! rketcham
2008-05-09 18:06 ` James Carlson
2008-05-09 18:34 ` rketcham
2008-05-09 19:33 ` James Carlson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.