Re: usb serial programming

2014-07-21 Thread Sudip Mukherjee
On Mon, Jul 21, 2014 at 8:49 AM, Amadeus W.M.  wrote:
> Not sure if this is the right venue for this question, please direct me to
> the right place if it's not.
>
> I have a C program that opens the serial port /dev/ttyS0 and sends commands
> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
> but I want to use the camera with a Raspberry Pi, which of course does not
> have a serial port (RS232). One option is to use a RS232 to usb adapter and
> rewrite the C code for the usb port. So how do I go about that? Is
> usb serial port programming possible and documented anywhere?

Raspberry PI is not having a dedicated serial port but GPIO14 and
GPIO15 are the Rx and Tx pins , so you can just connect a max3232 to
have a serial port .

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: question about kref API

2014-07-21 Thread Greg KH
On Tue, Jul 22, 2014 at 12:27:20AM +, Jeff Haran wrote:
> Hi,
> 
> I've been reading Documentation/kref.txt in order to understand the
> usage of this API. There is part of this documentation that I am
> having difficulty understanding and was hoping somebody on this list
> could clarify this. One of my assumptions in reading this is that the
> expected usage of this API is that for a given object embedding a
> kref, once the object has been initialized the number of calls to
> "put" a given instance of an object should never exceed the number of
> calls to "get" that same instance.

If it does, the object will be cleaned up and deleted from the system,
so you no longer have a valid pointer.

> Maybe that's the root of my misunderstanding, but my assumption is
> that calls to kref_get() and kref_put() are expected to be made in
> pairs for a given instance of struct kref. If this is wrong, please
> let me know.

"pairs" in that the same number must be called in order for things to
work properly.

> Kref.txt includes some sample code that discusses using a mutex to
> serialize the execution of its get_entry() and put_entry() functions:
> 
> 146 static DEFINE_MUTEX(mutex);
> 147 static LIST_HEAD(q);
> 148 struct my_data
> 149 {
> 150 struct kref  refcount;
> 151 struct list_head link;
> 152 };
> 153 
> 154 static struct my_data *get_entry()
> 155 {
> 156 struct my_data *entry = NULL;
> 157 mutex_lock(&mutex);
> 158 if (!list_empty(&q)) {
> 159 entry = container_of(q.next, struct my_data, link);
> 160 kref_get(&entry->refcount);
> 161 }
> 162 mutex_unlock(&mutex);
> 163 return entry;
> 164 }
> 165 
> 166 static void release_entry(struct kref *ref)
> 167 {
> 168 struct my_data *entry = container_of(ref, struct my_data, 
> refcount);
> 169 
> 170 list_del(&entry->link);
> 171 kfree(entry);
> 172 }
> 173 
> 174 static void put_entry(struct my_data *entry)
> 175 {
> 176 mutex_lock(&mutex);
> 177 kref_put(&entry->refcount, release_entry);
> 178 mutex_unlock(&mutex);
> 179 }
> 
> The sample code does not show the creation of the link list headed by
> q,

That is done there in the static initializer.

> so it is unclear to me what the value of the reference counts in
> these my_data structures are at the time they are enqueued to the
> list. Put another way, it's not clear to me from reading this whether
> kref_init(&(entry->refcount)) was called before the instances of
> struct my_data were put into the list.

Yes it was.

> So I have two interpretations of what is being illustrated with this
> sample code and neither makes much sense to me.
> 
> 1) The krefs are initialized before they go into the list.

Yes.

> If the krefs in the instances of struct my_data are initialized by
> kref_init() before they go into the list and thus start off with a 1,
> then it would seem to me that the mutex would not be necessary so long
> as the number of calls to put_entry() never exceeds the number of
> calls to get_entry().

The mutex is needed as multiple threads could be calling kref_put at the
same time if you don't have that.

Best thing is, don't use the "raw" kref_put() calls, use the
kref_put_mutex() or kref_put_spinlock_irqsave() call instead.  It's much
easier that way and arguably, I should have done that when I created the
API over a decade ago.

> 2) The krefs are not initialized before they go into the list.

Not true, that will not work.

Look at the users of kref in the kernel, they have to be initialized
before anyone else can ever "touch" them, it's that simple.

What were you looking to use a kref for?

