All of lore.kernel.org
 help / color / mirror / Atom feed
* Plug and play for a tty line disciple networking device
@ 2013-03-19 15:30 jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
       [not found] ` <CAKON4OxNV85-J8C-hodpq9pY5tRCT+7aYa=m4T3Vk04XSGhOrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: jonsmirl-Re5JQEeQqe8AvxtiuMwx3w @ 2013-03-19 15:30 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Alan Ott

How can you achieve plug and play for a ft2232 based USB serial device
implementing 802.15.4 networking?

The device has a 802.15.4 SOC with a UART attached to a ft2232. With
firmware loaded the only thing it can do is talk the 802.15.4 tty line
discipline, it is not a general purpose serial port.

Right now the device works by plugging it in and it appears as a
generic USB serial device like ttyUSB0. You then run a user space app
which sets the line discipline, holds the port open and attaches it to
the 6lowpan implementation in the networking code. But doing that is
inconvenient and users needs to be trained to do it. Much simpler if
we could just plug the device in and it worked.

We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
possible to make a kernel driver that see this ID, sets the line
discipline and wires the serial port directly into the networking
code? There is already a driver in the 6lowpan code that turns the
line discipline into a net device. In this case there is no need for
the ttyUSB0 device to appear in user space.

--
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Plug and play for a tty line disciple networking device
       [not found] ` <CAKON4OxNV85-J8C-hodpq9pY5tRCT+7aYa=m4T3Vk04XSGhOrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-20 23:26   ` Greg KH
  2013-03-21  0:04     ` jonsmirl
  0 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2013-03-20 23:26 UTC (permalink / raw)
  To: jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Alan Ott

On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> How can you achieve plug and play for a ft2232 based USB serial device
> implementing 802.15.4 networking?
> 
> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
> firmware loaded the only thing it can do is talk the 802.15.4 tty line
> discipline, it is not a general purpose serial port.
> 
> Right now the device works by plugging it in and it appears as a
> generic USB serial device like ttyUSB0. You then run a user space app
> which sets the line discipline, holds the port open and attaches it to
> the 6lowpan implementation in the networking code. But doing that is
> inconvenient and users needs to be trained to do it. Much simpler if
> we could just plug the device in and it worked.
> 
> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
> possible to make a kernel driver that see this ID, sets the line
> discipline and wires the serial port directly into the networking
> code?

