On 13 May 2014 21:09, Mike Larkin <mlar...@azathoth.net> wrote: > On Wed, May 14, 2014 at 10:01:28AM +0900, SASANO Takayoshi wrote: >> Hi, Mike. >> >> >> + val = 0x501f; >> >> + idx = 0xd90a; >> > >> > What are these magic numbers? >> >> These numbers come from Linux driver (ch341.c). I don't know what they mean. >> Maybe these numbers represent default character length and baudrate divisor. >> >> http://lxr.cpsc.ucalgary.ca/lxr/#linux+v2.6.31/drivers/usb/serial/ch341.c#L217 >> >> With my CH340T, uchcom(4) generates val=0x401f/idx=0xb2d2. >> >> uchcom(4) reads CH340 registers to make val/idx value but I think this >> method is improper for initialize. Because none can take the initial state >> when the chip's default value has changed. >> >> It seems that the content/function of UCHCOM_REG_LCR1 has been changed, >> and generated results are doubtful. So I use Linux's magic numbers. >> >> Regards, >> -- >> SASANO Takayoshi <u...@mx5.nisiq.net> >> > > I don't think we should be committing things that use magic numbers unless > we completely understand what they mean. And in that case, such magic numbers > would > likely be constructed from some #defines. Just because Linux uses those > numbers > doesn't mean we should, IMO. >
+1 .... Ken