Hope this helps,

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


question about kref API

2014-07-21 Thread Jeff Haran
Hi,

I've been reading Documentation/kref.txt in order to understand the usage of 
this API. There is part of this documentation that I am having difficulty 
understanding and was hoping somebody on this list could clarify this. One of 
my assumptions in reading this is that the expected usage of this API is that 
for a given object embedding a kref, once the object has been initialized the 
number of calls to "put" a given instance of an object should never exceed the 
number of calls to "get" that same instance. Maybe that's the root of my 
misunderstanding, but my assumption is that calls to kref_get() and kref_put() 
are expected to be made in pairs for a given instance of struct kref. If this 
is wrong, please let me know.

Kref.txt includes some sample code that discusses using a mutex to serialize 
the execution of its get_entry() and put_entry() functions:

146 static DEFINE_MUTEX(mutex);
147 static LIST_HEAD(q);
148 struct my_data
149 {
150 struct kref  refcount;
151 struct list_head link;
152 };
153 
154 static struct my_data *get_entry()
155 {
156 struct my_data *entry = NULL;
157 mutex_lock(&mutex);
158 if (!list_empty(&q)) {
159 entry = container_of(q.next, struct my_data, link);
160 kref_get(&entry->refcount);
161 }
162 mutex_unlock(&mutex);
163 return entry;
164 }
165 
166 static void release_entry(struct kref *ref)
167 {
168 struct my_data *entry = container_of(ref, struct my_data, refcount);
169 
170 list_del(&entry->link);
171 kfree(entry);
172 }
173 
174 static void put_entry(struct my_data *entry)
175 {
176 mutex_lock(&mutex);
177 kref_put(&entry->refcount, release_entry);
178 mutex_unlock(&mutex);
179 }

The sample code does not show the creation of the link list headed by q, so it 
is unclear to me what the value of the reference counts in these my_data 
structures are at the time they are enqueued to the list. Put another way, it's 
not clear to me from reading this whether kref_init(&(entry->refcount)) was 
called before the instances of struct my_data were put into the list.

So I have two interpretations of what is being illustrated with this sample 
code and neither makes much sense to me.

1) The krefs are initialized before they go into the list.

If the krefs in the instances of struct my_data are initialized by kref_init() 
before they go into the list and thus start off with a 1, then it would seem to 
me that the mutex would not be necessary so long as the number of calls to 
put_entry() never exceeds the number of calls to get_entry(). However in this 
case, (so long as the number of calls to put_entry() never exceeds the number 
of calls to get_entry()), the release function would never get called and the 
entries would remain in the list because the reference count would never get 
down to 0. So this doesn't seem like a correct interpretation to me unless the 
assumption is that what is being illustrated is a case where the number of 
calls to put_entry() equals the number of calls to get_entry() plus 1, the 
final call to put_entry() being the one that causes the deletion of the entry 
from the list and its freeing, in which case the mutex is clearly necessary. 
But this usage (# of puts == # of gets + 1) seems somewhat artificial
  and contrary to my initial assumption.

2) The krefs are not initialized before they go into the list.

On the other hand, if the krefs are not initialized by kref_init() before they 
go into the list and thus contain 0, then the first call to kref_get() to 
retrieve a given entry at line 160 would seem problematic since in recent 
kernels (going back at least 4 years near as I can tell), doing that would 
generate a warning:

41 static inline void kref_get(struct kref *kref)
 42 {
 43 /* If refcount was 0 before incrementing then we have a race
 44  * condition when this kref is freeing by some other thread right 
now.
 45  * In this case one should use kref_get_unless_zero()
 46  */
 47 WARN_ON_ONCE(atomic_inc_return(&kref->refcount) < 2);
 48 }

It doesn't seem reasonable to me that sample code like this would be written 
such that it generated warnings when executed. So this doesn't seem like a 
valid interpretation either.

If someone knowledgeable of this interface could explain whether in this sample 
code the krefs are initialized via kref_init() before they are put into the 
list, I think it would help a lot in my attempt to understand it.

Thanks,