Yes, you can do that.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-20 23:26   ` Greg KH
@ 2013-03-21  0:04     ` jonsmirl
       [not found]       ` <CAKON4Oz+2DfzeOcvmKgi3ADAtyC5ie5-22uUQdfH_gcqeaDSYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: jonsmirl @ 2013-03-21  0:04 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial, Alan Ott

On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>> How can you achieve plug and play for a ft2232 based USB serial device
>> implementing 802.15.4 networking?
>>
>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>> discipline, it is not a general purpose serial port.
>>
>> Right now the device works by plugging it in and it appears as a
>> generic USB serial device like ttyUSB0. You then run a user space app
>> which sets the line discipline, holds the port open and attaches it to
>> the 6lowpan implementation in the networking code. But doing that is
>> inconvenient and users needs to be trained to do it. Much simpler if
>> we could just plug the device in and it worked.
>>
>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>> possible to make a kernel driver that see this ID, sets the line
>> discipline and wires the serial port directly into the networking
>> code?
>
> Yes, you can do that.

Is there an existing driver in the kernel that does this?
So far all of the ones I've checked still need a user space app.

>
> greg k-h



--
Jon Smirl
jonsmirl@gmail.com

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

* Re: Plug and play for a tty line disciple networking device
       [not found]       ` <CAKON4Oz+2DfzeOcvmKgi3ADAtyC5ie5-22uUQdfH_gcqeaDSYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-21  0:14         ` Greg KH
  2013-03-21  0:25           ` jonsmirl
  2013-03-21  0:25           ` Marcel Holtmann
  0 siblings, 2 replies; 16+ messages in thread
From: Greg KH @ 2013-03-21  0:14 UTC (permalink / raw)
  To: jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Alan Ott

On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> > On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> >> How can you achieve plug and play for a ft2232 based USB serial device
> >> implementing 802.15.4 networking?
> >>
> >> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
> >> firmware loaded the only thing it can do is talk the 802.15.4 tty line
> >> discipline, it is not a general purpose serial port.
> >>
> >> Right now the device works by plugging it in and it appears as a
> >> generic USB serial device like ttyUSB0. You then run a user space app
> >> which sets the line discipline, holds the port open and attaches it to
> >> the 6lowpan implementation in the networking code. But doing that is
> >> inconvenient and users needs to be trained to do it. Much simpler if
> >> we could just plug the device in and it worked.
> >>
> >> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
> >> possible to make a kernel driver that see this ID, sets the line
> >> discipline and wires the serial port directly into the networking
> >> code?
> >
> > Yes, you can do that.
> 
> Is there an existing driver in the kernel that does this?
> So far all of the ones I've checked still need a user space app.

Look at the bluetooth drivers, they have their own line dicipline I
think.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  0:14         ` Greg KH
@ 2013-03-21  0:25           ` jonsmirl
  2013-03-21  0:38             ` Greg KH
  2013-03-21  0:25           ` Marcel Holtmann
  1 sibling, 1 reply; 16+ messages in thread
From: jonsmirl @ 2013-03-21  0:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial, Alan Ott

On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
>> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> > On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>> >> How can you achieve plug and play for a ft2232 based USB serial device
>> >> implementing 802.15.4 networking?
>> >>
>> >> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>> >> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>> >> discipline, it is not a general purpose serial port.
>> >>
>> >> Right now the device works by plugging it in and it appears as a
>> >> generic USB serial device like ttyUSB0. You then run a user space app
>> >> which sets the line discipline, holds the port open and attaches it to
>> >> the 6lowpan implementation in the networking code. But doing that is
>> >> inconvenient and users needs to be trained to do it. Much simpler if
>> >> we could just plug the device in and it worked.
>> >>
>> >> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>> >> possible to make a kernel driver that see this ID, sets the line
>> >> discipline and wires the serial port directly into the networking
>> >> code?
>> >
>> > Yes, you can do that.
>>
>> Is there an existing driver in the kernel that does this?
>> So far all of the ones I've checked still need a user space app.
>
> Look at the bluetooth drivers, they have their own line dicipline I
> think.

Bluetooth drivers use line discipline on UARTs. On USB they have their
own set of Bluetooth descriptors.

CAN over serial has a line discipline but it needs a user space app.


>
> greg k-h



--
Jon Smirl
jonsmirl@gmail.com

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  0:14         ` Greg KH
  2013-03-21  0:25           ` jonsmirl
@ 2013-03-21  0:25           ` Marcel Holtmann
  2013-03-21  0:30             ` jonsmirl
  1 sibling, 1 reply; 16+ messages in thread
From: Marcel Holtmann @ 2013-03-21  0:25 UTC (permalink / raw)
  To: Greg KH; +Cc: jonsmirl, linux-usb, linux-serial, Alan Ott

Hi Greg,

>>>> How can you achieve plug and play for a ft2232 based USB serial device
>>>> implementing 802.15.4 networking?
>>>> 
>>>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>>>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>>>> discipline, it is not a general purpose serial port.
>>>> 
>>>> Right now the device works by plugging it in and it appears as a
>>>> generic USB serial device like ttyUSB0. You then run a user space app
>>>> which sets the line discipline, holds the port open and attaches it to
>>>> the 6lowpan implementation in the networking code. But doing that is
>>>> inconvenient and users needs to be trained to do it. Much simpler if
>>>> we could just plug the device in and it worked.
>>>> 
>>>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>>>> possible to make a kernel driver that see this ID, sets the line
>>>> discipline and wires the serial port directly into the networking
>>>> code?
>>> 
>>> Yes, you can do that.
>> 
>> Is there an existing driver in the kernel that does this?
>> So far all of the ones I've checked still need a user space app.
> 
> Look at the bluetooth drivers, they have their own line dicipline I
> think.

yes we do. And we also have a userspace tool (hciattach) to setup the line discipline. However the automatic setup can be easily automated with a simple udev rule.

Regards

Marcel


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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  0:25           ` Marcel Holtmann
@ 2013-03-21  0:30             ` jonsmirl
  0 siblings, 0 replies; 16+ messages in thread
From: jonsmirl @ 2013-03-21  0:30 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Greg KH, linux-usb, linux-serial, Alan Ott

On Wed, Mar 20, 2013 at 8:25 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Greg,
>
>>>>> How can you achieve plug and play for a ft2232 based USB serial device
>>>>> implementing 802.15.4 networking?
>>>>>
>>>>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>>>>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>>>>> discipline, it is not a general purpose serial port.
>>>>>
>>>>> Right now the device works by plugging it in and it appears as a
>>>>> generic USB serial device like ttyUSB0. You then run a user space app
>>>>> which sets the line discipline, holds the port open and attaches it to
>>>>> the 6lowpan implementation in the networking code. But doing that is
>>>>> inconvenient and users needs to be trained to do it. Much simpler if
>>>>> we could just plug the device in and it worked.
>>>>>
>>>>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>>>>> possible to make a kernel driver that see this ID, sets the line
>>>>> discipline and wires the serial port directly into the networking
>>>>> code?
>>>>
>>>> Yes, you can do that.
>>>
>>> Is there an existing driver in the kernel that does this?
>>> So far all of the ones I've checked still need a user space app.
>>
>> Look at the bluetooth drivers, they have their own line dicipline I
>> think.
>
> yes we do. And we also have a userspace tool (hciattach) to setup the line discipline. However the automatic setup can be easily automated with a simple udev rule.

Doesn't hciattach have to hang around as a process holding the tty device open?


>
> Regards
>
> Marcel
>



--
Jon Smirl
jonsmirl@gmail.com

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  0:25           ` jonsmirl
@ 2013-03-21  0:38             ` Greg KH
  2013-03-21  0:49               ` jonsmirl
  0 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2013-03-21  0:38 UTC (permalink / raw)
  To: jonsmirl; +Cc: linux-usb, linux-serial, Alan Ott

On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl@gmail.com wrote:
> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
> >> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> >> > On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
> >> >> How can you achieve plug and play for a ft2232 based USB serial device
> >> >> implementing 802.15.4 networking?
> >> >>
> >> >> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
> >> >> firmware loaded the only thing it can do is talk the 802.15.4 tty line
> >> >> discipline, it is not a general purpose serial port.
> >> >>
> >> >> Right now the device works by plugging it in and it appears as a
> >> >> generic USB serial device like ttyUSB0. You then run a user space app
> >> >> which sets the line discipline, holds the port open and attaches it to
> >> >> the 6lowpan implementation in the networking code. But doing that is
> >> >> inconvenient and users needs to be trained to do it. Much simpler if
> >> >> we could just plug the device in and it worked.
> >> >>
> >> >> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
> >> >> possible to make a kernel driver that see this ID, sets the line
> >> >> discipline and wires the serial port directly into the networking
> >> >> code?
> >> >
> >> > Yes, you can do that.
> >>
> >> Is there an existing driver in the kernel that does this?
> >> So far all of the ones I've checked still need a user space app.
> >
> > Look at the bluetooth drivers, they have their own line dicipline I
> > think.
> 
> Bluetooth drivers use line discipline on UARTs. On USB they have their
> own set of Bluetooth descriptors.
> 
> CAN over serial has a line discipline but it needs a user space app.

In your driver, just attach the line discipline directly to the tty
device you create.  You will not be using the "normal" usb-serial logic
at all if you do this, but you should be fine, right?

greg k-h

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  0:38             ` Greg KH
@ 2013-03-21  0:49               ` jonsmirl
       [not found]                 ` <CAKON4OxceqF8LJa9L+QZ_jznFbD0VE+2PejdZWTpOC+gdU2vHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: jonsmirl @ 2013-03-21  0:49 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial, Alan Ott

On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl@gmail.com wrote:
>> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> > On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
>> >> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> >> > On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>> >> >> How can you achieve plug and play for a ft2232 based USB serial device
>> >> >> implementing 802.15.4 networking?
>> >> >>
>> >> >> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>> >> >> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>> >> >> discipline, it is not a general purpose serial port.
>> >> >>
>> >> >> Right now the device works by plugging it in and it appears as a
>> >> >> generic USB serial device like ttyUSB0. You then run a user space app
>> >> >> which sets the line discipline, holds the port open and attaches it to
>> >> >> the 6lowpan implementation in the networking code. But doing that is
>> >> >> inconvenient and users needs to be trained to do it. Much simpler if
>> >> >> we could just plug the device in and it worked.
>> >> >>
>> >> >> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>> >> >> possible to make a kernel driver that see this ID, sets the line
>> >> >> discipline and wires the serial port directly into the networking
>> >> >> code?
>> >> >
>> >> > Yes, you can do that.
>> >>
>> >> Is there an existing driver in the kernel that does this?
>> >> So far all of the ones I've checked still need a user space app.
>> >
>> > Look at the bluetooth drivers, they have their own line dicipline I
>> > think.
>>
>> Bluetooth drivers use line discipline on UARTs. On USB they have their
>> own set of Bluetooth descriptors.
>>
>> CAN over serial has a line discipline but it needs a user space app.
>
> In your driver, just attach the line discipline directly to the tty
> device you create.  You will not be using the "normal" usb-serial logic
> at all if you do this, but you should be fine, right?

USB serial port is based on the FT2232 so we've been using that driver.

Modifying that driver was my plan for doing this. I was hoping that
there was a more generic way to achieve the same effect.

It works this way because of ancient history. We used to have dial up
terminal sessions into time share unix. Then you'd run a SLIP app to
convert the terminal session into a TCP/IP session. The assumption in
that scenario is that there is a useful terminal session on the serial
connection. In our case the only thing the connection does is talk
talk the line discipline.

I know how to do it like hciattach. We already have izattach. I'm just
trying to get rid of this pointless app that nobody understands why it
is there.


>
> greg k-h



--
Jon Smirl
jonsmirl@gmail.com

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

* Re: Plug and play for a tty line disciple networking device
       [not found]                 ` <CAKON4OxceqF8LJa9L+QZ_jznFbD0VE+2PejdZWTpOC+gdU2vHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-21  0:56                   ` Greg KH
       [not found]                     ` <20130321005604.GA28671-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2013-03-21  0:56 UTC (permalink / raw)
  To: jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Alan Ott