Jeff Haran


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Greg KH
On Mon, Jul 21, 2014 at 07:25:24PM +, Amadeus W.M. wrote:
> > 
> > What is the:
> > Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
> > 
> > device?
> 
> That's my backup power supply. 
> 
> 
> > 
> >> Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
> >> even before I connect anything to the serial port of the cable? 
> > 
> > Yes.
> > 
> > What happens in the kernel log when you plug the device into the system?
> > 
> > Try doing:
> > dmesg -c
> > # plug in the adapter now
> > dmesg
> > to just see the log messages for that, and not the whole kernel boot
> > log.
> > 
> 2) root:~> dmesg -c   #plug-in adapter
> 3) root:~> dmesg 
> 
> Absolutely nothing. I also did
> 
> tail -f /var/log/messages

Then USB isn't working :(

Or the device isn't, can you plug it into some other computer to test it
out?

> then plugged in the adapter, and again, everything seems dead. The USB port
> is ok, because other devices (e.g. the Fushicai video grabber) do work.

Sounds like a broken device.

> >> If the adapter is not supported, can I write a driver for it? I'll be 
> >> happy to,
> >> with a little guidance to get me started. Any pointers?
> > 
> > Odds are the device id just needs to be added to an existing driver as
> > I do not know of any "new" usb-serial converter chips that Linux does
> > not already support.
> > 
> 
> Oh, one more thing. Reading about these converters, I saw many use an 
> ftdi chip, so I did modprobed ftdi_elan and ftdi_sio:
> 
> 7) root:~> lsmod | grep ftdi
> ftdi_elan  36689  0 
> ftdi_sio   48770  0 
> 
> In fact, the dmesg above was with the ftdi modules loaded.

You should get some kernel log messages when a new USB device is plugged
in, no matter what type it is.  The fact that you are not is a problem.

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Bruce Rowen

On Jul 21, 2014, at 1:05 PM, "Amadeus W.M."  wrote:

> On Mon, 21 Jul 2014 12:27:44 -0600, Bruce Rowen wrote:
> 
>> Assuming your camera is RS232, you can use a simple RS232 daughter card on 
>> the Raspberry (about $7 from MCM electronics and others).
>> I have done this exact thing for communications with an old RS232 device.
>> 
>> Alternative is of course a USB to RS232 adapter and as Greg writes, you just 
>> change the target device file (the $7 adapter also creates a /dev/ttyxxx 
>> device.
>> 
>> -Bruce
>> On Jul 21, 2014, at 12:18 PM, Greg KH  wrote:
>> 
> 
> Thank you, that's useful. This, you mean?
> 
> http://www.mcmelectronics.com/product/83-15630

It looks like they may no longer carry it, sorry. There are others out there, 
try googling 'raspberry serial port GPIO adapter'
> 
> This one is for Arduino. I couldn't find one for Pi on the MSM site, but 
> knowing what to search for lead me to a plethora of expansion cards for 
> the RPi:
> 
> http://elinux.org/RPi_Expansion_Boards#RS232_to_TTL_converter


The USB-serial adapter may be the more expedient solution at this point, 
Good luck!

> 
> Thank you for the pointer.
> 
> 
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Amadeus W.M.
> 
> What is the:
>   Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
> 
> device?

That's my backup power supply. 


> 
>> Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
>> even before I connect anything to the serial port of the cable? 
> 
> Yes.
> 
> What happens in the kernel log when you plug the device into the system?
> 
> Try doing:
>   dmesg -c
>   # plug in the adapter now
>   dmesg
> to just see the log messages for that, and not the whole kernel boot
> log.
> 
2) root:~> dmesg -c   #plug-in adapter
3) root:~> dmesg 

Absolutely nothing. I also did

tail -f /var/log/messages

then plugged in the adapter, and again, everything seems dead. The USB port
is ok, because other devices (e.g. the Fushicai video grabber) do work.


>> If the adapter is not supported, can I write a driver for it? I'll be happy 
>> to,
>> with a little guidance to get me started. Any pointers?
> 
> Odds are the device id just needs to be added to an existing driver as
> I do not know of any "new" usb-serial converter chips that Linux does
> not already support.
> 

Oh, one more thing. Reading about these converters, I saw many use an 
ftdi chip, so I did modprobed ftdi_elan and ftdi_sio:

7) root:~> lsmod | grep ftdi
ftdi_elan  36689  0 
ftdi_sio   48770  0 