On Wed, Mar 20, 2013 at 08:49:50PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> > On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> >> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> >> > On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> >> >> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> >> >> > On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> >> >> >> How can you achieve plug and play for a ft2232 based USB serial device
> >> >> >> implementing 802.15.4 networking?
> >> >> >>
> >> >> >> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
> >> >> >> firmware loaded the only thing it can do is talk the 802.15.4 tty line
> >> >> >> discipline, it is not a general purpose serial port.
> >> >> >>
> >> >> >> Right now the device works by plugging it in and it appears as a
> >> >> >> generic USB serial device like ttyUSB0. You then run a user space app
> >> >> >> which sets the line discipline, holds the port open and attaches it to
> >> >> >> the 6lowpan implementation in the networking code. But doing that is
> >> >> >> inconvenient and users needs to be trained to do it. Much simpler if
> >> >> >> we could just plug the device in and it worked.
> >> >> >>
> >> >> >> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
> >> >> >> possible to make a kernel driver that see this ID, sets the line
> >> >> >> discipline and wires the serial port directly into the networking
> >> >> >> code?
> >> >> >
> >> >> > Yes, you can do that.
> >> >>
> >> >> Is there an existing driver in the kernel that does this?
> >> >> So far all of the ones I've checked still need a user space app.
> >> >
> >> > Look at the bluetooth drivers, they have their own line dicipline I
> >> > think.
> >>
> >> Bluetooth drivers use line discipline on UARTs. On USB they have their
> >> own set of Bluetooth descriptors.
> >>
> >> CAN over serial has a line discipline but it needs a user space app.
> >
> > In your driver, just attach the line discipline directly to the tty
> > device you create.  You will not be using the "normal" usb-serial logic
> > at all if you do this, but you should be fine, right?
> 
> USB serial port is based on the FT2232 so we've been using that driver.
> 
> Modifying that driver was my plan for doing this. I was hoping that
> there was a more generic way to achieve the same effect.

No, sorry, stick with doing this from userspace, it's a simple one-line
udev rule, right?

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Plug and play for a tty line disciple networking device
       [not found]                     ` <20130321005604.GA28671-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
@ 2013-03-21  1:12                       ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
  2013-03-21  1:19                         ` Alan Ott
  0 siblings, 1 reply; 16+ messages in thread
From: jonsmirl-Re5JQEeQqe8AvxtiuMwx3w @ 2013-03-21  1:12 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Alan Ott

On Wed, Mar 20, 2013 at 8:56 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> On Wed, Mar 20, 2013 at 08:49:50PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>> On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
>> > On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>> >> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
>> >> > On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>> >> >> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
>> >> >> > On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>> >> >> >> How can you achieve plug and play for a ft2232 based USB serial device
>> >> >> >> implementing 802.15.4 networking?
>> >> >> >>
>> >> >> >> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>> >> >> >> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>> >> >> >> discipline, it is not a general purpose serial port.
>> >> >> >>
>> >> >> >> Right now the device works by plugging it in and it appears as a
>> >> >> >> generic USB serial device like ttyUSB0. You then run a user space app
>> >> >> >> which sets the line discipline, holds the port open and attaches it to
>> >> >> >> the 6lowpan implementation in the networking code. But doing that is
>> >> >> >> inconvenient and users needs to be trained to do it. Much simpler if
>> >> >> >> we could just plug the device in and it worked.
>> >> >> >>
>> >> >> >> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>> >> >> >> possible to make a kernel driver that see this ID, sets the line
>> >> >> >> discipline and wires the serial port directly into the networking
>> >> >> >> code?
>> >> >> >
>> >> >> > Yes, you can do that.
>> >> >>
>> >> >> Is there an existing driver in the kernel that does this?
>> >> >> So far all of the ones I've checked still need a user space app.
>> >> >
>> >> > Look at the bluetooth drivers, they have their own line dicipline I
>> >> > think.
>> >>
>> >> Bluetooth drivers use line discipline on UARTs. On USB they have their
>> >> own set of Bluetooth descriptors.
>> >>
>> >> CAN over serial has a line discipline but it needs a user space app.
>> >
>> > In your driver, just attach the line discipline directly to the tty
>> > device you create.  You will not be using the "normal" usb-serial logic
>> > at all if you do this, but you should be fine, right?
>>
>> USB serial port is based on the FT2232 so we've been using that driver.
>>
>> Modifying that driver was my plan for doing this. I was hoping that
>> there was a more generic way to achieve the same effect.
>
> No, sorry, stick with doing this from userspace, it's a simple one-line
> udev rule, right?

It is fairly simple to do from user space. But you have to find and
install the pointless user space app and then get it pointed at the
correct tty.

That app is a hold over from the ancient days. When you killed it the
serial line would drop the line discipline and revert back to a
terminal session.

What you really want is for devices in this class is to not create a
user space tty device at all. They should just make a net-device. But
there is no way to suppress the creation of the user space tty device.
So we get two both devices and the xx-attach app.

>
> greg k-h



--
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  1:12                       ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
@ 2013-03-21  1:19                         ` Alan Ott
  2013-03-21  1:28                           ` jonsmirl
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Ott @ 2013-03-21  1:19 UTC (permalink / raw)
  To: jonsmirl; +Cc: Greg KH, linux-usb, linux-serial

On 03/20/2013 09:12 PM, jonsmirl@gmail.com wrote:
> On Wed, Mar 20, 2013 at 8:56 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> On Wed, Mar 20, 2013 at 08:49:50PM -0400, jonsmirl@gmail.com wrote:
>>> On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>> On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl@gmail.com wrote:
>>>>> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>> On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
>>>>>>> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>>> On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>>>>>>>>> How can you achieve plug and play for a ft2232 based USB serial device
>>>>>>>>> implementing 802.15.4 networking?
>>>>>>>>>
>>>>>>>>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>>>>>>>>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>>>>>>>>> discipline, it is not a general purpose serial port.
>>>>>>>>>
>>>>>>>>> Right now the device works by plugging it in and it appears as a
>>>>>>>>> generic USB serial device like ttyUSB0. You then run a user space app
>>>>>>>>> which sets the line discipline, holds the port open and attaches it to
>>>>>>>>> the 6lowpan implementation in the networking code. But doing that is
>>>>>>>>> inconvenient and users needs to be trained to do it. Much simpler if
>>>>>>>>> we could just plug the device in and it worked.
>>>>>>>>>
>>>>>>>>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>>>>>>>>> possible to make a kernel driver that see this ID, sets the line
>>>>>>>>> discipline and wires the serial port directly into the networking
>>>>>>>>> code?
>>>>>>>> Yes, you can do that.
>>>>>>> Is there an existing driver in the kernel that does this?
>>>>>>> So far all of the ones I've checked still need a user space app.
>>>>>> Look at the bluetooth drivers, they have their own line dicipline I
>>>>>> think.
>>>>> Bluetooth drivers use line discipline on UARTs. On USB they have their
>>>>> own set of Bluetooth descriptors.
>>>>>
>>>>> CAN over serial has a line discipline but it needs a user space app.
>>>> In your driver, just attach the line discipline directly to the tty
>>>> device you create.  You will not be using the "normal" usb-serial logic
>>>> at all if you do this, but you should be fine, right?
>>> USB serial port is based on the FT2232 so we've been using that driver.
>>>
>>> Modifying that driver was my plan for doing this. I was hoping that
>>> there was a more generic way to achieve the same effect.
>> No, sorry, stick with doing this from userspace, it's a simple one-line
>> udev rule, right?
> It is fairly simple to do from user space. But you have to find and
> install the pointless user space app and then get it pointed at the
> correct tty.

The udev rule would handle calling izattach automatically.

> That app is a hold over from the ancient days. When you killed it the
> serial line would drop the line discipline and revert back to a
> terminal session.
>
> What you really want is for devices in this class is to not create a
> user space tty device at all. They should just make a net-device. But
> there is no way to suppress the creation of the user space tty device.
> So we get two both devices and the xx-attach app.

The udev rule would run when the device gets attached and would call
izattach without any need for user interaction. The user would never
even need to know what /dev/ttyUSBx ever got assigned to it.