In fact, the dmesg above was with the ftdi modules loaded.



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Greg KH
On Mon, Jul 21, 2014 at 06:55:43PM +, Amadeus W.M. wrote:
> On Mon, 21 Jul 2014 11:18:28 -0700, Greg KH wrote:
> 
> > On Mon, Jul 21, 2014 at 03:19:00AM +, Amadeus W.M. wrote:
> >> Not sure if this is the right venue for this question, please direct me to
> >> the right place if it's not.
> >> 
> >> I have a C program that opens the serial port /dev/ttyS0 and sends 
> >> commands 
> >> (as strings) back and forth to a pan-tilt-zoom camera. That works very 
> >> well,
> >> but I want to use the camera with a Raspberry Pi, which of course does not 
> >> have a serial port (RS232). One option is to use a RS232 to usb adapter 
> >> and 
> >> rewrite the C code for the usb port. So how do I go about that? Is
> >> usb serial port programming possible and documented anywhere? 
> > 
> > Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
> > away you go...
> 
> Thanks for the prompt answer!
> 
> That's what I was hoping for, and I would have tried that, but I don't
> have any /dev/ttyUSBX. I am connecting the camera to a usb to RS232 
> cable:
> 
> http://www.amazon.com/gp/product/B000BI95W0/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
> 
> Does this mean my adapter is not supported by linux? Also, nothing 
> happens in /var/log/messages when I plug the cable into the usb port. 
> This is my lsusb:
> 
> 1) root:~> lsusb
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 005 Device 003: ID 0c45:1050 Microdia CF Card Reader
> Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
> Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 003 Device 005: ID 04fc:0561 Sunplus Technology Co., Ltd Flexcam 100
> Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> No trace of the adapter.

What is the:
Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS

device?

> Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
> even before I connect anything to the serial port of the cable? 

Yes.

What happens in the kernel log when you plug the device into the system?

Try doing:
dmesg -c
# plug in the adapter now
dmesg
to just see the log messages for that, and not the whole kernel boot
log.

> If the adapter is not supported, can I write a driver for it? I'll be happy 
> to,
> with a little guidance to get me started. Any pointers?

Odds are the device id just needs to be added to an existing driver as
I do not know of any "new" usb-serial converter chips that Linux does
not already support.

thanks,

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Amadeus W.M.
On Mon, 21 Jul 2014 12:27:44 -0600, Bruce Rowen wrote:

> Assuming your camera is RS232, you can use a simple RS232 daughter card on 
> the Raspberry (about $7 from MCM electronics and others).
> I have done this exact thing for communications with an old RS232 device.
> 
> Alternative is of course a USB to RS232 adapter and as Greg writes, you just 
> change the target device file (the $7 adapter also creates a /dev/ttyxxx 
> device.
> 
> -Bruce
> On Jul 21, 2014, at 12:18 PM, Greg KH  wrote:
> 

Thank you, that's useful. This, you mean?

http://www.mcmelectronics.com/product/83-15630

This one is for Arduino. I couldn't find one for Pi on the MSM site, but 
knowing what to search for lead me to a plethora of expansion cards for 
the RPi:

http://elinux.org/RPi_Expansion_Boards#RS232_to_TTL_converter

Thank you for the pointer.



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Amadeus W.M.
On Mon, 21 Jul 2014 11:18:28 -0700, Greg KH wrote:

> On Mon, Jul 21, 2014 at 03:19:00AM +, Amadeus W.M. wrote:
>> Not sure if this is the right venue for this question, please direct me to
>> the right place if it's not.
>> 
>> I have a C program that opens the serial port /dev/ttyS0 and sends commands 
>> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
>> but I want to use the camera with a Raspberry Pi, which of course does not 
>> have a serial port (RS232). One option is to use a RS232 to usb adapter and 
>> rewrite the C code for the usb port. So how do I go about that? Is
>> usb serial port programming possible and documented anywhere? 
> 
> Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
> away you go...

Thanks for the prompt answer!

That's what I was hoping for, and I would have tried that, but I don't
have any /dev/ttyUSBX. I am connecting the camera to a usb to RS232 
cable:

http://www.amazon.com/gp/product/B000BI95W0/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

Does this mean my adapter is not supported by linux? Also, nothing 
happens in /var/log/messages when I plug the cable into the usb port. 
This is my lsusb:

1) root:~> lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 0c45:1050 Microdia CF Card Reader
Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 005: ID 04fc:0561 Sunplus Technology Co., Ltd Flexcam 100
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