Alan.


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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  1:19                         ` Alan Ott
@ 2013-03-21  1:28                           ` jonsmirl
  2013-03-21  1:33                             ` Alan Ott
  0 siblings, 1 reply; 16+ messages in thread
From: jonsmirl @ 2013-03-21  1:28 UTC (permalink / raw)
  To: Alan Ott; +Cc: Greg KH, linux-usb, linux-serial

On Wed, Mar 20, 2013 at 9:19 PM, Alan Ott <alan@signal11.us> wrote:
> On 03/20/2013 09:12 PM, jonsmirl@gmail.com wrote:
>> On Wed, Mar 20, 2013 at 8:56 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>> On Wed, Mar 20, 2013 at 08:49:50PM -0400, jonsmirl@gmail.com wrote:
>>>> On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>> On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl@gmail.com wrote:
>>>>>> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>> On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
>>>>>>>> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>>>> On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>>>>>>>>>> How can you achieve plug and play for a ft2232 based USB serial device
>>>>>>>>>> implementing 802.15.4 networking?
>>>>>>>>>>
>>>>>>>>>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>>>>>>>>>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>>>>>>>>>> discipline, it is not a general purpose serial port.
>>>>>>>>>>
>>>>>>>>>> Right now the device works by plugging it in and it appears as a
>>>>>>>>>> generic USB serial device like ttyUSB0. You then run a user space app
>>>>>>>>>> which sets the line discipline, holds the port open and attaches it to
>>>>>>>>>> the 6lowpan implementation in the networking code. But doing that is
>>>>>>>>>> inconvenient and users needs to be trained to do it. Much simpler if
>>>>>>>>>> we could just plug the device in and it worked.
>>>>>>>>>>
>>>>>>>>>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>>>>>>>>>> possible to make a kernel driver that see this ID, sets the line
>>>>>>>>>> discipline and wires the serial port directly into the networking
>>>>>>>>>> code?
>>>>>>>>> Yes, you can do that.
>>>>>>>> Is there an existing driver in the kernel that does this?
>>>>>>>> So far all of the ones I've checked still need a user space app.
>>>>>>> Look at the bluetooth drivers, they have their own line dicipline I
>>>>>>> think.
>>>>>> Bluetooth drivers use line discipline on UARTs. On USB they have their
>>>>>> own set of Bluetooth descriptors.
>>>>>>
>>>>>> CAN over serial has a line discipline but it needs a user space app.
>>>>> In your driver, just attach the line discipline directly to the tty
>>>>> device you create.  You will not be using the "normal" usb-serial logic
>>>>> at all if you do this, but you should be fine, right?
>>>> USB serial port is based on the FT2232 so we've been using that driver.
>>>>
>>>> Modifying that driver was my plan for doing this. I was hoping that
>>>> there was a more generic way to achieve the same effect.
>>> No, sorry, stick with doing this from userspace, it's a simple one-line
>>> udev rule, right?
>> It is fairly simple to do from user space. But you have to find and
>> install the pointless user space app and then get it pointed at the
>> correct tty.
>
> The udev rule would handle calling izattach automatically.
>
>> That app is a hold over from the ancient days. When you killed it the
>> serial line would drop the line discipline and revert back to a
>> terminal session.
>>
>> What you really want is for devices in this class is to not create a
>> user space tty device at all. They should just make a net-device. But
>> there is no way to suppress the creation of the user space tty device.
>> So we get two both devices and the xx-attach app.
>
> The udev rule would run when the device gets attached and would call
> izattach without any need for user interaction. The user would never
> even need to know what /dev/ttyUSBx ever got assigned to it.

We can just leave everything the way it is, but I hit this same
problem on another project a few years ago.

There's just no generic solution in the kernel for handling serially
connected networking hardware without having a pointless user space
app.

Maybe we could make a generic pointless app and get rid of hciattach,
canattach, izattach, etc. The generic app would get the line
discipline as part of the udev rule.  Even better - put the generic
xx-attach code inside udev so we don't have pointless processes
hanging around.

This is all the code does--
see device appear
open device
set line discipline
hold device exclusively open
...
wait for device to disappear
exit.

>
> Alan.
>



--
Jon Smirl
jonsmirl@gmail.com

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  1:28                           ` jonsmirl
@ 2013-03-21  1:33                             ` Alan Ott
  2013-03-21  1:43                               ` jonsmirl
  0 siblings, 1 reply; 16+ messages in thread
From: Alan Ott @ 2013-03-21  1:33 UTC (permalink / raw)
  To: jonsmirl; +Cc: Greg KH, linux-usb, linux-serial