No trace of the adapter.


Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
even before I connect anything to the serial port of the cable? 

If the adapter is not supported, can I write a driver for it? I'll be happy to,
with a little guidance to get me started. Any pointers?

Thanks!


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to prevent a module from unloading when in used

2014-07-21 Thread Greg KH
On Mon, Jul 21, 2014 at 10:20:48AM +0530, Chetan Nanda wrote:
> On Mon, Jul 21, 2014 at 9:52 AM, Greg KH  wrote:
> 
> > On Mon, Jul 21, 2014 at 09:09:02AM +0530, Chetan Nanda wrote:
> > > I try to debug the hang when unloading of driver. I am using kernel v3.10
> > > and it hangs in 'wait_for_zero_refcount'.
> > > I checked that this function has been removed in kernel 3.13.
> > > But I am not able to find the patch for this change.
> > >
> > > Is there an easy way to find the patch which cause removal of wait from
> > > module unloading in v3.13.
> >
> > You have the full git tree, it should be very easy to find, you don't
> > need help from me.
> >
> > Hi Greg,
> 
> Thanks for your mail,
> 
> I have found a thread with the discussion and a patch for removing the
> wait_for_zero_refcount from module unloading, But not able to find this
> patch being merged on v3.13. (have checked all patches between 3.12 and
> 3.13)
> http://www.gossamer-threads.com/lists/linux/kernel/1783584?do=post_view_threaded#1783584

This email tells you the exact name of the patch to search for, and the
files in which it modifies, making it even easier to search for it.

How are you searching the git log that you are not seeing this patch,
which ended up being in the 3.13-rc1 kernel release?

Finding the git commit id is an exercise left for the reader...

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Bruce Rowen
Assuming your camera is RS232, you can use a simple RS232 daughter card on the 
Raspberry (about $7 from MCM electronics and others).
I have done this exact thing for communications with an old RS232 device.