On 03/20/2013 09:28 PM, jonsmirl@gmail.com wrote:
> On Wed, Mar 20, 2013 at 9:19 PM, Alan Ott <alan@signal11.us> wrote:
>> On 03/20/2013 09:12 PM, jonsmirl@gmail.com wrote:
>>> On Wed, Mar 20, 2013 at 8:56 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>> On Wed, Mar 20, 2013 at 08:49:50PM -0400, jonsmirl@gmail.com wrote:
>>>>> On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>> On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl@gmail.com wrote:
>>>>>>> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>>> On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
>>>>>>>>> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>>>>> On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>>>>>>>>>>> How can you achieve plug and play for a ft2232 based USB serial device
>>>>>>>>>>> implementing 802.15.4 networking?
>>>>>>>>>>>
>>>>>>>>>>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>>>>>>>>>>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>>>>>>>>>>> discipline, it is not a general purpose serial port.
>>>>>>>>>>>
>>>>>>>>>>> Right now the device works by plugging it in and it appears as a
>>>>>>>>>>> generic USB serial device like ttyUSB0. You then run a user space app
>>>>>>>>>>> which sets the line discipline, holds the port open and attaches it to
>>>>>>>>>>> the 6lowpan implementation in the networking code. But doing that is
>>>>>>>>>>> inconvenient and users needs to be trained to do it. Much simpler if
>>>>>>>>>>> we could just plug the device in and it worked.
>>>>>>>>>>>
>>>>>>>>>>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>>>>>>>>>>> possible to make a kernel driver that see this ID, sets the line
>>>>>>>>>>> discipline and wires the serial port directly into the networking
>>>>>>>>>>> code?
>>>>>>>>>> Yes, you can do that.
>>>>>>>>> Is there an existing driver in the kernel that does this?
>>>>>>>>> So far all of the ones I've checked still need a user space app.
>>>>>>>> Look at the bluetooth drivers, they have their own line dicipline I
>>>>>>>> think.
>>>>>>> Bluetooth drivers use line discipline on UARTs. On USB they have their
>>>>>>> own set of Bluetooth descriptors.
>>>>>>>
>>>>>>> CAN over serial has a line discipline but it needs a user space app.
>>>>>> In your driver, just attach the line discipline directly to the tty
>>>>>> device you create.  You will not be using the "normal" usb-serial logic
>>>>>> at all if you do this, but you should be fine, right?
>>>>> USB serial port is based on the FT2232 so we've been using that driver.
>>>>>
>>>>> Modifying that driver was my plan for doing this. I was hoping that
>>>>> there was a more generic way to achieve the same effect.
>>>> No, sorry, stick with doing this from userspace, it's a simple one-line
>>>> udev rule, right?
>>> It is fairly simple to do from user space. But you have to find and
>>> install the pointless user space app and then get it pointed at the
>>> correct tty.
>> The udev rule would handle calling izattach automatically.
>>
>>> That app is a hold over from the ancient days. When you killed it the
>>> serial line would drop the line discipline and revert back to a
>>> terminal session.
>>>
>>> What you really want is for devices in this class is to not create a
>>> user space tty device at all. They should just make a net-device. But
>>> there is no way to suppress the creation of the user space tty device.
>>> So we get two both devices and the xx-attach app.
>> The udev rule would run when the device gets attached and would call
>> izattach without any need for user interaction. The user would never
>> even need to know what /dev/ttyUSBx ever got assigned to it.
> We can just leave everything the way it is, but I hit this same
> problem on another project a few years ago.
>
> There's just no generic solution in the kernel for handling serially
> connected networking hardware without having a pointless user space
> app.
>
> Maybe we could make a generic pointless app and get rid of hciattach,
> canattach, izattach, etc. The generic app would get the line
> discipline as part of the udev rule.  Even better - put the generic
> xx-attach code inside udev so we don't have pointless processes
> hanging around.

Actually, you could use stty for that in the udev rule. You'd have to
use the line discipline number instead of the name, but those are part
of the userspace ABI, so they won't change.


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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  1:33                             ` Alan Ott
@ 2013-03-21  1:43                               ` jonsmirl
  2013-03-21  1:52                                 ` jonsmirl
  0 siblings, 1 reply; 16+ messages in thread
From: jonsmirl @ 2013-03-21  1:43 UTC (permalink / raw)
  To: Alan Ott; +Cc: Greg KH, linux-usb, linux-serial

On Wed, Mar 20, 2013 at 9:33 PM, Alan Ott <alan@signal11.us> wrote:
> On 03/20/2013 09:28 PM, jonsmirl@gmail.com wrote:
>> On Wed, Mar 20, 2013 at 9:19 PM, Alan Ott <alan@signal11.us> wrote:
>>> On 03/20/2013 09:12 PM, jonsmirl@gmail.com wrote:
>>>> On Wed, Mar 20, 2013 at 8:56 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>> On Wed, Mar 20, 2013 at 08:49:50PM -0400, jonsmirl@gmail.com wrote:
>>>>>> On Wed, Mar 20, 2013 at 8:38 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>> On Wed, Mar 20, 2013 at 08:25:15PM -0400, jonsmirl@gmail.com wrote:
>>>>>>>> On Wed, Mar 20, 2013 at 8:14 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>>>> On Wed, Mar 20, 2013 at 08:04:29PM -0400, jonsmirl@gmail.com wrote:
>>>>>>>>>> On Wed, Mar 20, 2013 at 7:26 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>>>>>>>>> On Tue, Mar 19, 2013 at 11:30:05AM -0400, jonsmirl@gmail.com wrote:
>>>>>>>>>>>> How can you achieve plug and play for a ft2232 based USB serial device
>>>>>>>>>>>> implementing 802.15.4 networking?
>>>>>>>>>>>>
>>>>>>>>>>>> The device has a 802.15.4 SOC with a UART attached to a ft2232. With
>>>>>>>>>>>> firmware loaded the only thing it can do is talk the 802.15.4 tty line
>>>>>>>>>>>> discipline, it is not a general purpose serial port.
>>>>>>>>>>>>
>>>>>>>>>>>> Right now the device works by plugging it in and it appears as a
>>>>>>>>>>>> generic USB serial device like ttyUSB0. You then run a user space app
>>>>>>>>>>>> which sets the line discipline, holds the port open and attaches it to
>>>>>>>>>>>> the 6lowpan implementation in the networking code. But doing that is
>>>>>>>>>>>> inconvenient and users needs to be trained to do it. Much simpler if
>>>>>>>>>>>> we could just plug the device in and it worked.
>>>>>>>>>>>>
>>>>>>>>>>>> We can add a EEPROM to the ft2232 to give it a unique USB ID.  Is it
>>>>>>>>>>>> possible to make a kernel driver that see this ID, sets the line
>>>>>>>>>>>> discipline and wires the serial port directly into the networking
>>>>>>>>>>>> code?
>>>>>>>>>>> Yes, you can do that.
>>>>>>>>>> Is there an existing driver in the kernel that does this?
>>>>>>>>>> So far all of the ones I've checked still need a user space app.
>>>>>>>>> Look at the bluetooth drivers, they have their own line dicipline I
>>>>>>>>> think.
>>>>>>>> Bluetooth drivers use line discipline on UARTs. On USB they have their
>>>>>>>> own set of Bluetooth descriptors.
>>>>>>>>
>>>>>>>> CAN over serial has a line discipline but it needs a user space app.
>>>>>>> In your driver, just attach the line discipline directly to the tty
>>>>>>> device you create.  You will not be using the "normal" usb-serial logic
>>>>>>> at all if you do this, but you should be fine, right?
>>>>>> USB serial port is based on the FT2232 so we've been using that driver.
>>>>>>
>>>>>> Modifying that driver was my plan for doing this. I was hoping that
>>>>>> there was a more generic way to achieve the same effect.
>>>>> No, sorry, stick with doing this from userspace, it's a simple one-line
>>>>> udev rule, right?
>>>> It is fairly simple to do from user space. But you have to find and
>>>> install the pointless user space app and then get it pointed at the
>>>> correct tty.
>>> The udev rule would handle calling izattach automatically.
>>>
>>>> That app is a hold over from the ancient days. When you killed it the
>>>> serial line would drop the line discipline and revert back to a
>>>> terminal session.
>>>>
>>>> What you really want is for devices in this class is to not create a
>>>> user space tty device at all. They should just make a net-device. But
>>>> there is no way to suppress the creation of the user space tty device.
>>>> So we get two both devices and the xx-attach app.
>>> The udev rule would run when the device gets attached and would call
>>> izattach without any need for user interaction. The user would never
>>> even need to know what /dev/ttyUSBx ever got assigned to it.
>> We can just leave everything the way it is, but I hit this same
>> problem on another project a few years ago.
>>
>> There's just no generic solution in the kernel for handling serially
>> connected networking hardware without having a pointless user space
>> app.
>>
>> Maybe we could make a generic pointless app and get rid of hciattach,
>> canattach, izattach, etc. The generic app would get the line
>> discipline as part of the udev rule.  Even better - put the generic
>> xx-attach code inside udev so we don't have pointless processes
>> hanging around.
>
> Actually, you could use stty for that in the udev rule. You'd have to
> use the line discipline number instead of the name, but those are part
> of the userspace ABI, so they won't change.

stty won't keep the port locked.  Just have to trust people not to mess with it.

>



--
Jon Smirl
jonsmirl@gmail.com

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

* Re: Plug and play for a tty line disciple networking device
  2013-03-21  1:43                               ` jonsmirl
@ 2013-03-21  1:52                                 ` jonsmirl
  0 siblings, 0 replies; 16+ messages in thread
From: jonsmirl @ 2013-03-21  1:52 UTC (permalink / raw)
  To: Alan Ott; +Cc: Greg KH, linux-usb, linux-serial

For an in-kernel solution serial-core would be to modified with a
create parameter that says don't make a user space device. Then when
the line discipline is registered on a hidden device make it
automatically active. FTDI driver USB ID array would get a parameter
for line discipline. If parameter is non-zero create the device in
hidden mode and set the line disciple.

Probably easier to just make new hardware with a real USB
implementation on the chip. Like the CC2531. But then I'd have to
program an 8051.

--
Jon Smirl
jonsmirl@gmail.com

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

end of thread, other threads:[~2013-03-21  1:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19 15:30 Plug and play for a tty line disciple networking device jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <CAKON4OxNV85-J8C-hodpq9pY5tRCT+7aYa=m4T3Vk04XSGhOrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-20 23:26   ` Greg KH
2013-03-21  0:04     ` jonsmirl
     [not found]       ` <CAKON4Oz+2DfzeOcvmKgi3ADAtyC5ie5-22uUQdfH_gcqeaDSYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21  0:14         ` Greg KH
2013-03-21  0:25           ` jonsmirl
2013-03-21  0:38             ` Greg KH
2013-03-21  0:49               ` jonsmirl
     [not found]                 ` <CAKON4OxceqF8LJa9L+QZ_jznFbD0VE+2PejdZWTpOC+gdU2vHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21  0:56                   ` Greg KH
     [not found]                     ` <20130321005604.GA28671-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-03-21  1:12                       ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
2013-03-21  1:19                         ` Alan Ott
2013-03-21  1:28                           ` jonsmirl
2013-03-21  1:33                             ` Alan Ott
2013-03-21  1:43                               ` jonsmirl
2013-03-21  1:52                                 ` jonsmirl
2013-03-21  0:25           ` Marcel Holtmann
2013-03-21  0:30             ` jonsmirl

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.