Alternative is of course a USB to RS232 adapter and as Greg writes, you just 
change the target device file (the $7 adapter also creates a /dev/ttyxxx device.

-Bruce
On Jul 21, 2014, at 12:18 PM, Greg KH  wrote:

> On Mon, Jul 21, 2014 at 03:19:00AM +, Amadeus W.M. wrote:
>> Not sure if this is the right venue for this question, please direct me to
>> the right place if it's not.
>> 
>> I have a C program that opens the serial port /dev/ttyS0 and sends commands 
>> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
>> but I want to use the camera with a Raspberry Pi, which of course does not 
>> have a serial port (RS232). One option is to use a RS232 to usb adapter and 
>> rewrite the C code for the usb port. So how do I go about that? Is
>> usb serial port programming possible and documented anywhere? 
> 
> Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
> away you go...
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: usb serial programming

2014-07-21 Thread Greg KH
On Mon, Jul 21, 2014 at 03:19:00AM +, Amadeus W.M. wrote:
> Not sure if this is the right venue for this question, please direct me to
> the right place if it's not.
> 
> I have a C program that opens the serial port /dev/ttyS0 and sends commands 
> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
> but I want to use the camera with a Raspberry Pi, which of course does not 
> have a serial port (RS232). One option is to use a RS232 to usb adapter and 
> rewrite the C code for the usb port. So how do I go about that? Is
> usb serial port programming possible and documented anywhere? 

Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
away you go...

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to automate checkpatch && get_maintainers && git send-email of commits range?

2014-07-21 Thread Nick Krause
> Hi Steve
>
> Why not share your quilt skills, say by adding a file in the Document 
> directory?
>
> Hillf
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


I agree with hillf here this may be of use to other developers on the
lkml and you
should write a file in the Document dictionary.
Nick

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


usb serial programming

2014-07-21 Thread Amadeus W.M.
Not sure if this is the right venue for this question, please direct me to
the right place if it's not.

I have a C program that opens the serial port /dev/ttyS0 and sends commands 
(as strings) back and forth to a pan-tilt-zoom camera. That works very well,
but I want to use the camera with a Raspberry Pi, which of course does not 
have a serial port (RS232). One option is to use a RS232 to usb adapter and 
rewrite the C code for the usb port. So how do I go about that? Is
usb serial port programming possible and documented anywhere? 

Thanks!


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to automate checkpatch && get_maintainers && git send-email of commits range?

2014-07-21 Thread Dave Chinner
On Sat, Jul 19, 2014 at 11:35:45AM +0800, Hillf Danton wrote:
> On Sat, Jul 19, 2014 at 9:31 AM, Steven Rostedt  wrote:
> > On Fri, Jul 18, 2014 at 06:22:15PM -0400, Theodore Ts'o wrote:
> >>
> >> And then think very hard about which patches people need to see in
> >> order to be able to evaluate a patch.  For example, if you have patch
> >> 1 out of a series which adds a new function, and then patches 2
> >> through 1000 modify a thousand different drivers to use that new
> >> function, if you use an automated get_maintainers.pl script to send
> >> each patch to just the maintainer, then the device driver maintainer
> >> might not see patch #1 which is critical context to understanding the
> >> patch that you want to make to his driver.  And then you will have
> >> several hundred very angry and annoyed developers wondering why you
> >> sent them patch 345/1000, with no other context, and wondering what
> >> the heck they are supposed to do with the email that you have just
> >> launched into their inbox.
> >
> > I'm still stuck in the old stone/quilt age, where I use quilt mail to
> > send my patch bombs. Although, I have scripts that pulls my patches out
> > from git with format-patch, and then creates a quilt queue from them.
> > I do this for that very reason that I want to review all patches before
> > I hit send, and quilt mail is very basic and sends what I tell it.
> > I still a bit gun shy from using git sendmail as I never got that to
> > work (note, the last time I tried, it was still doing the staircase
> > threads with patches by default).
> >
> > I'm still content with quilt, but the one thing I don't care about it
> > is that all Cc'd on the 0/1000 patch gets Cc'd on all patches. I wish
> > there was a way to tell quilt that they should only get Cc'd on the
> > cover patch and no more, unless the patch has them Cc'd. The reason this
> > bothers me is that I tend to do exactly what you stated above. I will
> > just Cc patch 345/1000 to someone with no context of what that patch
> > is.
> >
> > I figured people would do the same thing that I do when I get that 345th
> > patch. As I'm subscribed to LKML, I will just go into my lkml folder and
> > search for that patch and see how that thread applies to me with full
> > context. I'm assuming that's what others may do too.
> >
> Hi Steve
> 
> Why not share your quilt skills, say by adding a file in the Document 
> directory?

guilt (quilt for git) already does all this scripting for you.

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to automate checkpatch && get_maintainers && git send-email of commits range?

2014-07-21 Thread Theodore Ts'o
On Fri, Jul 18, 2014 at 05:38:30PM +0300, Andrey Utkin wrote:
> Is there script for automated checkpatch.pl && get_maintainers.pl &&
> git send-email for range of commits? I see none. Would it be welcome
> to submit such one to kernel tree?

Too much automation can be a really bad thing.  You **really** want to
sanity check the output of checkpatch.pl and get_maintainers.pl.
Their output is not always correct, and some amount of human common
sense is required.  (Granted Nick Krause hasn't shown much in the way
of common sense, but some human intervention --- assuming he is human
and not an badly written, automated troll program --- is better than
none.)

The other thing is that I strongly recommend that people use git
format-patch first, to make sure that what you will be blasting out to
thousands of peoples' mail boxes is in fact sane.

And then think very hard about which patches people need to see in
order to be able to evaluate a patch.  For example, if you have patch
1 out of a series which adds a new function, and then patches 2
through 1000 modify a thousand different drivers to use that new
function, if you use an automated get_maintainers.pl script to send
each patch to just the maintainer, then the device driver maintainer
might not see patch #1 which is critical context to understanding the
patch that you want to make to his driver.  And then you will have
several hundred very angry and annoyed developers wondering why you
sent them patch 345/1000, with no other context, and wondering what
the heck they are supposed to do with the email that you have just
launched into their inbox.

There's a reason why many developers cordially hate these scripts;
it's too easy to misuse them, and unfortunately, there are too many
Nick Krause like idiots out there who mindlessly use such scripts and
cause pain to maintainers.  The critical step is to force such idiots
to stop and ***think*** and unfortunately, automation seems to
encourage the opposite behaviour.

Regards,

- Ted

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to automate checkpatch && get_maintainers && git send-email of commits range?

2014-07-21 Thread Steven Rostedt
On Fri, Jul 18, 2014 at 06:22:15PM -0400, Theodore Ts'o wrote:
> 
> And then think very hard about which patches people need to see in
> order to be able to evaluate a patch.  For example, if you have patch
> 1 out of a series which adds a new function, and then patches 2
> through 1000 modify a thousand different drivers to use that new
> function, if you use an automated get_maintainers.pl script to send
> each patch to just the maintainer, then the device driver maintainer
> might not see patch #1 which is critical context to understanding the
> patch that you want to make to his driver.  And then you will have
> several hundred very angry and annoyed developers wondering why you
> sent them patch 345/1000, with no other context, and wondering what
> the heck they are supposed to do with the email that you have just
> launched into their inbox.

I'm still stuck in the old stone/quilt age, where I use quilt mail to
send my patch bombs. Although, I have scripts that pulls my patches out
from git with format-patch, and then creates a quilt queue from them.
I do this for that very reason that I want to review all patches before
I hit send, and quilt mail is very basic and sends what I tell it.
I still a bit gun shy from using git sendmail as I never got that to
work (note, the last time I tried, it was still doing the staircase
threads with patches by default).

I'm still content with quilt, but the one thing I don't care about it
is that all Cc'd on the 0/1000 patch gets Cc'd on all patches. I wish
there was a way to tell quilt that they should only get Cc'd on the
cover patch and no more, unless the patch has them Cc'd. The reason this
bothers me is that I tend to do exactly what you stated above. I will
just Cc patch 345/1000 to someone with no context of what that patch
is.

I figured people would do the same thing that I do when I get that 345th
patch. As I'm subscribed to LKML, I will just go into my lkml folder and
search for that patch and see how that thread applies to me with full
context. I'm assuming that's what others may do too.

-- Steve


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to automate checkpatch && get_maintainers && git send-email of commits range?

2014-07-21 Thread Hillf Danton
On Sat, Jul 19, 2014 at 9:31 AM, Steven Rostedt  wrote:
> On Fri, Jul 18, 2014 at 06:22:15PM -0400, Theodore Ts'o wrote:
>>
>> And then think very hard about which patches people need to see in
>> order to be able to evaluate a patch.  For example, if you have patch
>> 1 out of a series which adds a new function, and then patches 2
>> through 1000 modify a thousand different drivers to use that new
>> function, if you use an automated get_maintainers.pl script to send
>> each patch to just the maintainer, then the device driver maintainer
>> might not see patch #1 which is critical context to understanding the
>> patch that you want to make to his driver.  And then you will have
>> several hundred very angry and annoyed developers wondering why you
>> sent them patch 345/1000, with no other context, and wondering what
>> the heck they are supposed to do with the email that you have just
>> launched into their inbox.
>
> I'm still stuck in the old stone/quilt age, where I use quilt mail to
> send my patch bombs. Although, I have scripts that pulls my patches out
> from git with format-patch, and then creates a quilt queue from them.
> I do this for that very reason that I want to review all patches before
> I hit send, and quilt mail is very basic and sends what I tell it.
> I still a bit gun shy from using git sendmail as I never got that to
> work (note, the last time I tried, it was still doing the staircase
> threads with patches by default).
>
> I'm still content with quilt, but the one thing I don't care about it
> is that all Cc'd on the 0/1000 patch gets Cc'd on all patches. I wish
> there was a way to tell quilt that they should only get Cc'd on the
> cover patch and no more, unless the patch has them Cc'd. The reason this
> bothers me is that I tend to do exactly what you stated above. I will
> just Cc patch 345/1000 to someone with no context of what that patch
> is.
>
> I figured people would do the same thing that I do when I get that 345th
> patch. As I'm subscribed to LKML, I will just go into my lkml folder and
> search for that patch and see how that thread applies to me with full
> context. I'm assuming that's what others may do too.
>
Hi Steve

Why not share your quilt skills, say by adding a file in the Document directory?

Hillf

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies